protected void TransitionToOpened() { if (this.glower.DestroyedOrNull() == false) { Log.Warning("glower is not null at " + this.Position.ToString()); // TODO: remove this. } this.glower = GenSpawn.Spawn(Util_CaveworldFlora.GetGlowerStaticDef(this.def), this.Position); this.flowerState = FlowerState.opened; }
/// <summary> /// Update the glower according to the plant growth, cryostatis state and snow depth. /// </summary> public void UpdateGlowerAccordingToGrowth() { if ((this.clusterPlantProps.hasStaticGlower == false) && (this.clusterPlantProps.hasDynamicGlower == false)) { return; } // TODO: use flick component instead of spawning glower? if (this.isInCryostasis || (this.Position.GetSnowDepth() >= this.def.hideAtSnowDepth)) { TryToDestroyGlower(); return; } if (this.clusterPlantProps.hasStaticGlower) { if (this.glower.DestroyedOrNull()) { this.glower = GenSpawn.Spawn(Util_CaveworldFlora.GetGlowerStaticDef(this.def), this.Position); } } else if (this.clusterPlantProps.hasDynamicGlower) { if (this.Growth < 0.33f) { if ((this.glower.DestroyedOrNull()) || (this.glower.def != Util_CaveworldFlora.GetGlowerSmallDef(this.def))) { TryToDestroyGlower(); this.glower = GenSpawn.Spawn(Util_CaveworldFlora.GetGlowerSmallDef(this.def), this.Position); } } else if (this.Growth < 0.66f) { if ((this.glower.DestroyedOrNull()) || (this.glower.def != Util_CaveworldFlora.GetGlowerMediumDef(this.def))) { TryToDestroyGlower(); this.glower = GenSpawn.Spawn(Util_CaveworldFlora.GetGlowerMediumDef(this.def), this.Position); } } else { if ((this.glower.DestroyedOrNull()) || (this.glower.def != Util_CaveworldFlora.GetGlowerBigDef(this.def))) { TryToDestroyGlower(); this.glower = GenSpawn.Spawn(Util_CaveworldFlora.GetGlowerBigDef(this.def), this.Position); } } } }
protected void TransitionToOpened() { this.glower = GenSpawn.Spawn(Util_CaveworldFlora.GetGlowerStaticDef(this.def), this.Position, this.Map); this.flowerState = FlowerState.opened; }