Esempio n. 1
0
    public override void Enter(AState from)
    {
        if(from && from.GetName() == "Pause")
        {
            PauseBtnSetActive(true);
        }
        else
        {
            InitBgMusic();
            bgm.PlayAudio(gameMusic);

            InstantiateHero();
            score.Reset();

            SetupPlatformSpawnManager();

            //init camera follow
            SetCameraFollow(heroInstance.transform);

            CloudManager.spawnClouds = true;
            Debug.Log(string.Format("enter gameplay from {0}", from.GetName()));
        }

        //common actions
        Time.timeScale = gameSpeed;
        InGameUI.SetActive(true);
    }
Esempio n. 2
0
 public override void Exit(AState to)
 {
     if (to && to.GetName() == "Pause")
     {
         Time.timeScale = 0f;
     }
     else
     {
         InGameUI.SetActive(false);
         RemoveHero();
     }
     //gameOverText.gameObject.SetActive(false);
 }
Esempio n. 3
0
 public void InstanceState(string stateName)
 {
     _activeState = FindState(stateName);
     _activeState.Enter();
     Debug.Log("Init state " + _activeState.GetName());
 }