Example #1
0
    void Update()
    {
        if (Time.timeScale != 0.0f)
        {
            if (Input.GetKey(KeyCode.Space))
            {
                Time.timeScale = 5.0f;
            }
            else
            {
                Time.timeScale = 1.0f;
            }
        }

        if (m_state != null)
        {
            if (Input.GetKeyDown(KeyCode.Escape))
            {
                m_state.BackButtonPressed();
            }

            m_state.Update();
            return;
        }
    }
Example #2
0
 // Update is called once per frame
 void Update()
 {
     // if I'm the server, regulate gameplay events.
     if (PhotonNetwork.isMasterClient)
     {
         // if a new state has been assigned by the state machine
         // create and init new state, send message to clients to change states
         if (m_NextStateType != m_CurrentState.GetCurrentStateType())
         {
             //Debug.Log("Server says: Changing state!");
             photonView.RPC("SetGameplayState", PhotonTargets.Others, new object[] { (int)m_NextStateType, PhotonNetwork.time });
             SetGameplayState((int)m_NextStateType, PhotonNetwork.time);
         }
     }
     // update correct state
     m_CurrentState.Update();
 }
Example #3
0
    // Update is called once per frame
    void Update()
    {
        if (!mAudioSources[song].isPlaying)
        {
            song = Random.Range(0, 3);
            mAudioSources[song].Play();
        }


        if (mSpawningPlayers)
        {
            mSelectionMenu.Update();
        }
        else if (mGameplay)
        {
            mGameplayState.Update();
        }
        // Keep time.
    }