void AssignValues() { if (GameObject.FindGameObjectWithTag("WaterManager") == null) { if (this.gameObject.GetComponent <FreezeEvaporateProperties>() != null) { FreezeEvaporateProperties values = this.gameObject.GetComponent <FreezeEvaporateProperties>(); SetValues(values); } else { FreezeEvaporateProperties values = this.gameObject.AddComponent <FreezeEvaporateProperties>(); SetValues(values); } } else { if (this.gameObject.GetComponent <FreezeEvaporateProperties>() != null) { FreezeEvaporateProperties values = this.gameObject.GetComponent <FreezeEvaporateProperties>(); SetValues(values); } else { FreezeEvaporateManager values = GameObject.FindGameObjectWithTag("WaterManager").GetComponentInChildren <FreezeEvaporateManager>() as FreezeEvaporateManager; SetValues(values); } } }
void SetValues(FreezeEvaporateProperties values) { Debug.Log("used default values"); expandToIce = values.ExpandToIce; evaporate = values.Evaporate; speedOfEvaporation = values.SpeedOfEvaporation; iceExpandTime = values.IceExpandTime; }