GetFFAStartPoints() public method

returns all free-for-all start points for the given game mode
public GetFFAStartPoints ( GameModes, gameMode ) : IEnumerable
gameMode GameModes,
return IEnumerable
コード例 #1
0
ファイル: SimpleFFAGameMode.cs プロジェクト: hne3/GameProject
    public void MovePlayersToStartPoints(List <IPlayer> players)
    {
        Debug.Log("Moving " + players.Count + " players to their spawn points");
        SpawnPointManager mgr = SpawnPointManager.instance;

        if (mgr == null)
        {
            Debug.LogError("SpawnPointManager.instance was null!");
            return;
        }
        var points = mgr.GetFFAStartPoints(this.Mode).GetEnumerator();

        foreach (IPlayer p in players)
        {
            points.MoveNext();
            if (points.Current == null)
            {
                Debug.LogError("Error; not enough start points for this game mode!");
                points.Reset();
            }
            Debug.Log(points.Current);
            Debug.Log(p);
            Debug.Log("moving " + p.Username + " to " + points.Current.gameObject);
            p.MoveTo(points.Current.gameObject.transform);
        }
        points.Dispose();
    }