public void CenterCamera() { if (_rtsCamera == null) { return; // no camera, bail! } //_rtsCamera.JumpTo(new Vector3(0, 0, 0)); _rtsCamera.ResetToInitialValues(true); }
public void SceneInit() { ClearSceneSetting(); RtsCamera.ResetToInitialValues(false, false); // 새로운 씬 입장시, 쉐이크 중이었던 것을 모두 꺼야, 간헐적 버그 방지 Thinksquirrel.Utilities.CameraShake.CancelAllShakes(); }
protected void Update() { if (_rtsCamera == null) { return; // no camera, bail! } if (AllowMove && (!_rtsCamera.IsFollowing || MovementBreaksFollow)) { var hasMovement = false; var speed = MoveSpeed; if (AllowFastMove && (Input.GetKey(FastMoveKeyCode1) || Input.GetKey(FastMoveKeyCode2))) { speed = FastMoveSpeed; } var h = Input.GetAxisRaw(HorizontalInputAxis); if (Mathf.Abs(h) > 0.001f) { hasMovement = true; _rtsCamera.AddToPosition(h * speed * Time.unscaledDeltaTime, 0, 0); } var v = Input.GetAxisRaw(VerticalInputAxis); if (Mathf.Abs(v) > 0.001f) { hasMovement = true; _rtsCamera.AddToPosition(0, 0, v * speed * Time.unscaledDeltaTime); } if (hasMovement && _rtsCamera.IsFollowing && MovementBreaksFollow) { _rtsCamera.EndFollow(); } } // if (AllowRotate) { if (RotateUsesInputAxis) { var rot = Input.GetAxisRaw(RotateInputAxis); if (Mathf.Abs(rot) > 0.001f) { _rtsCamera.Rotation += rot * RotateSpeed * Time.unscaledDeltaTime; } } else { if (Input.GetKey(RotateLeftKey)) { _rtsCamera.Rotation += RotateSpeed * Time.unscaledDeltaTime; } if (Input.GetKey(RotateRightKey)) { _rtsCamera.Rotation -= RotateSpeed * Time.unscaledDeltaTime; } } } if (AllowZoom) { if (ZoomUsesInputAxis) { var zoom = Input.GetAxisRaw(ZoomInputAxis); if (Mathf.Abs(zoom) > 0.001f) { _rtsCamera.Distance += zoom * ZoomSpeed * Time.unscaledDeltaTime; } } else { if (Input.GetKey(ZoomOutKey)) { _rtsCamera.Distance += ZoomSpeed * Time.unscaledDeltaTime; } if (Input.GetKey(ZoomInKey)) { _rtsCamera.Distance -= ZoomSpeed * Time.unscaledDeltaTime; } } } if (AllowTilt) { if (TiltUsesInputAxis) { var tilt = Input.GetAxisRaw(TiltInputAxis); if (Mathf.Abs(tilt) > 0.001f) { _rtsCamera.Tilt += tilt * TiltSpeed * Time.unscaledDeltaTime; } } else { if (Input.GetKey(TiltUpKey)) { _rtsCamera.Tilt += TiltSpeed * Time.unscaledDeltaTime; } if (Input.GetKey(TiltDownKey)) { _rtsCamera.Tilt -= TiltSpeed * Time.unscaledDeltaTime; } } } // if (ResetKey != KeyCode.None) { if (Input.GetKeyDown(ResetKey)) { _rtsCamera.ResetToInitialValues(IncludePositionOnReset, false); } } }