Пример #1
0
    private void SetCardInfo(HeroCardSO heroCard)
    {
        nameCard.text     = heroCard.name;
        lvl.text          = heroCard.level.ToString();
        description.text  = heroCard.description;
        defenceValue.text = (heroCard.GetDefenceFactor() * 100).ToString();
        attackValue.text  = Mathf.RoundToInt(heroCard.GetAttackFactor() * 150).ToString();
        attackMode.text   = heroCard.attackType.ToString();
        kingdom.text      = "Королевство: " + heroCard.heroRace;
        switch (heroCard.warriorGrade)
        {
        case HeroCardSO.XColor.grey:
            grade.text  = "x1";
            grade.color = Color.gray;
            break;

        case HeroCardSO.XColor.green:
            grade.text  = "x2";
            grade.color = Color.green;
            break;

        case HeroCardSO.XColor.blue:
            grade.text  = "x3";
            grade.color = Color.blue;
            break;
        }
    }
Пример #2
0
 public void ViewFromInventory(HeroCardSO heroCard)
 {
     if (!gameObject.activeInHierarchy)
     {
         gameObject.SetActive(true);
     }
     SetBorderColor(heroCard);
     SetCardInfo(heroCard);
     if (addButton.activeInHierarchy)
     {
         addButton.SetActive(false);
     }
 }
Пример #3
0
 public void StartButton()
 {
     if (!gameObject.activeInHierarchy)
     {
         gameObject.SetActive(true);
     }
     hero = heroCard[Random.Range(0, 4)];
     SetBorderColor(hero);
     SetCardInfo(hero);
     if (!addButton.activeInHierarchy)
     {
         addButton.SetActive(true);
     }
 }
Пример #4
0
    private void SetBorderColor(HeroCardSO heroCard)
    {
        switch (heroCard.warriorGrade)
        {
        case HeroCardSO.XColor.grey:
            border.GetComponent <Image>().color = Color.gray;
            break;

        case HeroCardSO.XColor.green:
            border.GetComponent <Image>().color = Color.green;
            break;

        case HeroCardSO.XColor.blue:
            border.GetComponent <Image>().color = Color.blue;
            break;
        }
    }
Пример #5
0
    public void Notify(object sender, HeroCardSO heroData)
    {
        if (inventorySize <= inventoryMaxSize)
        {
            heroesList.Add(heroData);
            inventorySize++;
        }
        else
        {
            return;
        }

        GameObject heroIcon = Instantiate(heroIconPrefab) as GameObject;

        heroIcon.transform.SetParent(parent, false);
        heroIcon.GetComponentInChildren <TextMeshProUGUI>().text = heroData.name;
        switch (heroData.warriorGrade)
        {
        case HeroCardSO.XColor.grey:
            heroIcon.GetComponent <Image>().color = Color.grey;
            heroIcon.transform.GetChild(1).GetComponentInChildren <TextMeshProUGUI>().text  = "x1";
            heroIcon.transform.GetChild(1).GetComponentInChildren <TextMeshProUGUI>().color = Color.grey;
            break;

        case HeroCardSO.XColor.green:
            heroIcon.GetComponent <Image>().color = Color.green;
            heroIcon.transform.GetChild(1).GetComponentInChildren <TextMeshProUGUI>().text  = "x2";
            heroIcon.transform.GetChild(1).GetComponentInChildren <TextMeshProUGUI>().color = Color.green;
            break;

        case HeroCardSO.XColor.blue:
            heroIcon.GetComponent <Image>().color = Color.blue;
            heroIcon.transform.GetChild(1).GetComponentInChildren <TextMeshProUGUI>().text  = "x3";
            heroIcon.transform.GetChild(1).GetComponentInChildren <TextMeshProUGUI>().color = Color.blue;
            break;
        }
        heroIcon.GetComponent <HeroDataPrefab>().SetHeroData(heroData);
    }
Пример #6
0
 public void SetHeroData(HeroCardSO hero)
 {
     heroData = hero;
 }