示例#1
0
    public PlayerSimplifiedTurnData PopPlayerData(int playerId)
    {
        int        color;
        Vector2Int finalPosition;

        ClientController.PlayerState finalState;

        if (playerRolesToGive.Count > 0)
        {
            // Setup
            finalState    = playerRolesToGive.PopValue();
            finalPosition = _boardManager.GetSpawnPointTileData(finalState).tilePosition;

            PlayerTurnData data = new PlayerTurnData(
                new PutPlayRequestData(playerId, finalPosition.x, finalPosition.y, finalPosition.x, finalPosition.y, false),
                finalState
                );

            playerTurnDict.Add(playerId, data);

            color = data.IntUIColor;
        }
        else
        {
            PlayerTurnData data;
            playerTurnDict.TryGetValue(playerId, out data);

            color         = data.IntUIColor;
            finalPosition = data.lastPlay.movementTo;
            finalState    = data.role;

            switch (finalState)
            {
            case ClientController.PlayerState.Died:
                playerTurnDict.Remove(playerId);
                break;

            case ClientController.PlayerState.Escaped:
                playerTurnDict.Remove(playerId);
                break;

            case ClientController.PlayerState.AlienOverrun:
                playerTurnDict.Remove(playerId);
                break;
            }
        }

        return(new PlayerSimplifiedTurnData
        {
            playerColor = color,
            position = finalPosition,
            state = finalState
        });
    }
示例#2
0
        void Main()
        {
            Debug.Log("Hello World!");

            List <int> iGive = new List <int> {
                0, 0, 0, 0
            };
            List <int> iTake = new List <int> {
                0, 0, 0, 0
            };

            var testMove = new Move(-2, -1, iGive, iTake);

            Debug.Log(new Move(testMove.ToString()));

            var move1 = new Move(-1, -2, new List <int>()
            {
                0, 0
            }, new List <int>()
            {
                0, 0
            });
            var move2 = new Move(-1, 1, new List <int>()
            {
                0, 0
            }, new List <int>()
            {
                0, 0
            });
            var move3 = new Move(3, -1, new List <int>()
            {
                0, 0
            }, new List <int>()
            {
                0, 0
            });

            var testPlayerTurn = new PlayerTurnData(1, new List <Move>()
            {
                move1, move2, move3
            });

            Debug.Log(testPlayerTurn);

            Debug.Log(new PlayerTurnData(testPlayerTurn.ToString()));
        }