/// <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)); } }
public override GameObject GetGameObject() { var go = PrefabDictionary.GetPrefab("Bee"); go.GetComponent <SetBeeGOColours>().colour = BeeDictionaries.GetBeeColour(normalBee?.pSpecies ?? queenBee.queen.pSpecies); go.GetComponent <SetBeeGOColours>().beeType = beeType; return(go); }