void OnEndOfParty(bool win) { PlayerDatasScript script = PlayerPrefab.GetComponent <PlayerDatasScript>(); if (win) { VictoryMessage = script.PlayerName + ", you win ! "; Audio.PlayOneShot(AudioWin); } else { VictoryMessage = script.PlayerName + ", you loose ... "; Audio.PlayOneShot(AudioLoose); } ShowMessage = true; PlayingState = false; Invoke("End", 5.0f); }
void Update() { if (networkView.isMine && PlayingState) { PlayerDatasScript playerDataScript = PlayerPrefab.GetComponent <PlayerDatasScript>(); PlayerDatasScript otherPlayerDataScript = GameObject.Find("PlayerTmp(Clone)").GetComponent <PlayerDatasScript>(); // Client if (playerDataScript.Health <= 0 || playerDataScript.NbCollectedFragments >= 5) { if (playerDataScript.Health <= 0) { OnEndOfParty(false); } if (playerDataScript.NbCollectedFragments >= 5) { OnEndOfParty(true); } } // Other Client if (otherPlayerDataScript.Health <= 0 || otherPlayerDataScript.NbCollectedFragments >= 5) { if (otherPlayerDataScript.Health <= 0) { OnEndOfParty(true); } if (otherPlayerDataScript.NbCollectedFragments >= 5) { OnEndOfParty(false); } } } }
void FlyingTrisRun() { PlayerPrefab.GetComponent <FXFlyingTrianglesScript>().Fly(); }