Esempio n. 1
0
        public Controller(PlayerCharacter _playerCharacter)
        {
            rotation = 0;
            wantsToBalance = 0;
            jump = false;
            isLoadingJump = false;

            character = _playerCharacter;
        }
Esempio n. 2
0
 public PlayerController(PlayerCharacter _character, uint _controllerIndex)
     : base(_character)
 {
     controllerIndex = _controllerIndex;
 }
Esempio n. 3
0
        private void ResetPlayers()
        {
            PlayerCharacter.playerCount = 0;

            resetCounter = 0;

            if (playerChars == null) { playerChars = new List<PlayerCharacter>(); }
            else { playerChars.Clear(); }
            if (controllers == null) { controllers = new List<Controller>(); }
            else { controllers.Clear(); }

            if (dekoHands == null) { dekoHands = new List<DekoElements.RemoteControllHand>(); }
            else { dekoHands.Clear(); }

            // find a controller for the Players
            foreach (uint i in GamePadInputManager.connectedPadIndices)
            {
                PlayerCharacter player = new PlayerCharacter(physicsWorld, startPostitions[playerChars.Count]);
                PlayerController playerController = new PlayerController(player, i);

                dekoHands.Add(new DekoElements.RemoteControllHand(playerController));

                playerChars.Add(player);
                controllers.Add(playerController);

                if (playerChars.Count == numPlayers)
                    break;
            }

            // if there are more Players than GamePads, give them invalid indices, so they will use Keyboard-Input
            // Cord: nullable would be better code, I guess...
            while (playerChars.Count < numPlayers)
            {
                PlayerCharacter player = new PlayerCharacter(physicsWorld, startPostitions[playerChars.Count]);
                PlayerController playerController = new PlayerController(player, uint.MaxValue);
                dekoHands.Add(new DekoElements.RemoteControllHand(playerController));

                playerChars.Add(player);
                controllers.Add(playerController);
            }
        }