Exemple #1
0
        public MyPlayerCorpse(Player player, int killerIndex) : base(player, killerIndex)
        {
            // New---
            if (killerIndex != -1)
            {
                MatchTeams teams    = ((MyMatchSettings)player.Level.Session.MatchSettings).Teams;
                int        teamSize = teams.GetAmountOfPlayersOfAllegiance(this.Allegiance);

                Engine.Instance.Commands.Log(killerIndex + " killed " + this.PlayerIndex);
                Engine.Instance.Commands.Log("Killer's Team: " + teams[killerIndex]);
                Engine.Instance.Commands.Log("Player's Team: " + player.Allegiance);

                if ((((MyMatchVariants)player.Level.Session.MatchSettings.Variants).RedRover) &&
                    (teamSize > 1) &&
                    (this.Allegiance != Allegiance.Neutral))
                {
                    this.Allegiance = teams[killerIndex];
                    this.TeamColor  = teams[killerIndex];
                    Engine.Instance.Commands.Log(player.Allegiance + " => " + this.Allegiance);

                    if (player.Level.Session.CurrentLevel.IsPlayerAlive(killerIndex) == false)
                    {
                        Engine.Instance.Commands.Log("Killer is dead.");
                        teams[player.PlayerIndex] = teams[killerIndex];
                    }
                }
            }
        }
Exemple #2
0
 public MatchTeamsState(MatchTeams teams)
 {
     Player1Team = teams.player1Team;
     Player2Team = teams.player2Team;
     Player3Team = teams.player3Team;
     Player4Team = teams.player4Team;
 }
        public Match(GameType gameType, ICollection <Team> teams)
        {
            GameType = gameType;

            if ((gameType == GameType.Singles ||
                 gameType == GameType.Doubles ||
                 gameType == GameType.Ironman) &&
                teams.Count != 2)
            {
                throw new ArgumentOutOfRangeException(
                          nameof(teams), $"Game type {gameType} requires two teams.");
            }

            if (gameType == GameType.Cutthroat && teams.Count != 3)
            {
                throw new ArgumentOutOfRangeException(
                          nameof(teams), "Game type Cutthroat requires three teams.");
            }

            foreach (var team in teams)
            {
                MatchTeams.Add(new MatchTeam(this, team));
            }
        }