// 배틀 시작 이벤트가 오면 init하고 자기 자신 업데이트에 넣기 // 몬스터가 죽는 이벤트가 오면 카운트 증가시키고 죽은 몬스터가 현재 스테이지의 몬스터 수가 되면 배틀 종료 이벤트 발행 public bool OnEvent(IEvent e) { Type eventType = e.GetType(); if (eventType == typeof(BattleStageStartEvent)) { BattleStageStartEvent battleStateStartEvent = e as BattleStageStartEvent; Init(battleStateStartEvent.Stage); GameManager.Instance.AddUpdate(this); return(true); } else if (eventType == typeof(MonsterDeadEvent)) { MonsterDeadEvent monsterDeadEvent = e as MonsterDeadEvent; stageMonsterList.Remove(monsterDeadEvent.DeadUnit); deadMonsterCount++; if (deadMonsterCount >= currentStageMonsterCount) { if (GameManager.Instance.Stage + 1 >= stageGroupData.StageDataGroup.Count) { CoroutineHandler.Start_Coroutine(Ending()); } else { CoroutineHandler.Start_Coroutine(EndBattleStage()); } } return(true); } return(false); }
public void OpeningStart() { uiCanvas.SetActive(true); uiCanvas = null; MessageSystem.Publish(BattleStageStartEvent.Create(Stage)); Stage++; }
public static BattleStageStartEvent Create(int stage) { BattleStageStartEvent e = new BattleStageStartEvent(); e.Stage = stage; return(e); }
public void StartBattleStage() { string theme = "Desert"; if (Stage == 1) { theme = "Ice"; TileManager.Instance.CreateTileMap((TileTheme)1, 12, 3); } else if (Stage == 2) { TileManager.Instance.CreateTileMap((TileTheme)2, 9, 5); } else { int map = UnityEngine.Random.Range(0, 3); int x = UnityEngine.Random.Range(8, 13); int z = UnityEngine.Random.Range(3, 6); TileManager.Instance.CreateTileMap((TileTheme)map, x, z); switch (map) { case 0: theme = "Forest"; break; case 1: theme = "Ice"; break; default: break; } } SoundManager.Instance.PlayBGM(theme, 0.2f); Camera camera = Camera.main; camera.transform.position = new Vector3(4, 5.2f, -2.1f); ParticleSystem dust = GameManager.Instance.EffectSystem.CreateEffect(theme + "Dust", camera.transform.position + new Vector3(0, -1.5f, 2), new Vector3(0.5f, 0.5f, 0.5f), Quaternion.Euler(new Vector3(-90, 0, 0))); dust.transform.SetParent(camera.transform); MessageSystem.Publish(BattleStageStartEvent.Create(Stage)); Stage++; }
// 게임 시작되면 현재 덱으로 게임 플레이 public bool OnEvent(IEvent e) { Type eventType = e.GetType(); if (eventType == typeof(BattleStageStartEvent)) { BattleStageStartEvent battleStateStartEvent = e as BattleStageStartEvent; Init(); GameManager.Instance.AddUpdate(this); return(true); } else if (eventType == typeof(BattleStageEndEvent)) { for (int i = 0; i < CurrentHand.Count; i++) { CurrentHand[i].Dispose(); i--; } CurrentHand.Clear(); return(true); } return(false); }