Exemplo n.º 1
0
    private void CmdClickEnemyCell(Vector2 coords)
    {
        GameManager.eCellState state = GameManager.GetEnemyCellState(playerID, coords);

        int x = (int)coords.x;
        int y = (int)coords.y;

        bool sunken = false;

        if (state == GameManager.eCellState.Water)
        {
            GameManager.PlayerFoundWater(playerID, coords);
            GameManager.NextTurn(playerID);
        }
        else
        {
            GameManager.SinkShip(playerID, coords);
            sunken = GameManager.HasBeenSunk(playerID, x, y);
        }
        RpcClickEnemyCell(x, y, state, sunken);
    }
Exemplo n.º 2
0
    public void RpcUpdateMyGrid(int x, int y, GameManager.eCellState state)
    {
        if (!isLocalPlayer)
        {
            return;
        }

        switch (state)
        {
        case GameManager.eCellState.Water:
            myCells[x, y].GetComponent <Image>().color = colorWater;
            break;

        case GameManager.eCellState.TouchedShip:
            myCells[x, y].GetComponent <Image>().color = colorTouched;
            break;

        case GameManager.eCellState.SunkenShip:
            myCells[x, y].GetComponent <Image>().color = colorSunken;
            break;
        }
    }
Exemplo n.º 3
0
    private void RpcClickEnemyCell(int x, int y, GameManager.eCellState state, bool sunken)
    {
        if (!isLocalPlayer)
        {
            return;
        }

        if (state == GameManager.eCellState.Ship) // Sunken
        {
            if (sunken)
            {
                EnemyShipSunken(x, y);
            }
            else
            {
                EnemyShipTouched(x, y);
            }
        }
        else // Water
        {
            WaterFound(x, y);
            DisableGrid(enemyCells);
        }
    }