Ejemplo n.º 1
0
 public void SetActiveCam(CamStage camStage)
 {
     foreach (var cam in camerasInGame)
     {
         if (cam.CamStage == camStage)
         {
             _camBrain.SetCamPoint(cam.TargetCamPoint);
         }
     }
 }
Ejemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        float horizInput = Input.GetAxis("Horizontal");
        float vertInput  = Input.GetAxis("Vertical");
        float yVertInput = Input.GetAxis("YVertical");

        _myCamStage = Input.GetButton("Jump") ? CamStage.HorizontalOrbit : CamStage.Static;

        if (Input.GetKey(KeyCode.R))
        {
            _myTrans.rotation = Quaternion.Euler(Vector3.zero);
            _myTrans.position = new Vector3(0, 0, _defaultDistance);
        }


        switch (_myCamStage)
        {
        case CamStage.Static:
            if (!mainCamera.orthographic)
            {
                mainCamera.orthographic = true;
            }

            mainCamera.orthographicSize -= yVertInput * Time.deltaTime;

            break;

        case CamStage.HorizontalOrbit:
            if (mainCamera.orthographic)
            {
                mainCamera.orthographic = false;
            }

            _myTrans.Translate(0, 0, yVertInput * Time.deltaTime);
            _myTrans.Rotate(Vector3.up, -horizInput * Time.deltaTime * flySpeed, Space.World);
            _myTrans.Rotate(Vector3.right, vertInput * Time.deltaTime * flySpeed);
            break;

        default:
            print("Unhandled Camera Stage: " + _myCamStage);
            break;
        }
    }
Ejemplo n.º 3
0
 // Start is called before the first frame update
 void Start()
 {
     _myTrans         = transform;
     _myCamStage      = CamStage.Static;
     _defaultDistance = _myTrans.position.z;
 }
Ejemplo n.º 4
0
 private void Start()
 {
     SetActiveCam(startCamStage);
     _currentCamStage = startCamStage;
 }