protected virtual void OnMove(Vector2 input, bool running) { var cam = CameraManager.Mode as IRotatableCamera; if (input.magnitude > 0 && cam is IPerspectiveCamera) { var speed = Locomotion.RotateTowards(Vector3.up, cam.Heading); cam.Heading -= speed * Time.deltaTime; } var movement = input.normalized; Locomotion.Move(new Vector3(movement.x, 0, movement.y)); if (running && Locomotion.Pacing != RunningPace) { Locomotion.Pacing = RunningPace; } if (!running && Locomotion.Pacing == RunningPace) { Locomotion.Pacing = WalkingPace; } }
//Commands public virtual void Move(Vector3 dir) { locomotion.horizontal = dir.x; locomotion.vertical = dir.z; Vector3 v = dir.z * cameraMovement.transform.forward; Vector3 h = dir.x * cameraMovement.transform.right; locomotion.Move(v, h); }
private void DoInput() { // Only do input if game in progrss and window has focus. var playing = GameController.Instance.State == GameController.StateType.Playing; if (playing && Application.isFocused && !Time.Expired) { Locomotion.Move(Input.MoveVector); if (Input.Interact && InteractionDetection.AvailableInteraction != null) { InteractionDetection.AvailableInteraction.Interact(this); } } }
//-------------------------------------------------------------------------------------------------------------------- // - Move To (X,Y) //-------------------------------------------------------------------------------------------------------------------- public virtual void Move(Vector2f position) { Locomotion?.Move(position); }