Create cards and make them buttons

This commit is contained in:
henriquenakashima 2020-09-18 00:23:38 -04:00
parent 581d9d7811
commit 6b0200f518
7 changed files with 643 additions and 0 deletions

View file

@ -9,6 +9,7 @@ public class BattleController : MonoBehaviour
public HeroInfoUI heroUIPrefab;
public GameObject uiCanvas;
public BattlePlayerControls battlePlayerControls;
public BattleHero[] heroes;
private GameObject[] heroSprites;
@ -54,6 +55,9 @@ public class BattleController : MonoBehaviour
monsterUIs[i] = (HeroInfoUI) Instantiate(heroUIPrefab.gameObject, uiCanvas.transform).GetComponent(typeof(HeroInfoUI));
monsterUIs[i].Init(monsterSprites[i], monsters[i]);
}
this.battlePlayerControls.OnCardUsed += this.OnCardUsed;
this.battlePlayerControls.SetHand(5);
}
// Update is called once per frame
@ -69,4 +73,9 @@ public class BattleController : MonoBehaviour
monsters[Random.Range(0, monsters.Length)].dealDamage(2);
}
}
public void OnCardUsed(int index) {
Debug.Log("OnCardClicked " + index);
HitRandomParticipant();
}
}