private void OnTriggerStay(Collider other) { HeatSensitive sensitive = other.GetComponent <HeatSensitive>(); HeatSource source = other.GetComponent <HeatSource>(); if (sensitive != null) { } if (source != null) { } }
public float HeatTransferFrom(HeatSensitive sensitive) { float Q = 0; if (Temperature > sensitive.Temperature) { Q = HeatTransfer(Temperature, sensitive.Temperature); } else if (sensitive.Temperature > Temperature) { Q = HeatTransfer(sensitive.Temperature, Temperature); } return(Q); }
// Use this for initialization void Start() { Heat = gameObject.GetComponent <HeatSensitive>(); if (Heat == null) { Debug.LogError("GameObject must have a HeatSensitive Component"); } gameObject.GetComponent <Renderer>().material = RawMaterial; InvokeRepeating("Cook", 1.0f, 1.0f); InvokeRepeating("SetTemperature", 1.0f, 1.0f); }