using System.Collections.Generic;
|
using UnityEngine;
|
|
|
|
public class BattleManager : GameSystemManager<BattleManager>
|
{
|
public StoryBattleField storyBattleField = null;
|
|
protected Dictionary<int, BattleField> battleFields = new Dictionary<int, BattleField>();
|
|
protected LogicUpdate logicUpdate = new LogicUpdate();
|
|
public override void Init()
|
{
|
base.Init();
|
StartStoryBattle();
|
logicUpdate.Start(Run);
|
}
|
|
public override void Release()
|
{
|
Debug.LogError("who release this one");
|
base.Release();
|
logicUpdate.Destroy();
|
}
|
|
public void StartStoryBattle()
|
{
|
if (null == storyBattleField)
|
{
|
storyBattleField = new StoryBattleField();
|
|
TeamBase redTeam = GetStoryTeam();//TeamManager.Instance.GetTeam(TeamType.Story);
|
TeamBase blueTeam = GetStoryTeam();
|
storyBattleField.Init(/*这里要加个创建背景的*/redTeam, blueTeam);
|
// storyBattleField.Start();
|
storyBattleField.battleRootNode.transform.SetParent(Launch.Instance.transform);
|
}
|
}
|
|
private TeamBase GetStoryTeam()
|
{
|
TeamBase teamBase = new TeamBase();
|
#if UNITY_EDITOR
|
teamBase.FillWithFakeData();
|
#else
|
// YYL TODO
|
// 根据配表塞英雄 后面可能还要塞其他东西 先放在这里反正 做主线了再转移
|
#endif
|
|
return teamBase;
|
}
|
|
public void Run()
|
{
|
if (null != storyBattleField)
|
{
|
storyBattleField.Run();
|
}
|
|
foreach (var battleField in battleFields)
|
{
|
battleField.Value?.Run();
|
}
|
}
|
|
}
|