public Cream(string name, string brand, decimal price, GenderType gender, ScentType scent) { this.Name = name; this.Brand = brand; this.Price = price; this.Gender = gender; this.Scent = scent; }
/// <summary> /// Adds a scent to the object or increases that scent's potency /// Occurs each time an animal moves onto or performs an action on that object /// </summary> public void AddScent(Scent animalScent) { if (GetComponent <Behavior>()) { return; } if (scent != animalScent.scent) { scent = animalScent.scent; scentProvider = animalScent.gameObject; scentStrength = animalScent.scentStrength; float dist = Vector2.Distance(this.gameObject.transform.position, animalScent.gameObject.transform.position); scentStrength -= dist; //Debug.Log(this.gameObject + " scent changed to " + animalScent.scent); } else { if (scentStrength < animalScent.scentStrength) { scentStrength = animalScent.scentStrength; } } }
/// <summary> /// Scent naturally decays over time /// </summary> void DecayScent() { if (decayCycleBusy) { return; } StartCoroutine(DecayCycleCoroutine()); if (scent != defaultScent) { scentStrength -= decayRate; if (scentStrength < defaultScentStrength)//if it falls below the minimum value... { //revert the scent back to its default scent type scent = defaultScent; } } else if (scent == defaultScent) { if (scent == ScentType.Foliage || scent == ScentType.Bush) { // } //scent slowly builds up or down to a normalized value else if (scentStrength < maxScentStrength) { scentStrength += .1f; } else if (scentStrength > maxScentStrength) { scentStrength -= .1f; } } if (isTurf) { DebugUpdateScentTracker(); } }
private string CreateCream(string creamName, string creamBrand, decimal creamPrice, GenderType creamGender, ScentType creamScent) { if (this.products.ContainsKey(creamName)) { return(string.Format(ShampooAlreadyExist, creamName)); } var shampoo = this.factory.CreateCream(creamName, creamBrand, creamPrice, creamGender, creamScent); this.products.Add(creamName, (IProduct)shampoo); return(string.Format(ShampooCreated, creamName)); }
public Cream CreateCream(string name, string brand, decimal price, GenderType gender, ScentType scent) { return(new Cream(name, brand, price, gender, scent)); }