void EndGame(object InData) { gameState = ZDGameState.End; if (audioSource && audioSource.isPlaying) { audioSource.Stop(); } object[] data = (object[])InData; if ((int)PhotonNetwork.LocalPlayer.CustomProperties["Team"] == (int)data[0]) { if (audioSource && EndGameVictoryMusic) { audioSource.PlayOneShot(EndGameVictoryMusic); } Victory.SetActive(true); } else { if (audioSource && EndGameLoseMusic) { audioSource.PlayOneShot(EndGameLoseMusic); } Lose.SetActive(true); } // Go back to start view StartCoroutine(WaitToRestart()); }
void Initialize() { //if (ZDUI.InstanceObject) ZDUI.InstanceObject.SetActive(false); //Fetch Player Props; SetupPlayerProps(); // If Master ,Build Network Scene Objects. if (PhotonNetwork.IsMasterClient) { GenerateStaticMapObjects(); GenerateZone(); } //Create Character CreatePlayerCharacter(); //Tell Everyone I'm Ready To Play Hashtable props = new Hashtable { { CustomPropsKey.PLAYER_LOADED_LEVEL, true } }; PhotonNetwork.LocalPlayer.SetCustomProperties(props); //Set Game State To Wait Player gameState = ZDGameState.WaitPlayer; if (PhotonNetwork.IsMasterClient) { CheckPlayersLoadedLevel(); } }
void Start() { if (Instance && Instance != this) { Destroy(this); } else { Instance = this; } //Initialize Static Values. gameState = ZDGameState.Initialize; playerProps = new PlayerProps(); //Cache Component audioSource = GetComponent <AudioSource>(); //Initialize Game Resources. Initialize(); }
void StartGame() { gameState = ZDGameState.Play; }
void OpenGame() { gameState = ZDGameState.OpenGame; StartCoroutine(OpenGameRoutine()); }