Add CrashingPunch and making it work
This commit is contained in:
parent
1c3056778e
commit
d7c19e2572
15 changed files with 204 additions and 27 deletions
|
|
@ -29,11 +29,14 @@ public class BattleController : MonoBehaviour
|
|||
HeroId id = heroIds[i];
|
||||
|
||||
heroes[i] = new BattleHero(id);
|
||||
heroes[i].init();
|
||||
heroes[i].Init();
|
||||
|
||||
heroSprites[i] = HeroDatabase.createHeroSprite(id);
|
||||
heroSprites[i].name = "Hero" + i + "_Sprite";
|
||||
heroSprites[i].transform.position = new Vector3(-6 + 6 * i, 0, 0);
|
||||
BattleParticipantSprite bps = heroSprites[i].AddComponent<BattleParticipantSprite>();
|
||||
BattleParticipant participant = heroes[i];
|
||||
bps.OnSpriteClicked += delegate() {battlePlayerControls.OnParticipantSpriteClicked(participant);};
|
||||
|
||||
heroUIs[i] = (HeroInfoUI) Instantiate(heroUIPrefab.gameObject, uiCanvas.transform).GetComponent(typeof(HeroInfoUI));
|
||||
heroUIs[i].Init(heroSprites[i], heroes[i]);
|
||||
|
|
@ -46,11 +49,14 @@ public class BattleController : MonoBehaviour
|
|||
MonsterId id = monsterIds[i];
|
||||
|
||||
monsters[i] = MonsterDatabase.createMonsterScript(id);
|
||||
monsters[i].init();
|
||||
monsters[i].Init();
|
||||
|
||||
monsterSprites[i] = MonsterDatabase.createMonsterSprite(id);
|
||||
monsterSprites[i].name = "Monster" + i + "_Sprite";
|
||||
monsterSprites[i].transform.position = new Vector3(-6 + 6 * i, 3, 0);
|
||||
BattleParticipantSprite bps = monsterSprites[i].AddComponent<BattleParticipantSprite>();
|
||||
BattleParticipant participant = monsters[i];
|
||||
bps.OnSpriteClicked += delegate() {battlePlayerControls.OnParticipantSpriteClicked(participant);};
|
||||
|
||||
monsterUIs[i] = (HeroInfoUI) Instantiate(heroUIPrefab.gameObject, uiCanvas.transform).GetComponent(typeof(HeroInfoUI));
|
||||
monsterUIs[i].Init(monsterSprites[i], monsters[i]);
|
||||
|
|
@ -68,14 +74,14 @@ public class BattleController : MonoBehaviour
|
|||
|
||||
public void HitRandomParticipant() {
|
||||
if (Random.Range(0f, 1f) < 0.5f) {
|
||||
heroes[Random.Range(0, heroes.Length)].dealDamage(1);
|
||||
heroes[Random.Range(0, heroes.Length)].DealDamage(1);
|
||||
} else {
|
||||
monsters[Random.Range(0, monsters.Length)].dealDamage(2);
|
||||
monsters[Random.Range(0, monsters.Length)].DealDamage(2);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnCardUsed(int index) {
|
||||
Debug.Log("OnCardClicked " + index);
|
||||
HitRandomParticipant();
|
||||
public void OnCardUsed(BaseCard card) {
|
||||
Debug.Log("OnCardClicked " + card);
|
||||
StartCoroutine(card.Use(battlePlayerControls));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue