Exemplo n.º 1
0
    private void OnRestartingMatchByServer(int newNumberOfShips)
    {
        numberOfShips = newNumberOfShips;
        matchTimer    = 0;

        inGame = true;
        DestroyAllObjects();
        resetUsedShipColors      = true;
        resetUsedSpawnPointsList = true;
        readyToSpawnShips        = true;
        shipInfoManager.ClearShipInfoList();

        if (shipsToSpawn.Count > 0)
        {
            for (int i = 0; i < shipsToSpawn.Count; i++)
            {
                SpawnShip(shipsToSpawn[i].shipIndex, shipsToSpawn[i].spawnPointIndex,
                          shipsToSpawn[i].shipColorIndex, shipsToSpawn[i].ownerID);
                shipsToSpawn.RemoveAt(i);
                i--;
            }
            em.BroadcastNetworkMultiplayerMatchInitialized();
            Debug.Log("GameManager: multiplayer match initialization broadcasted");
        }
    }
Exemplo n.º 2
0
 private void OnMatchEnded(int winnerIndex)
 {
     matchStarted = false;
     for (int i = 0; i < currentlyAliveShips.Count; i++)
     {
         Destroy(currentlyAliveShips[i]);
         currentlyAliveShips.RemoveAt(i);
         i--;
     }
     currentlyAliveShips.Clear();
     shipInfoManager.ClearShipInfoList();
 }