Create BattleController#monsterDeck
This commit is contained in:
parent
de072a80f7
commit
28db788635
3 changed files with 22 additions and 4 deletions
|
|
@ -1,5 +1,6 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffectResolver, MonsterViewpoint
|
||||
|
|
@ -7,6 +8,8 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
|
|||
public HeroId[] heroIds;
|
||||
public MonsterId[] monsterIds;
|
||||
public CardId[] cardIds;
|
||||
public MCardId[] mCardIds;
|
||||
public int[] mCardOwnerIndexes;
|
||||
|
||||
public HeroInfoUI heroUIPrefab;
|
||||
public GameObject uiCanvas;
|
||||
|
|
@ -15,6 +18,7 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
|
|||
private HeroCardDatabase heroCardDatabase;
|
||||
private MonsterCardDatabase monsterCardDatabase;
|
||||
private BattleDeck<HeroCard> heroDeck;
|
||||
private BattleDeck<MonsterCard> monsterDeck;
|
||||
private PlayArea playArea;
|
||||
|
||||
public BattleHero[] heroes;
|
||||
|
|
@ -77,7 +81,19 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
|
|||
for (int i = 0; i < this.cardIds.Length; i++) {
|
||||
cardOwners[i] = FindHeroByClass(HeroCardDatabase.GetHeroIdOfCard(this.cardIds[i]));
|
||||
}
|
||||
this.heroDeck = new BattleDeck<HeroCard>(this.heroCardDatabase, this.cardIds, cardOwners);
|
||||
this.heroDeck = new BattleDeck<HeroCard>(
|
||||
this.heroCardDatabase, this.cardIds.Cast<int>().ToArray(), cardOwners);
|
||||
|
||||
BattleParticipant[] mCardOwners = new BattleParticipant[this.mCardIds.Length];
|
||||
if (this.mCardIds.Length != this.mCardOwnerIndexes.Length) {
|
||||
throw new System.ArgumentException(
|
||||
"mCardIds and mCardOwnerIndexes need to have the same length");
|
||||
}
|
||||
for (int i = 0; i < this.mCardIds.Length; i++) {
|
||||
mCardOwners[i] = this.monsters[this.mCardOwnerIndexes[i]];
|
||||
}
|
||||
this.monsterDeck = new BattleDeck<MonsterCard>(
|
||||
this.monsterCardDatabase, this.mCardIds.Cast<int>().ToArray(), mCardOwners);
|
||||
|
||||
this.playArea = new PlayArea();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue