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 void SetMicroorganism(Microorganism microorganism, float amount) { Microorganism = microorganism; MicroorganismAmount = amount; SetMicroorganismColor(Microorganism); // TODO: Move this entire method indo AddMicroorganism if (MicroorganismAmount <= 0) { Microorganism = null; } }
public override bool Equals(object obj) { //Check for null and compare run-time types. if ((obj == null) || !GetType().Equals(obj.GetType())) { return(false); } else { Microorganism m = (Microorganism)obj; return(name == m.name); } }
private void SetMicroorganismColor(Microorganism microorganism) { Color color = new Color(0, 0, 0, 0); if (microorganism != null) { float transparency = Mathf.Sqrt(MicroorganismAmount / Config.SLOT_MAX_MICROORGANISMS); color = new Color( microorganism.elementColor.r, microorganism.elementColor.g, microorganism.elementColor.b, transparency); } microorganismMeshRenderer.material.color = color; }
public void AddMicroorganism(Microorganism microorganism, float amount) { if (microorganism == this.Microorganism) { MicroorganismAmount += amount; } else if (Microorganism is null) { Microorganism = microorganism; MicroorganismAmount = amount; } SetMicroorganismColor(Microorganism); // TODO: This is wrong. Make these functions the same if (microorganismAmount <= 0) { Microorganism = null; } }