예제 #1
0
 private void On_AIPlayerController_WillGetDestroyed(AbstractAIPlayerController aIPlayerController)
 {
     if (aIPlayerController)
     {
         aIPlayerController.AxisUpdated      -= On_AIPlayerController_JoystickMoved;
         aIPlayerController.WillGetDestroyed -= On_AIPlayerController_WillGetDestroyed;
         if (IS_VALUE_CONTAINED(activeAIControllers, aIPlayerController))
         {
             activeAIControllers.Remove(aIPlayerController);
         }
     }
 }
예제 #2
0
        private void On_PLAYERS_PlayerSpawned(BEHandle <EPlayerID, IPlayer> bHandle)
        {
            // Add an AIPlayerController on the spawned player if he's an AI
            EPlayerID     playerID     = bHandle.Arg1;
            EControllerID controllerID = PlayerManager.Instance.GetAssignedControllerID(playerID);

            if ((controllerID.ContainedIn(BConsts.AI_CONTROLLERS)) &&
                (IS_KEY_CONTAINED(PlayerManager.Instance.ActivePlayers, playerID)) &&
                (IS_NOT_NULL(PlayerManager.Instance.ActivePlayers[playerID])))
            {
                AbstractPlayer             player             = PlayerManager.Instance.ActivePlayers[playerID];
                AbstractAIPlayerController aIPlayerController = player.gameObject.AddComponent <AbstractAIPlayerController>();
                aIPlayerController.AxisUpdated      += On_AIPlayerController_JoystickMoved;
                aIPlayerController.ButtonPressed    += On_AIPlayerController_ButtonPressed;
                aIPlayerController.ButtonReleased   += On_AIPlayerController_ButtonReleased;
                aIPlayerController.WillGetDestroyed += On_AIPlayerController_WillGetDestroyed;
                aIPlayerController.InitializeAIController(this);
                activeAIControllers.Add(aIPlayerController);
            }
        }