void SetText() { MainText.text = CurrentDialogue.DialogueText; if (CurrentDialogue.Choice1 == null) { Choice1.GetComponentInChildren <Text> ().text = ""; Choice1.GetComponent <Button> ().interactable = false; } else { Choice1.GetComponentInChildren <Text> ().text = CurrentDialogue.Choice1; } if (CurrentDialogue.Choice2 == null) { Choice2.GetComponent <Button> ().interactable = false; Choice2.GetComponentInChildren <Text> ().text = ""; } else { Choice2.GetComponentInChildren <Text> ().text = CurrentDialogue.Choice2; } }
void PlayerTurn() { CommandText.GetComponent <TextMeshProUGUI>().text = "Choose a command"; int Random1 = Random.Range(0, CM.Cards.Length); Choice1 = Instantiate(CM.Cards[Random1], CardPos1); if (Choice1.CompareTag("Attack")) { Choice1.GetComponent <Button>().onClick.AddListener(Attack); } if (Choice1.CompareTag("Defend")) { Choice1.GetComponent <Button>().onClick.AddListener(Defend); } if (Choice1.CompareTag("Heal")) { Choice1.GetComponent <Button>().onClick.AddListener(Heal); } if (Choice1.CompareTag("Cripple")) { Choice1.GetComponent <Button>().onClick.AddListener(Cripple); } if (Choice1.CompareTag("Poison")) { Choice1.GetComponent <Button>().onClick.AddListener(Poison); } if (Choice1.CompareTag("Lifesteal")) { Choice1.GetComponent <Button>().onClick.AddListener(Lifesteal); } int Random2 = Random.Range(0, CM.Cards.Length); Choice2 = Instantiate(CM.Cards[Random2], CardPos2); if (Choice2.CompareTag("Attack")) { Choice2.GetComponent <Button>().onClick.AddListener(Attack); } if (Choice2.CompareTag("Defend")) { Choice2.GetComponent <Button>().onClick.AddListener(Defend); } if (Choice2.CompareTag("Heal")) { Choice2.GetComponent <Button>().onClick.AddListener(Heal); } if (Choice2.CompareTag("Cripple")) { Choice2.GetComponent <Button>().onClick.AddListener(Cripple); } if (Choice2.CompareTag("Poison")) { Choice2.GetComponent <Button>().onClick.AddListener(Poison); } if (Choice2.CompareTag("Lifesteal")) { Choice2.GetComponent <Button>().onClick.AddListener(Lifesteal); } int Random3 = Random.Range(0, CM.Cards.Length); Choice3 = Instantiate(CM.Cards[Random3], CardPos3); if (Choice3.CompareTag("Attack")) { Choice3.GetComponent <Button>().onClick.AddListener(Attack); } if (Choice3.CompareTag("Defend")) { Choice3.GetComponent <Button>().onClick.AddListener(Defend); } if (Choice3.CompareTag("Heal")) { Choice3.GetComponent <Button>().onClick.AddListener(Heal); } if (Choice3.CompareTag("Cripple")) { Choice3.GetComponent <Button>().onClick.AddListener(Cripple); } if (Choice3.CompareTag("Poison")) { Choice3.GetComponent <Button>().onClick.AddListener(Poison); } if (Choice3.CompareTag("Lifesteal")) { Choice3.GetComponent <Button>().onClick.AddListener(Lifesteal); } if (PlayerIsDefending) { PlayerIsDefending = false; } }