private static string GetCommonDescription(PotionColor color, PotionSize size) { var sizeDescription = GetSizeDescription(size); var colorName = GetColorName(color); return($"{sizeDescription} with {colorName} liquid."); }
public void ChangeSpriteColor(PotionColor oldColor, PotionColor actualColor) { //TODO: Check old color and new, then animate depending on from what to what color it is // When animations will have to be done, maybe only send a trigger to the animator that will follow a natural path with animations links ? _spriteRenderer.sprite = _potionSprites[(int)actualColor]; }
private static string GetKey(PotionColor color) { switch (color) { case PotionColor.Red: return("potion_red"); case PotionColor.Blue: return("potion_blue"); case PotionColor.Purple: return("potion_purple"); case PotionColor.Green: return("potion_green"); case PotionColor.Orange: return("potion_orange"); case PotionColor.Yellow: return("potion_yellow"); case PotionColor.White: return("potion_white"); case PotionColor.Gray: return("potion_gray"); default: throw new ArgumentException($"Unknown potion color: {color}", nameof(color)); } }
public Potion(SaveData data) : base(data) { color = (PotionColor)data.GetIntValue(SaveKeyColor); type = (PotionType)data.GetIntValue(SaveKeyType); size = (PotionSize)data.GetIntValue(SaveKeySize); potionData = DataFactory.GetPotionData(type, size); }
private void Start() { Color = PotionColor.Empty; _potionUpdateSprite = GetComponent <PotionUpdateSprite>(); if (_potionUpdateSprite == null) { Debug.LogError("Error: No 'PotionUpdateSprite' on '" + name + "'."); } }
public void FillPotion(CustomPotion potion, PotionColor newColor) { if (!_isOccupied) { StartCoroutine(Filling(potion, newColor)); } else { Debug.Log("Info: 'ValveSupplier.FillPotion(...)' was called but valve was occupied."); } }
public void Activate(PotionColor color) { PotionEffect effect = Potion.effectMap[color]; string path = "Sprites/interface/effect_" + effect; Sprite icon = Resources.Load <Sprite>(path); iconRenderer.sprite = icon; iconRenderer.color = color.GetColor(); iconRenderer.enabled = true; }
private IEnumerator Filling(CustomPotion potion, PotionColor newColor) { _isOccupied = true; //TODO: Start animation yield return(new WaitForSeconds(_fillingTime)); potion._potionUpdateSprite.ChangeSpriteColor(potion.Color, newColor); potion.Color = newColor; potion.ResetPositionToSlot(); DecrementCurrentCapacity(); _isOccupied = false; }
public Potion(PotionColor color, PotionType type, PotionSize size, ItemRareness rareness) : base(new ItemConfiguration { Key = GetKey(color), Name = "Potion", Rareness = rareness, Weight = GetWeight(size) }) { this.color = color; this.type = type; this.size = size; potionData = DataFactory.GetPotionData(type, size); }
public string GetName(PotionColor color) { var sizeName = GetSizeName(); var knownPotion = ((Player)CurrentGame.Player).KnownPotions.Contains(type); if (knownPotion) { return(GetKnownName(sizeName)); } var colorName = GetColorName(color); colorName = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(colorName); return($"{sizeName}{colorName} Potion"); }
public StyledLine[] GetDescription(Player player, PotionColor color) { var result = new List <StyledLine>(); if (player.KnownPotions.Contains(type)) { result.AddRange(GetEffectDescription()); } else { result.Add(new StyledLine { "???" }); } result.Add(StyledLine.Empty); result.Add(new StyledLine { new StyledString(GetCommonDescription(color, Size), TextHelper.DescriptionTextColor) }); return(result.ToArray()); }
public static PotionColor MixPotion(PotionColor potionColor, ValveColor valveColor) { if (potionColor == PotionColor.Empty) { // ValveColor has same 1, 2 and 3 indexes as PotionColor (+1 because 0 is Empty) return((PotionColor)valveColor + 1); } if (valveColor == ValveColor.Red) { // If potion already contain Red, do not change its color if (potionColor == PotionColor.Red || potionColor == PotionColor.Orange || potionColor == PotionColor.Purple || potionColor == PotionColor.Brown) { return(potionColor); } else if (potionColor == PotionColor.Blue) { return(PotionColor.Purple); } else if (potionColor == PotionColor.Yellow) { return(PotionColor.Orange); } else if (potionColor == PotionColor.Green) { return(PotionColor.Brown); } } if (valveColor == ValveColor.Blue) { // If potion already contain Blue, do not change its color if (potionColor == PotionColor.Blue || potionColor == PotionColor.Green || potionColor == PotionColor.Purple || potionColor == PotionColor.Brown) { return(potionColor); } else if (potionColor == PotionColor.Red) { return(PotionColor.Purple); } else if (potionColor == PotionColor.Yellow) { return(PotionColor.Green); } else if (potionColor == PotionColor.Orange) { return(PotionColor.Brown); } } if (valveColor == ValveColor.Yellow) { // If potion already contain Yellow, do not change its color if (potionColor == PotionColor.Yellow || potionColor == PotionColor.Green || potionColor == PotionColor.Orange || potionColor == PotionColor.Brown) { return(potionColor); } else if (potionColor == PotionColor.Red) { return(PotionColor.Orange); } else if (potionColor == PotionColor.Blue) { return(PotionColor.Green); } else if (potionColor == PotionColor.Purple) { return(PotionColor.Brown); } } // If nothing matches, do not change potion's color return(potionColor); }
public void Set(PotionColor pc) { Color = pc; action = effectMap[color]; }
public AbstractPotion(string _name, string _id, PotionRarity _rarity, PotionSize _potionSize, PotionColor _potionColor) { IsObtained = false; Potency = 0; IsCanUse = false; Discarded = false; IsThrown = false; IsTargetRequired = false; Name = _name; Id = _id; Rarity = _rarity; }
public Potion(PotionColor color, int quantity, string longName, string shortName) : base(quantity, longName, shortName, POTION_SPRITE) { Color = color; }
public static Color GetColor(this PotionColor fc) { string code = ""; switch (fc) { case PotionColor.red: code = "#b70e0e"; break; case PotionColor.yellow: code = "#eacc08"; break; case PotionColor.blue: code = "#1a2d8c"; break; case PotionColor.black: code = "#170801"; break; case PotionColor.white: code = "#f3fafa"; break; case PotionColor.pink: code = "#ffb6b6"; break; case PotionColor.orange: code = "#ff6c03"; break; case PotionColor.purple: code = "#551764"; break; case PotionColor.green: code = "#13881b"; break; case PotionColor.maroon: code = "#6a0202"; break; case PotionColor.brown: code = "#564901"; break; case PotionColor.cream: code = "#fff198"; break; case PotionColor.navy: code = "#010d4d"; break; case PotionColor.aqua: code = "#9dadff"; break; case PotionColor.gray: code = "#676767"; break; } ColorUtility.TryParseHtmlString(code, out Color color); return(color); }
private static string GetColorName(PotionColor color) { return(color.ToString().ToLower()); }