示例#1
0
    [Command] public void CmdSetGridPosition(int x, int y)
    {
        if (avatarSpawn && avatarSpawn.lockedIn)
        {
            return;
        }

        gameGrid.SetPlayerToPosition(this.gameObject, x, y);
    }
示例#2
0
文件: DC_Game.cs 项目: benotter/DigiC
    [Server] public void AddPlayer(GameObject playerO)
    {
        if (!gameGrid)
        {
            preStartPlayers.Add(playerO);
            return;
        }

        DC_Player player = playerO.GetComponent <DC_Player>();

        player.RpcGameSetup(gameObject);

        if (player.connectionToClient.address == "localClient")
        {
            gameOwnerPlayerObj = player.gameObject;
        }

        // Whhooooh, Lad.
        bool breaker = false;

        for (int x = 1; x <= 3; x++)
        {
            for (int y = 1; y <= 3; y++)
            {
                if (gameGrid.CheckPosition(x, y))
                {
                    breaker = gameGrid.SetPlayerToPosition(player.gameObject, x, y);
                }
                else
                {
                    Debug.Log("Bad X pos: " + x);
                    Debug.Log("Bad Y pos: " + y);
                }

                if (breaker)
                {
                    break;
                }
            }
            if (breaker)
            {
                break;
            }
        }


        gamePlayerCount++;
        RpcPlayerJoined(player.gameObject);

        gameGrid.UpdateAllClients();
    }