Example #1
0
        /// <summary>
        /// Returns the sprite for this, of the correct colour
        /// </summary>
        /// <returns><see cref="Sprite"/></returns>
        public override Sprite GetItemSprite()
        {
            //* if the bee has not change in any way dont rebuild the sprite as that takes time
            if (previousBeeType == beeType && itemSprite != null)
            {
                return(itemSprite);
            }

            previousBeeType = beeType;

            //* set the correct sprite and colour
            if (beeType == BeeType.QUEEN)
            {
                //* avoids the crown, black body, yellow body, and both colours of the wings
                Color[] colorsToAvoid = { new Color(0, 0, 0), new Color(232f, 200f, 42f, 255f) / 255f, new Color(232f, 213f, 106f, 255f) / 255f, new Color(156f, 146f, 130f, 255f) / 255f, new Color(225f, 223f, 219f, 255f) / 255f };
                return(itemSprite = SpriteDictionary.GetSprite("Queen").ColourSprite(BeeDictionaries.GetBeeColour((BeeSpecies)(queenBee?.queen.pSpecies)), coloursToAvoid: colorsToAvoid));
            }
            else if (beeType == BeeType.PRINCESS)
            {
                //* avoids the tiara, black body, yellow body, and both colours of the wings
                Color[] colorsToAvoid = { new Color(0, 0, 0), new Color(191f, 195f, 45f, 255f) / 255f, new Color(191f, 195f, 44f, 255f) / 255f, new Color(156f, 146f, 130f, 255f) / 255f, new Color(225f, 223f, 219f, 255f) / 255f, new Color(232f, 200, 42, 255f) / 255f };
                return(itemSprite = SpriteDictionary.GetSprite("Princess").ColourSprite(BeeDictionaries.GetBeeColour((BeeSpecies)(normalBee?.pSpecies)), coloursToAvoid: colorsToAvoid));
            }
            else
            {
                //* avoids the block body, yellow body, and both wing colours
                Color[] colorsToAvoid = { new Color(0, 0, 0), new Color(156f, 146f, 130f, 255f) / 255f, new Color(225f, 223f, 219f, 255f) / 255f, new Color(232f, 200, 42, 255f) / 255f };
                return(itemSprite = SpriteDictionary.GetSprite("Drone").ColourSprite(BeeDictionaries.GetBeeColour((BeeSpecies)normalBee?.pSpecies), coloursToAvoid: colorsToAvoid));
            }
        }
Example #2
0
    public static void RenderToSingleShopItem(ShopItem shopItem, GameObject uiObject)
    {
        uiObject.transform.Find("OwnedOverlay").gameObject.SetActive(shopItem.isOwned);

        uiObject.transform.Find("Name").GetComponent <Text>().text        = shopItem.name;
        uiObject.transform.Find("Description").GetComponent <Text>().text = shopItem.description;
        uiObject.transform.Find("Image").GetComponent <Image>().sprite    = null;
        uiObject.transform.Find("Image").GetComponent <Image>().sprite    = SpriteDictionary.GetSprite(shopItem.imageName);
        uiObject.transform.Find("Price").GetComponent <Text>().text       = "$" + shopItem.priceInDollars + " Value";
    }
    private void SpawnBall()
    {
        int        last       = ballQueue.Count - 1;
        BallObject lastBall   = ballQueue[last];
        Sprite     exerSprite = gameSprites.GetSprite(lastBall.exercise);
        GameObject cannonBall = CannonController.FireProjectile(lastBall, exerSprite);

        ballQueue.RemoveAt(last);
        previewPanel.UpdatePreview();
        CreateActiveObject(cannonBall, lastBall);
        timeout = lastBall.timeDelay;
    }
    private void GenerateStats()
    {
        Dictionary <string, int> activities = levelData.successfulActivityRecord;

        foreach (string activity in activities.Keys)
        {
            GameObject statItem = Instantiate(stat) as GameObject;
            statItem.transform.GetChild(0).GetComponent <Image>().sprite = sprites.GetSprite(activity);
            string countLabel = "x" + activities[activity];
            statItem.transform.GetChild(1).GetComponent <TextMeshProUGUI>().SetText(countLabel);
            statItem.transform.SetParent(statsPanel.transform, false);
        }
    }
