public void AddFuel(Flammable fuel) { if (showDebug) { Debug.Log(base.name + " Add Fuel "); } if (flammableList.Contains(fuel)) { return; } flammableList.Add(fuel); flammbleElementCount++; if (isHot) { if (showDebug) { Debug.Log(base.name + " Going to change the colour of the fuel "); } FlammableScriptHeatColourChange1 component = fuel.GetComponent <FlammableScriptHeatColourChange1>(); if (component != null) { component.Ignite(); } } UpdateValue(); }
public void RemoveFuel(Flammable fuel) { if (showDebug) { Debug.Log(base.name + " Remove fuel "); } flammableList.Remove(fuel); flammbleElementCount--; if (isHot) { FlammableScriptHeatColourChange1 component = fuel.GetComponent <FlammableScriptHeatColourChange1>(); component.Extinguish(); if (flammableList.Count == 0 && flameList.Count == 0) { isHot = false; } } UpdateValue(); }
public void Ignite() { if (showDebug) { Debug.Log(base.name + " Ignite "); } isHot = true; flameElementCount++; if (flammableList.Count != 0) { if (showDebug) { Debug.Log(base.name + " Flammable list is not 0 "); Debug.Log(base.name + " flammableList.Count =" + flammableList.Count); } for (int i = 0; i < flammableList.Count; i++) { Flammable flammable = flammableList[i]; FlammableScriptHeatColourChange1 component = flammable.GetComponent <FlammableScriptHeatColourChange1>(); if (showDebug) { Debug.Log(base.name + " Doing Entry " + i); } if (component != null) { component.Ignite(); } } } if (flameList.Count != 0) { for (int j = 0; j < flameList.Count; j++) { flameList[j].Ignite(); } } if (showDebug) { Debug.Log(base.name + " flameElementCount = " + flameElementCount); } UpdateValue(); }
public void Extinguish() { if (flameList.Count != 0) { return; } for (int i = 0; i < flammableList.Count; i++) { Flammable flammable = flammableList[i]; FlammableScriptHeatColourChange1 component = flammable.GetComponent <FlammableScriptHeatColourChange1>(); if (showDebug) { Debug.Log(base.name + " Doing Entry " + i); } if (component != null) { component.Extinguish(); } } }