public Consumption(Microorganism microorganism, Pollutant pollutant) : base( microorganism.name + "-" + pollutant.name, Color.Lerp(microorganism.elementColor, pollutant.elementColor, 0.5f), ElementType.CONSUMPTION) { this.microorganism = microorganism; this.pollutant = pollutant; }
public override bool Equals(object obj) { //Check for null and compare run-time types. if ((obj == null) || !GetType().Equals(obj.GetType())) { return(false); } else { Pollutant r = (Pollutant)obj; return(name == r.name); } }
public void SetPollutant(Pollutant pollutant, float amount) { Pollutant = pollutant; PollutantAmount = amount; SetPollutantColor(Pollutant); // TODO: Move this entire method indo AddPollutant if (PollutantAmount <= 0) { Pollutant = null; } }
private void SetPollutantColor(Pollutant pollutant) { Color color = new Color(0, 0, 0, 0); if (pollutant != null) { float transparency = Mathf.Sqrt(PollutantAmount / Config.SLOT_MAX_POLLUTANTS); color = new Color( pollutant.elementColor.r, pollutant.elementColor.g, pollutant.elementColor.b, transparency); } pollutantMeshRenderer.material.color = color; }
public void AddPollutant(Pollutant pollutant, float amount) { if (pollutant == Pollutant) { PollutantAmount += amount; } else if (Pollutant is null) { Pollutant = pollutant; PollutantAmount = amount; } SetPollutantColor(Pollutant); // TODO: This is wrong. Make these functions the same if (PollutantAmount <= 0) { Pollutant = null; } }