예제 #1
0
        void ProcessTankControls()
        {
            if (controllableTank == null || !game)
            {
                return;
            }

            controllableTank.Move(Input.GetAxis("Vertical"));
            controllableTank.Rotate(Input.GetAxis("Horizontal"));
            controllableTank.ProcessTowerRotation(Camera.main.ScreenToWorldPoint(Input.mousePosition));
            if (Input.GetMouseButtonDown(0))
            {
                controllableTank.Shoot();
            }
            else if (Input.GetKeyDown(KeyCode.E))
            {
                controllableTank.NextWeapon();
            }
            else if (Input.GetKeyDown(KeyCode.Q))
            {
                controllableTank.PreviousWeapon();
            }
            if (Input.GetMouseButton(0))
            {
                controllableTank.ShootAutomatically();
            }
        }