Esempio 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();
                }
            }
        }