Exemple #1
0
        void Movement()
        {
            float inputV = Input.GetAxis("Vertical");
            // -1   == S || DownArrow
            //  0   == Not Pressed
            //  1   == W || UpArrow

            float inputH = Input.GetAxis("Horizontal");

            // -1   == A || LeftArrow
            //  0   == Not Pressed
            //  1   == D || RightArrow


            if (inputV > 0)
            {
                movement.Accelerate(transform.up);
            }

            if (inputH < 0)
            {
                movement.RotateLeft();
            }

            if (inputH > 0)
            {
                movement.RotateRight();
            }
            if (Input.GetKey(KeyCode.S))
            {
                movement.Stop();
            }
        }