public static void HeroDead(Hero hero) { hero.StopMoving(); EventDispather.DispatchEvent(new GameEvent(EventName.UI_SHOW_SINGLE, "GameOverUI")); }
public static void Update() { switch (state) { case BattleState.STATE_LOADING: state = BattleState.STATE_BUILDING; break; case BattleState.STATE_BUILDING: battle.SetExitPoint(false); battle.SetEnterPoint(true); Clear(); Build(); break; case BattleState.STATE_START_ANIMATION: int groundId = (int)copyConfig.maps[groundIndex]; JsonData groundConfig = Config.GetInstance().GetGroundConfig(groundId); if (hero == null) { AddHero(groundConfig); } else { hero.SetStartPosition((int)groundConfig["start_x"], (int)groundConfig["start_y"]); } hero.currentDirection = MoveDirection.UP; Follower f = hero.follower; while (f != null) { f.ResetPostion(); f.SetDirection(hero.currentDirection); f.SetPosition(hero.transform.localPosition); f.gameObject.SetActive(true); f.SetNextPosition(hero.transform.localPosition); f = f.follower; } hero.audio.clip = null; hero.gameObject.SetActive(true); hero.StopAnimation(); hero.StopMoving(); hero.Invoke("PlayMoving", 2); hero.Invoke("PlayAnimation", 2); battle.Invoke("HideEnterPoint", 1); state = BattleState.STATE_BATTLING; break; case BattleState.STATE_BATTLING: if ((int)timeLine < (int)(timeLine + Time.deltaTime)) { CheckTimePoint(); } timeLine += Time.deltaTime; SkillManager.Update(); break; case BattleState.STATE_WIN: groundIndex++; if (groundIndex >= copyConfig.maps.Count) { hero.StopMoving(); EventDispather.DispatchEvent(new GameEvent(EventName.UI_SHOW_SINGLE, "WinUI")); } else { state = BattleState.STATE_TO_NEXT; battle.SetExitPoint(true); } break; case BattleState.STATE_END_ANIMATION: state = BattleState.STATE_BUILDING; break; case BattleState.STATE_TO_NEXT: HeroAutoMove(); break; case BattleState.STATE_LOSE: break; } }