public void Awake()
        {
            instance = this;

            for (int i = 0; i < NUM_PADS; ++i)
            {
                gamepads.Add(new Gamepad(i));
            }
        }
Beispiel #2
0
 private static void SwitchContext(Func <int, List <IInputConsumer> > contextFunction, int i = -1)
 {
     if (i == -1)
     {
         for (i = 0; i < GameInfo.PlayerNumber; i++)
         {
             GamepadMgr.Pad(i).SwitchGamepadContext(contextFunction(i), i);
         }
     }
     else
     {
         GamepadMgr.Pad(i).SwitchGamepadContext(contextFunction(i), i);
     }
 }
 protected void ActivatePlayer(bool activate, int i)
 {
     if (activate)
     {
         GetComponent <ASpawnPlayerController>().InstantiatePlayer(i, OnPlayerInitialized);
     }
     else
     {
         GamepadMgr.Pad(i).SwitchGamepadContext(new List <IInputConsumer>(), i);
         var playerZone = PlayersInstances[i].GetComponentInParent <PlayerZoneManager>();
         Destroy(playerZone.gameObject);
         PlayersInstances.Remove(i);
         --GameInfo.PlayerNumber;
     }
 }