Beispiel #1
0
        /// <summary>
        /// Creates an action type card using hard-coded data.
        /// </summary>
        public void CreateActionCard()
        {
            CreateCard(transform, CardTypes.Action);
            if (activeCard == null)
            {
                return;
            }

            activeCard.transform.SetParent(transform.parent.parent);
            UICard card = activeCard.GetComponent <UICard>();

            card.Icon.sprite      = DemoSprite1;
            card.Name.text        = "Chop";
            card.Description.text = "Strike the nearest tree with an axe.";
            card.Modifier.text    = "15";
        }
Beispiel #2
0
        /// <summary>
        /// Creates an item type card using hard-coded data.
        /// </summary>
        public void CreateItemCard()
        {
            CreateCard(transform, CardTypes.Item);
            if (activeCard == null)
            {
                return;
            }

            activeCard.transform.SetParent(transform.parent.parent);
            UICard card = activeCard.GetComponent <UICard>();

            card.Icon.sprite      = DemoSprite2;
            card.Name.text        = "Copper Axe";
            card.Description.text = "An axe made from copper.  Weak, but useful.";
            card.Modifier.text    = "1";
        }
Beispiel #3
0
        /// <summary>
        /// Creates a heart type card using hard-coded data.
        /// </summary>
        public void CreateHeartCard()
        {
            CreateCard(transform, CardTypes.Relationship);
            if (activeCard == null)
            {
                return;
            }

            activeCard.transform.SetParent(transform.parent.parent);
            UICard card = activeCard.GetComponent <UICard>();

            card.Icon.sprite      = DemoSprite6;
            card.Name.text        = "Dire Pixel";
            card.Description.text = "The pixel artist for Pixel UI.";
            card.Modifier.text    = string.Empty;
        }
Beispiel #4
0
        /// <summary>
        /// Creates a quality type card using hard-coded data.
        /// </summary>
        public void CreateQualityCard()
        {
            CreateCard(transform, CardTypes.Quality);
            if (activeCard == null)
            {
                return;
            }

            activeCard.transform.SetParent(transform.parent.parent);
            UICard card = activeCard.GetComponent <UICard>();

            card.Icon.sprite      = DemoSprite5;
            card.Name.text        = "Common Mushroom";
            card.Description.text = "A common mushroom in the world of Pixel UI.";
            card.Modifier.text    = string.Empty;
        }
Beispiel #5
0
        /// <summary>
        /// Creates a travel type card using hard-coded data.
        /// </summary>
        public void CreateTravelCard()
        {
            CreateCard(transform, CardTypes.Travel);
            if (activeCard == null)
            {
                return;
            }

            activeCard.transform.SetParent(transform.parent.parent);
            UICard card = activeCard.GetComponent <UICard>();

            card.Icon.sprite      = DemoSprite4;
            card.Name.text        = "Demo Village";
            card.Description.text = "A humble village on the outskirts of Pixel UI";
            card.Modifier.text    = "45";
        }
Beispiel #6
0
        /// <summary>
        /// Creates a shop type card using hard-coded data.
        /// </summary>
        public void CreateShopCard()
        {
            CreateCard(transform, CardTypes.Shop);
            if (activeCard == null)
            {
                return;
            }

            activeCard.transform.SetParent(transform.parent.parent);
            UICard card = activeCard.GetComponent <UICard>();

            card.Icon.sprite      = DemoSprite3;
            card.Name.text        = "Wood";
            card.Description.text = "A sturdy piece of wood used for crafting.";
            card.Modifier.text    = "50";
        }
Beispiel #7
0
        /// <summary>
        /// Creates a new card, destroying the old active card, and setting the new card as the active one.
        /// </summary>
        /// <param name="parent">The transform parent for the new card.</param>
        /// <param name="type">The type of card we need to create.</param>
        private void CreateCard(Transform parent, CardTypes type)
        {
            if (primaryCardProfile == null || primaryCardProfile.CardPrefab == null)
            {
                return;
            }

            DestroyActiveCard();
            activeCard = Instantiate(primaryCardProfile.CardPrefab, parent, false);
            UICard uiCard = activeCard.GetComponent <UICard>();

            uiCard.cardBackSprite    = primaryCardProfile.CardBackSprite;
            uiCard.cardFrontSprite   = primaryCardProfile.CardFrontSprite;
            uiCard.Background.sprite = primaryCardProfile.CardBackSprite;

            switch (type)
            {
            case CardTypes.Action:     // Energy
                uiCard.Foreground.sprite = primaryCardProfile.EnergyForegroundSprite;
                break;

            case CardTypes.Item:     // Inventory
                uiCard.Foreground.sprite = primaryCardProfile.InventoryForegroundSprite;
                break;

            case CardTypes.Quality:     // Quality
                uiCard.Foreground.sprite = primaryCardProfile.StarForegroundSprites[Random.Range(0, primaryCardProfile.StarForegroundSprites.Count)];
                break;

            case CardTypes.Relationship:     // Relationship
                uiCard.Foreground.sprite = primaryCardProfile.HeartForegroundSprites[Random.Range(0, primaryCardProfile.HeartForegroundSprites.Count)];
                break;

            case CardTypes.Shop:     // Shop
                uiCard.Foreground.sprite = primaryCardProfile.ShopForegroundSprite;
                break;

            case CardTypes.Travel:     // Time
                uiCard.Foreground.sprite = primaryCardProfile.TimeForegroundSprite;
                break;
            }
        }