IEnumerator Battle() { StartUserBattleEvent.Invoke(); yield return(null); // EndUserBattleEvent.Invoke -> from UI. EUserGameState userBattleResult = isOver(); if (EUserGameState.Unknown != userBattleResult) { yield break; } StartAIBattleEvent.Invoke(); yield return(null); _ai.Battle(); yield return(null); EndAIBattleEvent.Invoke(); EUserGameState aiBattleResult = isOver(); if (EUserGameState.Unknown != aiBattleResult) { yield break; } --RemainTurn; }
// constructor public CombatMode() { _startEvent = new StartEvent(); _startUserBattleEvent = new StartUserBattleEvent(); _endUserBattleEvent = new EndUserBattleEvent(); _startAIBattleEvent = new StartAIBattleEvent(); _endAIBattleEvent = new EndAIBattleEvent(); _endEvent = new EndEvent(); _turnChangeEvent = new TurnChangeEvent(); _hpChangeEvent = new HpChangeEvent(); _mpChangeEvent = new MpChangeEvent(); _criticalAttackEvent = new CriticalAttackEvent(); _attackEvent = new AttackEvent(); _criticalTrickEvent = new CriticalTrickEvent(); _trickEvent = new TrickEvent(); }