public void Setup() { player = PlayerUTests.CreateTestPlayer(); cardUnitDisplay = CardUnit_CardUnitDisplayITests.CreateTestCardUnitDisplay(); cardBuildingDisplay = CardBuilding_CardBuildingDisplayITests.CreateTestCardBuildingDisplay(); cardResourceDisplay = CardResource_CardResourceDisplayITests.CreateTestCardResourceDisplay(); }
// Start turn public void StartTurn() { gameObject.SetActive(true); endTurnButton.interactable = false; // Show drawn card Card drawnCard = player.StartTurn(); // Resource card if (drawnCard.cardType == CardType.Resource) { CardResourceDisplay newCardDisplay = (CardResourceDisplay)CardDisplay.CreateCardDisplay(drawnCard, drawnCardRegion); StartCoroutine(ShowDrawnCard(newCardDisplay)); } // Playable card else { CardPieceDisplay newCardDisplay = (CardPieceDisplay)CardDisplay.CreateCardDisplay(drawnCard, drawnCardRegion); newCardDisplay.player = player; StartCoroutine(ShowDrawnCard(newCardDisplay)); } // Update piece objects foreach (KeyValuePair <GamePiece, GamePieceObject> pair in gamePieceObjects) { if (pair.Key.hasActions) { pair.Value.ShowPieceDisabled(); } } }
// Create test card resource display public static CardResourceDisplay CreateTestCardResourceDisplay() { CardResource cardResource = CardResourceUTests.CreateTestFoodCardResource(); CardResourceDisplay cardResourceDisplay = CardResourceDisplayUTests.CreateTestCardResourceDisplay(); cardResourceDisplay.SetCard(cardResource); return(cardResourceDisplay); }
// Get piece prefab public static CardDisplay GetCardDisplayPrefab(Card card) { if (card.cardType == CardType.Unit) { CardUnitDisplay newUnit = Resources.Load <CardUnitDisplay>(ENV.CARD_UNIT_DISPLAY_PREFAB_RESOURCE_PATH); return(newUnit); } else if (card.cardType == CardType.Building) { CardBuildingDisplay newBuilding = Resources.Load <CardBuildingDisplay>(ENV.CARD_BUILDING_DISPLAY_PREFAB_RESOURCE_PATH); return(newBuilding); } else if (card.cardType == CardType.Resource) { CardResourceDisplay newResource = Resources.Load <CardResourceDisplay>(ENV.CARD_RESOURCE_DISPLAY_PREFAB_RESOURCE_PATH); return(newResource); } return(null); }
public void Setup() { cardResourceDisplay = CreateTestCardResourceDisplay(); }
// Create test card resource display public static CardResourceDisplay CreateTestCardResourceDisplay() { CardResourceDisplay cardResourceDisplay = TestFunctions.CreateClassObject <CardResourceDisplay>("Assets/Resources/Prefabs/Card Resource Display.prefab"); return(cardResourceDisplay); }