Пример #1
0
 protected void InitElements(CardDefinitionType cardType)
 {
     GetElements();
     for (int i = 0; i < elements.Length; i++)
     {
         elements[i].UpdateForCard(cardType);
     }
 }
Пример #2
0
 public CardBaseDefinition GetCardDefinition(CardDefinitionType cardType)
 {
     for (int i = 0; i < cardDefinitions.Count; i++)
     {
         if (cardDefinitions[i].cardType == cardType)
         {
             return(cardDefinitions[i]);
         }
     }
     Debug.LogError("Error: couldn't find card definition for type " + cardType + " in card definitions library.");
     return(null);
 }
Пример #3
0
    void CheckState()
    {
        bool canCreate = false;

        if (categorySimpleUI.currentPickup == null)
        {
            currentInstructionsLabel.text = "Select a card category.";
        }
        else if (effect1SimpleUI.currentPickup == null)
        {
            if (categorySimpleUI.currentPickup.pickupDefinition.type == PickupType.Category &&
                (categorySimpleUI.currentPickup.pickupDefinition as PickupCategoryDefinition).category == CardCategory.Creature)
            {
                currentInstructionsLabel.text = "Select an effect or create your card.";
                canCreate = true;
            }
            else
            {
                currentInstructionsLabel.text = "Select an effect.";
            }
        }
        else
        {
            canCreate = true;
            currentInstructionsLabel.text = "You can now create your card.";
        }
        createCardButton.gameObject.SetActive(canCreate);
        if (canCreate)
        {
            int  cost        = CalculateCost();
            bool canPurchase = cost <= GlobalGameManager.Instance.CoinsAmount;
            createCardButton.interactable = canPurchase;
            createCardLabel.text          = "Create for " + cost.ToString();
            createCardLabel.color         = canPurchase ? Color.black : Color.red;
        }
        GlobalGameManager.Instance.pickupCollection.UpdatePickupStates();
        //TODO: Update edited card if needed (known or unknown)

        if (canCreate)
        {
            CardDefinitionType cardDefinitionType = GetCurrentCardDefinitionType();
            Card resultCard = new Card(cardDefinitionType);
            GlobalGameManager.Instance.deckBuildingManager.editedCard.ShowCard(resultCard);
        }
        else
        {
            GlobalGameManager.Instance.deckBuildingManager.editedCard.ShowUnknownCard();
        }
    }
Пример #4
0
    public void OnCreateButton()
    {
        CardDefinitionType cardDefinitionType = GetCurrentCardDefinitionType();

        if (cardDefinitionType != CardDefinitionType.None)
        {
            GlobalGameManager.Instance.CoinsAmount -= CalculateCost();
            GlobalGameManager.Instance.pickupCollection.OnPickupConsumed(categorySimpleUI.currentPickup);
            if (effect1SimpleUI.currentPickup != null)
            {
                GlobalGameManager.Instance.pickupCollection.OnPickupConsumed(categorySimpleUI.currentPickup);
            }
            Card resultCard = new Card(cardDefinitionType);
            GlobalGameManager.Instance.deckBuildingManager.OnCardCreated(resultCard);
        }
    }
Пример #5
0
 public bool DoesPlayerKnowCard(CardDefinitionType type)
 {
     return(knownCards.Contains(type));
 }
Пример #6
0
 public Card(CardDefinitionType _cardDefinitionType)
 {
     cardDefinition = GlobalGameManager.Instance.cardBaseDefinitionsLibrary.GetCardDefinition(_cardDefinitionType);
 }
Пример #7
0
 public CardBaseDefinition(CardDefinitionType type)
 {
     name     = type.ToString();
     cardType = type;
 }
Пример #8
0
 public void UpdateForCard(CardDefinitionType cardType)
 {
     gameObject.SetActive(types.Contains(cardType));
 }