Exemplo n.º 1
0
 private void ProcessGameEnd(GameEvents.GameEnded e)
 {
     if (e.win)
     {
         // TODO add win efx on scene and go to next scene after it
         var manager = ServiceLocator.Get <SceneListManager>();
         if (!manager)
         {
             Debug.LogWarning("[GameEndManager][OnGameEnded] can`t find SceneListManager");
             return;
         }
         manager.LoadNextScene();
     }
     else
     {
         // TODO view lose show and restart scene
         var manager = ServiceLocator.Get <UnityPrototype.RestartManager>();
         if (!manager)
         {
             Debug.LogWarning("[GameEndManager][OnGameEnded] can`t find RestartManager");
             return;
         }
         manager.RestartScene();
     }
 }
Exemplo n.º 2
0
 void OnGameEnded(GameEvents.GameEnded e)
 {
     m_anim.Play(m_animNameDisappear);
     if (!e.win && !hitFace)
     {
         hitFace = true;
         var efx = Instantiate(m_hitFaceEfxPrefab, transform.parent);
         efx.transform.localPosition = Vector3.zero;
         efx.transform.localScale    = Vector3.one;
         efx.transform.localRotation = Quaternion.identity;
     }
     // StartCoroutine("OnCompleteDisappearAnimation");
 }
Exemplo n.º 3
0
    void OnGameEnded(GameEvents.GameEnded e)
    {
        if (gameEnded)
        {
            return;
        }

        gameEnded = true;

        if (e.win)
        {
            EventBus.Instance.Raise(new SoundEvents.SoundEvent {
                type = SoundEvents.SoundType.LevelCompleted
            });
        }
        else
        {
            EventBus.Instance.Raise(new SoundEvents.SoundEvent {
                type = SoundEvents.SoundType.LevelFailed
            });
        }

        StartCoroutine(ProcessGameEndDelayed(e));
    }
Exemplo n.º 4
0
    private IEnumerator ProcessGameEndDelayed(GameEvents.GameEnded e)
    {
        yield return(new WaitForSeconds(m_nextSceneDelay));

        ProcessGameEnd(e);
    }