import Sprite3D = Laya.Sprite3D;
import Transform3D = Laya.Transform3D;
import Camera, { CameraState } from "../GameLogic/Camera";
export default class CameraManager {
    private static instance: CameraManager;
    public static get Instance(): CameraManager {
        return this.instance || (this.instance = new CameraManager());
    }

    public startPosTra: Transform3D;
    public _camer: Laya.Camera;
    public Camera: Camera;
    public Init(cam: Laya.Camera, startPos: Sprite3D) {
        this.startPosTra = startPos.transform;
        if (cam) {
            this._camer = cam;
            this.Camera = this._camer.addComponent(Camera);
            this.Camera.Init();
            
        }
    }

    /**
     * 设置相机的跟随状态
     * @param type 
     * @param arg 
     */
    public SetCamState(type, arg) {
        if (this.Camera) this.Camera.SetCameraByState(type, arg);
    }
    /**
     * 相机跟随移动
     */
    public CameraMoveIngame(z:number){
        if(this.Camera)this.Camera.MoveGame(z);
    }
}