private OwnedEncounterCard InstantiateCard(EncounterCardType type) { GameObject prefab = SelectPrefab(type); var instance = Instantiate(prefab); var encounterCard = instance.GetComponent <EncounterCard>(); encounterCard.Type = type; encounterCard.UpdateText(); return(instance.AddComponent <OwnedEncounterCard>()); }
public void UpdateText(EncounterCardType type) { if (type is WorldCardType) { GetComponent <Text>().text = (type as WorldCardType).Attack.ToString(); } else { throw new Exception("AttackEncounterCardText is not compatible with non-world card type!"); } }
private GameObject SelectPrefab(EncounterCardType type) { if (type is WorldCardType) { return(worldCardPrefab); } else if (type is EnemyCardType) { return(enemyCardPrefab); } else { throw new Exception("There is no prefab for this card type!"); } }
public void UpdateText(EncounterCardType type) { GetComponent <Text>().text = type.Title; }
public void UpdateText(EncounterCardType type) { GetComponent <Text>().text = type.GetBoonText(); }