private void CreateNonMonobehaviours() { units = new Units(); simulator = new BattleSimulator(); rule = new BattleRuleLastTeam(); statistics = new BattleStatistics(); saveLoad = new BattleSaveLoad(); }
public Battle(IBattleRule rule, IBattleWorld world) { this.Rule = rule; this.World = world; this.heroMap = new Dictionary <int, IHeroFSM>(); this.State = new DataDrive_Service(); for (int i = 0; i < 10; i++) { heroMap[i] = null; } // State.RegisterData("OnNewRound"); //回合 State.RegisterData("OnCanOperation"); //可以操作的下标 State.RegisterData("OnBattleEnd"); //战斗结束 //每一个新回合 State.RegAction("OnNewRound", o => { OnNewRound(); }); }
/// <summary> /// 创建战场 /// </summary> /// <param name="ruleId"></param> /// <param name="battleWorldId"></param> /// <returns></returns> static public Int64 CreateBattle(int ruleId = 0, int battleWorldId = -1) { //判断是否越界 if (counter >= 1 << 63 - 1) { counter = 0; } counter++; IBattleRule rule = null; if (ruleId == 0) { rule = new BattleRule_TBS(); } var world = new BattleWorld(battleWorldId); var battle = new global::Game.Battle.Battle(rule, world); // battleMap[counter] = battle; battle.Init(); return(counter); }