// has CardProperty // uses it to get CardVizProperty public void UpdateProperty(CardProperty cp, string newValue) { if (cp == null) { return; } CardVizProperty p = GetProperty(cp.element); p.text.text = newValue; }
public void Damage(int v) { health = health - v; if (health <= 0) { Settings.gameManager.currentPlayer.downCards.Remove(this); Destroy(gameObject); } CardProperty healthProperty = viz.card.GetProperty("Health"); viz.UpdateProperty(healthProperty, health.ToString()); }
public void LoadCard(Card cardToLoad) { if (cardToLoad == null) { return; } cardToLoad.cardViz = this; card = cardToLoad; cardToLoad.cardType.OnSetType(this); CloseAll(); for (int i = 0; i < card.properties.Length; i++) { CardProperty cp = card.properties[i]; //we have an element e.g Attack CardVizProperty p = GetProperty(cp.element); //Find the Attack UI Object if (p == null) { continue; } if (cp.element is ElementInt) { p.text.text = cp.intValue.ToString(); p.text.gameObject.SetActive(true); } else if (cp.element is ElementText) { p.text.text = cp.stringValue; p.text.gameObject.SetActive(true); } else if (cp.element is ElementImage) { p.image.sprite = cp.sprite; p.image.gameObject.SetActive(true); } } }