public void StartBattle() { battleContext = GameManager.Instance.battleContext; stateMachine = new StateMachine <BattleState, BattleContext>(CreateBattleStates()); if (battleContext == null) { UnitEntity[] playerUnits = new UnitEntity[] { new UnitEntity(new UnitData(ResourcesManager.GetUnitData("f_arch_angle"))), new UnitEntity(new UnitData(ResourcesManager.GetUnitData("f_arch_angle"))), new UnitEntity(new UnitData(ResourcesManager.GetUnitData("f_assasin"))) }; BannerUnit playerBannerUnit = new BannerUnit(new UnitData(ResourcesManager.GetUnitData("f_arch_angle"))); UnitEntity[] enemyUnits = new UnitEntity[] { //new UnitEntity(new UnitData(ResourcesManager.GetUnitData("f_arch_angle"))), new UnitEntity(new UnitData(ResourcesManager.GetUnitData("f_assasin"))), new UnitEntity(new UnitData(ResourcesManager.GetUnitData("m_assasin"))) }; BannerUnit enemyBannerUnit = new BannerUnit(new UnitData(ResourcesManager.GetUnitData("f_arch_angle"))); Party pParty = null; Party eParty = null; pParty = new Party(playerUnits, playerBannerUnit, TeamSide.Player, eParty); eParty = new Party(enemyUnits, enemyBannerUnit, TeamSide.Enemy, pParty); battleContext = new BattleContext(this, pParty, eParty); } playerParty.Setup(battleContext.playerParty); enemyParty.Setup(battleContext.enemyParty); BattleUI.Instance.InitCharacters(battleContext.playerParty.members, battleContext.playerParty.bannerUnit); stateMachine.Change(BattleState.Start, battleContext); }
public void InitCharacters(UnitEntity[] units, BannerUnit bannerUnit) { for (int i = 0; i < units.Length; i++) { characterDisplays[i].Init(units[i]); } banner.Init(bannerUnit); }
public Party(UnitEntity[] mainUnit, BannerUnit bannerUnit, TeamSide team, Party enemyParty) { this.members = mainUnit; for (int i = 0; i < mainUnit.Length; i++) { mainUnit[i].SetPartyId(this, team + i.ToString(), team == TeamSide.Player); } this.bannerUnit = bannerUnit; bannerUnit.SetPartyId(this, team + "banner", team == TeamSide.Player); this.team = team; this.enemyParty = enemyParty; }