Example #5
0
    public static void RenderToGemSaleList(InventoryEntry entry, GameObject uiObject)
    {
        // TODO: don't add rows for undiscovered item types
        // uiObject.SetActive(GameData.singleton.potionsUnlocked[(int)report.PotionType] || report.numSold > 0);

        uiObject.transform.Find("H/Name").GetComponent <Text>().text    = string.Format("{0}\nPotion", entry.itemType.GetName());
        uiObject.transform.Find("H/Icon").GetComponent <Image>().sprite = SpriteDictionary.GetSprite(entry.itemType.GetImage());
        uiObject.transform.Find("H/Icon").GetComponent <Image>().color  = entry.itemType.GetColor();

        uiObject.transform.Find("H/Sales").GetComponent <Text>().text  = string.Format("{0}x", entry.itemCount);
        uiObject.transform.Find("H/Profit").GetComponent <Text>().text = string.Format("${0}", entry.totalValue);
        // TODO: Exclude reports that have 0 sales (so that they are not even rendered)
        uiObject.transform.Find("H/Profit").GetComponent <CanvasGroup>().alpha = (entry.itemCount == 0 ? 0f : 1f);
    }
    private void RenderPreviewObjects()
    {
        float positionY = -170f;

        for (int i = 0; i < ballData.Length; i++)
        {
            GameObject    previewObject = Instantiate(previewImage, new Vector3(0, 0, 0), Quaternion.identity);
            RectTransform objDimensions = previewObject.GetComponent <RectTransform>();
            objDimensions.SetParent(gameObject.transform);
            previewObject.GetComponent <Image>().sprite = gameSprites.GetSprite(ballData[i].exercise);
            objDimensions.localScale    = new Vector3(1, 1, 0);
            objDimensions.localPosition = new Vector2(0, positionY);
            positionY += 165f;
        }
    }
Example #7
0
 public override Sprite GetItemSprite()
 {
     return(SpriteDictionary.GetSprite("Leaves"));
 }
Example #8
0
 /// <summary>
 /// Returns the sprite for the item
 /// </summary>
 /// <returns>Sprite for this item</returns>
 public virtual Sprite GetItemSprite()
 {
     return(SpriteDictionary.GetSprite("TestSprite"));
 }
Example #9
0
 public void Start()
 {
     GetComponentInChildren <SpriteRenderer>().color  = itemData.itemType.GetColor();
     GetComponentInChildren <SpriteRenderer>().sprite = SpriteDictionary.GetSprite(itemData.itemType.GetImage());
 }
Example #10
0
 public override Sprite GetItemSprite()
 {
     return(SpriteDictionary.GetSprite("Apiary"));
 }
Example #11
0
 /// <summary>
 /// Returns the items <see cref="Sprite"/>
 /// </summary>
 /// <returns></returns>
 public override Sprite GetItemSprite()
 {
     return(SpriteDictionary.GetSprite("BeeAlyzer"));
 }
Example #12
0
 /// <summary>
 /// Returns the sprite for the <see cref="Item"/>
 /// </summary>
 /// <returns><see cref="Sprite"/> for this <see cref="Item"/></returns>
 public override Sprite GetItemSprite()
 {
     return(SpriteDictionary.GetSprite("CraftingTable"));
 }
Example #13
0
 public override Sprite GetItemSprite()
 {
     return(SpriteDictionary.GetSprite("QuestBook"));
 }
Example #14
0
 /// <summary>
 /// Retuens the sprite for the this of the correct colour
 /// </summary>
 /// <returns><see cref="Sprite"/></returns>
 public override Sprite GetItemSprite()
 {
     return(itemSprite ?? (itemSprite = SpriteDictionary.GetSprite("HoneyComb").ColourSprite(CombColour)));
 }