Пример #1
0
    public void StartMatch(Match match)
    {
        if (match == null)
        {
            throw new ArgumentException("match");
        }
        if (match.PlayerCount > SupportedPlayerCount)
        {
            throw new InvalidOperationException("Cannot start a match when there are more players participating than supported by the selected stage");
        }

        int playerCount = Mathf.Min(match.PlayerCount, SupportedPlayerCount);

        for (var i = 0; i < playerCount; i++)
        {
            Character       spawnedCharacter = match.SpawnCharacter(i, playerData[i].Spawn.position);
            PlayerIndicator indicator        = GameSettings.CreatePlayerIndicator(i);
            indicator.Attach(spawnedCharacter);
        }
    }