Exemple #1
0
    private IEnumerator doRespawnOrGhost <PlayerController>(int deadPlayerNum, bool isDisconnect) where PlayerController : PlayerController2D
    {
        if (playerLives[deadPlayerNum] <= -1 || isDisconnect)
        {
            totalGhosts++;
            Players[deadPlayerNum].GetComponent <PlayerController>().Ghost();
            //ONLY OUR PLAYER SHOPULD SPECTATE MODE
            if (deadPlayerNum == NetIDs.PlayerNumber(PhotonNetwork.player.ID))
            {
                WaitGUIController.ActivateSpectatingMode();
            }
            yield return(null);
        }
        else
        {
            yield return(respawnWait);

            //Player spawn position is controlled by Game Manager.
            //But we only wanna reposition OUR player's position.
            //BUT ALSO
            Players[deadPlayerNum].GetComponent <PlayerController>().Respawn(
                SpawnPositions[Random.Range(0, SpawnPositions.Length - 1)].position
                );
        }
    }
Exemple #2
0
 // Use this for initialization
 void Start()
 {
     gameHUD      = GameObject.FindGameObjectWithTag("MatchHUD").GetComponent <WaitGUIController>();
     totalPresses = 0;
 }