Exemplo n.º 1
0
        private void LateUpdate()
        {
            if (moveTargetFoundThisFrame)
            {
                tankController.RotateTowardsTarget(moveTarget);
                moveTargetFoundThisFrame = false;
                if (moveTargetSeenByDriver)
                {
                    moveTargetSeenByDriver = false;
                    tankController.MoveForward();
                }
            }
            else
            {
                tankController.TurnRight();
                tankController.MoveForward();
            }

            if (shootTargetFoundThisFrame)
            {
                turretController.RotateTowardsTarget(shootTarget);
                if (shootTargetSeenByTurret)
                {
                    shootTargetSeenByTurret = false;
                    turretController.Shoot();
                }
            }
        }
Exemplo n.º 2
0
        private void Update()
        {
            if (Input.GetKey(moveTankForward))
            {
                tankController.MoveForward();
            }

            if (Input.GetKey(turnTankLeft))
            {
                tankController.TurnLeft();
            }

            if (Input.GetKey(moveTankBackward))
            {
                tankController.MoveBackward();
            }

            if (Input.GetKey(turnTankRight))
            {
                tankController.TurnRight();
            }

            if (Input.GetKeyDown(KeyCode.Space))
            {
                turretController.Shoot();
            }

            if (Input.GetKey(KeyCode.Q))
            {
                turretController.TurnLeft();
            }

            if (Input.GetKey(KeyCode.E))
            {
                turretController.TurnRight();
            }
        }
Exemplo n.º 3
0
    public IEnumerator Shoot(MovementController ctr)
    {
        TurretController ltr = ctr as TurretController;

        yield return(ltr.Shoot());
    }