Exemplo n.º 1
0
        private void SwapCards()
        {
            if (activeCard.Equals(loadingCard))
            {
                randomCard.gameObject.SetActive(true);
                loadingCard.gameObject.SetActive(false);
                activeCard = randomCard;

                Card nextCard = allCards[Random.Range(0, allCards.Count)];

                cardName.text    = nextCard.Name;
                type.text        = nextCard.Type.ToString();
                damage.text      = nextCard.Action.Damage.ToString();
                range.text       = nextCard.Action.Range.ToString();
                description.text = nextCard.Description;

                image.sprite   = nextCard.Image;
                cardBase.color = CustomColor.ColorFromElement(nextCard.Element);
            }
            else
            {
                randomCard.gameObject.SetActive(false);
                loadingCard.gameObject.SetActive(true);
                activeCard = loadingCard;
            }
            counter = 0;
            activeCard.eulerAngles = new Vector3(0, -START_Y_ROT, 0);
        }
Exemplo n.º 2
0
 private void Show()
 {
     canvas.enabled = true;
     for (int i = 0; i < MAX_HAND; i++)
     {
         if (i < player.Hand.PlayerHand.Count)
         {
             cards[i] = player.Hand.PlayerHand[i].Name;
             hand[i].transform.GetChild(CHILD_IMAGE_INDEX).GetComponent <Image>().color  = Color.white;
             hand[i].transform.GetChild(CHILD_IMAGE_INDEX).GetComponent <Image>().sprite = player.Hand.PlayerHand[i].Image;
             hand[i].color = CustomColor.ColorFromElement(player.Hand.PlayerHand[i].Element);
         }
         else
         {
             cards[i] = "";
         }
     }
     currentCardName.text = cards[0] == null ?  "None" : cards[0];
 }
Exemplo n.º 3
0
 public void UpdateDisplayData()
 {
     for (int i = 0; i < NUM_SELECTIONS; i++)
     {
         if (selectionOptions != null && i < selectionOptions.Count)
         {
             selectionButtons[i].transform.GetChild(ELEMENT_INDEX).GetComponent <Image>().color      = CustomColor.ColorFromElement(selectionOptions[i].Element);
             selectionButtons[i].transform.GetChild(CHILD_IMAGE_INDEX).GetComponent <Image>().color  = Color.white;
             selectionButtons[i].transform.GetChild(CHILD_IMAGE_INDEX).GetComponent <Image>().sprite = selectionOptions[i].Image;
             selectionButtons[i].interactable = true;
         }
         else
         {
             selectionButtons[i].transform.GetChild(ELEMENT_INDEX).GetComponent <Image>().color      = CustomColor.ColorFromElement(Enums.Element.None);
             selectionButtons[i].transform.GetChild(CHILD_IMAGE_INDEX).GetComponent <Image>().color  = Color.black;
             selectionButtons[i].transform.GetChild(CHILD_IMAGE_INDEX).GetComponent <Image>().sprite = null;
             selectionButtons[i].interactable = false;
         }
     }
     if (selectionOptions != null)
     {
         displayingImage.sprite     = selectionOptions[0].Image;
         displayingName.text        = selectionOptions[0].Name;
         displayingDamage.text      = selectionOptions[0].Action.Damage.ToString();
         displayingRange.text       = selectionOptions[0].Action.Range.ToString();
         displayingType.text        = selectionOptions[0].Type.ToString();
         displayingDescription.text = selectionOptions[0].Description;
     }
     else
     {
         displayingImage.sprite     = null;
         displayingName.text        = "None";
         displayingDamage.text      = "0";
         displayingRange.text       = "0";
         displayingType.text        = "None";
         displayingDescription.text = "No more cards in deck.";
     }
 }
Exemplo n.º 4
0
 public void UpdateFinalDisplayData()
 {
     for (int i = 0; i < MAX_SELECTIONS; i++)
     {
         if (i < finalMap.Count)
         {
             finalButtons[i].transform.GetChild(ELEMENT_INDEX).GetComponent <Image>().color      = CustomColor.ColorFromElement(selectionOptions[finalMap[i]].Element);
             finalButtons[i].transform.GetChild(CHILD_IMAGE_INDEX).GetComponent <Image>().sprite = selectionOptions[finalMap[i]].Image;
             finalButtons[i].interactable = true;
         }
         else
         {
             finalButtons[i].transform.GetChild(ELEMENT_INDEX).GetComponent <Image>().color      = CustomColor.ColorFromElement(Enums.Element.None);
             finalButtons[i].transform.GetChild(CHILD_IMAGE_INDEX).GetComponent <Image>().sprite = null;
             finalButtons[i].interactable = false;
         }
     }
 }
 public void UpdateDisplayData()
 {
     for (int i = 0; i < NUM_SELECTIONS; i++)
     {
         if (selectionOptions != null && i < selectionOptions.Count)
         {
             selectionButtons[i].transform.GetChild(ELEMENT_INDEX).GetComponent <Image>().color      = CustomColor.ColorFromElement(selectionOptions[i].Element);
             selectionButtons[i].transform.GetChild(CHILD_IMAGE_INDEX).GetComponent <Image>().color  = Color.white;
             selectionButtons[i].transform.GetChild(CHILD_IMAGE_INDEX).GetComponent <Image>().sprite = selectionOptions[i].Image;
         }
         else
         {
             selectionButtons[i].transform.GetChild(ELEMENT_INDEX).GetComponent <Image>().color      = CustomColor.ColorFromElement(Enums.Element.None);
             selectionButtons[i].transform.GetChild(CHILD_IMAGE_INDEX).GetComponent <Image>().color  = Color.black;
             selectionButtons[i].transform.GetChild(CHILD_IMAGE_INDEX).GetComponent <Image>().sprite = null;
         }
     }
 }