void Locked() { transform.position = Player.position + Offset; if (Input.GetKeyUp(KeyCode.Space)) { state = GameConsts.CAMERA_STATE.UNLOCKED; } }
void Unlocked() { state = Input.GetKey(KeyCode.Space) ? GameConsts.CAMERA_STATE.LOCKED : GameConsts.CAMERA_STATE.UNLOCKED; CameraMove(); }
private void LateUpdate() { if (Input.GetKeyDown(KeyCode.Y)) { state = state == GameConsts.CAMERA_STATE.LOCKED ? GameConsts.CAMERA_STATE.UNLOCKED : GameConsts.CAMERA_STATE.LOCKED; } switch (state) { case GameConsts.CAMERA_STATE.LOCKED: { Locked(); break; } case GameConsts.CAMERA_STATE.UNLOCKED: { Unlocked(); break; } } }