Beispiel #1
0
 //call on client
 public void SetFaction(EPlayerFaction newFaction)
 {
     if (_playerCamera != null)
     {
         _playerCamera.SetCursorLocked(true);
     }
     playerFaction = newFaction;
     GameManager.GetInstance().PlayerJoinTeam(this);
 }
Beispiel #2
0
 public void RpcShowWin(bool newState, EPlayerFaction winningFaction)
 {
     if (isLocalPlayer)
     {
         if (playerUI != null)
         {
             playerUI.ShowWin(newState, winningFaction);
         }
     }
 }
Beispiel #3
0
 public void ShowWin(bool newState, EPlayerFaction winningFaction)
 {
     if (newState)
     {
         winningText.gameObject.SetActive(true);
         winningText.text = winningFaction + " Win the Game !";
     }
     else
     {
         winningText.gameObject.SetActive(false);
     }
 }
Beispiel #4
0
    //call on server
    public void SetTeamVictory(EPlayerFaction winningFaction)
    {
        for (int i = 0; i < _allPlayers.Length; i++)
        {
            if (_allPlayers[i] != null)
            {
                _allPlayers[i].RpcShowWin(true, winningFaction);
            }
        }

        if (autoRestart)
        {
            RestartGame();
        }
    }
Beispiel #5
0
 //call on server
 private void CheckPlayerTeam(EPlayerFaction faction)
 {
     if (faction == EPlayerFaction.ALLY)
     {
         if (_allyPlayersAlive == 0)
         {
             //Axis Victory
             SetTeamVictory(EPlayerFaction.AXIS);
         }
     }
     else if (faction == EPlayerFaction.AXIS)
     {
         if (_axisPlayersAlive == 0)
         {
             //Ally Victory
             SetTeamVictory(EPlayerFaction.ALLY);
         }
     }
 }