예제 #1
0
        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());
        }
예제 #2
0
        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();
            }
        }
예제 #3
0
        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();
        }
예제 #4
0
 void StartGame()
 {
     gameState = ZDGameState.Play;
 }
예제 #5
0
 void OpenGame()
 {
     gameState = ZDGameState.OpenGame;
     StartCoroutine(OpenGameRoutine());
 }