コード例 #1
0
        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>());
        }
コード例 #2
0
 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!");
     }
 }
コード例 #3
0
 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!");
     }
 }
コード例 #4
0
 public void UpdateText(EncounterCardType type)
 {
     GetComponent <Text>().text = type.Title;
 }
コード例 #5
0
 public void UpdateText(EncounterCardType type)
 {
     GetComponent <Text>().text = type.GetBoonText();
 }