Exemplo n.º 1
0
        private void MoveForwardAndBackward(Vector2 input)
        {
            input = CalculateInputWithThresholdY(input, 0.2f);
            Vector2 inertia = Inertia.PerformInertiaLeftHand(input);

            player.transform.position += ControlParameters.Inertia ?
                                         cam.transform.forward * input.y * ControlParameters.MovementSpeed * Time.deltaTime
                                         + cam.transform.forward * inertia.y * ControlParameters.MovementSpeed * Time.deltaTime
                : cam.transform.forward * input.y * ControlParameters.MovementSpeed * Time.deltaTime;
        }
Exemplo n.º 2
0
        private void MoveVertical(Vector2 input)
        {
            Vector2 inertia = Inertia.PerformInertiaRightHand(input);

            player.transform.position += ControlParameters.Inertia ?
                                         cam.transform.up * input.y * ControlParameters.MovementSpeed * Time.deltaTime
                                         + cam.transform.up * inertia.y * ControlParameters.MovementSpeed * Time.deltaTime
                : cam.transform.up * input.y * ControlParameters.MovementSpeed * Time.deltaTime;

            player.transform.position += ControlParameters.Inertia ?
                                         cam.transform.right * input.x * ControlParameters.MovementSpeed * Time.deltaTime
                                         + cam.transform.right * inertia.x * ControlParameters.MovementSpeed * Time.deltaTime
                : cam.transform.right * input.x * ControlParameters.MovementSpeed * Time.deltaTime;
        }