protected void InitElements(CardDefinitionType cardType) { GetElements(); for (int i = 0; i < elements.Length; i++) { elements[i].UpdateForCard(cardType); } }
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); }
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(); } }
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); } }
public bool DoesPlayerKnowCard(CardDefinitionType type) { return(knownCards.Contains(type)); }
public Card(CardDefinitionType _cardDefinitionType) { cardDefinition = GlobalGameManager.Instance.cardBaseDefinitionsLibrary.GetCardDefinition(_cardDefinitionType); }
public CardBaseDefinition(CardDefinitionType type) { name = type.ToString(); cardType = type; }
public void UpdateForCard(CardDefinitionType cardType) { gameObject.SetActive(types.Contains(cardType)); }