| | |
| | | |
| | | public class BattleManager : GameSystemManager<BattleManager> |
| | | { |
| | | protected Dictionary<int, BattleField> battleFields = new Dictionary<int, BattleField>(); |
| | | public StoryBattleField storyBattleField = new StoryBattleField();//主线战场 |
| | | |
| | | protected Dictionary<int, BattleField> battleFields = new Dictionary<int, BattleField>(); |
| | | |
| | | public override void Init() |
| | | { |
| | | base.Init(); |
| | | EventBroadcast.Instance.AddListener<int, int>(EventName.BATTLE_ACTION_OVER, OnActionOver); |
| | | } |
| | | |
| | | public override void Release() |
| | |
| | | base.Release(); |
| | | } |
| | | |
| | | private void OnActionOver(int battleFieldId, int attackId) |
| | | public void StartStoryBattle() |
| | | { |
| | | BattleField battleField = null; |
| | | if (battleFields.TryGetValue(battleFieldId, out battleField)) |
| | | if (null == storyBattleField) |
| | | { |
| | | battleField.OnActionOver(attackId); |
| | | } |
| | | else |
| | | { |
| | | Debug.LogError("BattleManager OnActionOver battleFieldId:" + battleFieldId + " not find"); |
| | | storyBattleField = new StoryBattleField(); |
| | | |
| | | } |
| | | } |
| | | |
| | | public void Run() |
| | | { |
| | | if (null != storyBattleField) |
| | | { |
| | | storyBattleField.Run(); |
| | | } |
| | | |
| | | foreach (var battleField in battleFields) |
| | | { |
| | | battleField.Value.Run(); |
| | | battleField.Value?.Run(); |
| | | } |
| | | } |
| | | |