Пример #1
0
 internal void RemoveCharacterTarget(CharacterController character)
 {
     this.characters.Remove(character);
 }
Пример #2
0
        private void OnPlayerDeath(CharacterController characterController, bool behindScreen)
        {
            Screen.soundController.PlaySound("Game/death");
            Vector2 pos = characterController.model.position;
            int playerIndex = characterController.model.playerIndex;

            int gotKilled = characterController.model.playerIndex;

            int killer;
            if (players[gotKilled].GotKilled(out killer))
            {
                //Removes powerup from player
                powerUps.RemovePowerUp(gotKilled);
                //Updates killer
                players[killer].Killed(gotKilled);
                characterController.Reset(map.CurrentMap.startingPosition[resetPos], behindScreen);
                if (resetPos == 3) resetPos = 0;
                else resetPos++;
            }
            else
            {
                camera.RemoveCharacterTarget(characterController);
                RemoveController(characterController);
            }
        }
Пример #3
0
 internal void AddCharacterTarget(CharacterController character)
 {
     this.characters.Add(character);
 }
Пример #4
0
        private void createCharacters(ContentManager content)
        {
            //Loops through the gamepads to check which controllers that has selected characters
            //And crates CharacterCOntrooles for them
            int i = 0;
            foreach (var pad in GamePadControllers)
            {
                if (pad.PlayerModel.SelectedCharacter != null)
                {
                    var character = new CharacterController(Screen, pad, map.CurrentMap.startingPosition[i], countDownTime);
                    //Add HitHappens listener
                    character.OnHit += OnPlayerHit;
                    // Add Playerdeath listener.
                    character.OnCharacterDeath += OnPlayerDeath;
                    //Adds the controller
                    AddController(character);

                    characterControllers.Add(character);
                    camera.AddCharacterTarget(character);

                    players.Add(pad.PlayerIndex, new PlayerStatsController(Screen, character.model, Screen.GameOptions));
                    AddController(players.Last().Value);

                    pad.OnStartPress += OnStartPress;
                    i++;
                }

            }
        }