using System.Collections.Generic;
|
using UnityEngine;
|
|
|
|
public class BattleManager : GameSystemManager<BattleManager>
|
{
|
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)
|
{
|
BattleField battleField = null;
|
if (battleFields.TryGetValue(battleFieldId, out battleField))
|
{
|
battleField.OnActionOver(attackId);
|
}
|
else
|
{
|
Debug.LogError("BattleManager OnActionOver battleFieldId:" + battleFieldId + " not find");
|
}
|
}
|
|
public void Run()
|
{
|
foreach (var battleField in battleFields)
|
{
|
battleField.Value.Run();
|
}
|
}
|
|
}
|