Exemplo n.º 1
0
        /// <summary>
        /// Checks for and handles the input for movement
        /// </summary>
        private void HandleMovementInput()
        {
            Vector2 inputVector = Vector2.zero;

            if (Input.GetKey(KeyCode.UpArrow))
            {
                inputVector.y = 1f;
            }
            else if (Input.GetKey(KeyCode.DownArrow))
            {
                inputVector.y = -1f;
            }
            else if (Input.GetKey(KeyCode.LeftArrow))
            {
                inputVector.x = -1f;
            }
            else if (Input.GetKey(KeyCode.RightArrow))
            {
                inputVector.x = 1f;
            }
            else
            {
                inputVector = Vector2.zero;
            }

            // Apply our input
            mTankMovement.SetInput(inputVector);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Applies the input to the TankMovement script
 /// </summary>
 private void ApplyInput()
 {
     mTankMovement.SetInput(mCurrentInput);
 }