public void Ignite() { if (SmokeObject != null) { GameObject.DestroyImmediate(SmokeObject); } if (FireObject == null) { if (FireObjectTemplate == null) { FireObjectTemplate = FXManager.Get.SpawnFire(Type.ToString(), transform, Offset, Vector3.zero, FireScale, false); } FireObject = GameObject.Instantiate(FireObjectTemplate) as GameObject; FireObject.transform.parent = tr; FireObject.transform.localPosition = Offset; ParticleEmitters.AddRange(tr.GetComponentsInChildren <ParticleEmitter>()); } if (FireLight == null) { FireLight = LightManager.GetWorldLight("CampfireLight", transform, Offset, true, WorldLightType.AlwaysOn); //this will turn the light into a proper fire light FireLight.ParentFire = this; } ThermalState = GooThermalState.Burning; }
protected IEnumerator SetStateOverTime(WIState oldState, WIState newState, double transitionStartTime, double transitionDuration) { if (!Application.isPlaying) { yield break; } double transitionEndTime = transitionStartTime + transitionDuration; float normalizedTransition = 0f; //get the world light if we're using one if (!newState.UseLight) { if (worlditem.Light != null) { //whoops, better get rid of this one LightManager.DeactivateWorldLight(worlditem.Light); } } else { //if we are using one Transform lightParent = worlditem.tr; if (worlditem.Is(WIMode.Equipped | WIMode.Stacked)) { lightParent = Player.Local.Tool.ToolDoppleganger.transform; } WorldLightType wlType = WorldLightType.Exterior; if (worlditem.Is(WIMode.Equipped)) { wlType = WorldLightType.Equipped; } else { while (worlditem.Group == null) { yield return(null); } if (worlditem.Group.Props.Interior || worlditem.Group.Props.TerrainType == LocationTerrainType.BelowGround) { wlType = WorldLightType.InteriorOrUnderground; } } worlditem.Light = LightManager.GetWorldLight(worlditem.Light, newState.LightTemplateName, lightParent, newState.LightOffset, newState.LightRotation, true, wlType); } while (WorldClock.AdjustedRealTime < transitionEndTime) { normalizedTransition = (float)((WorldClock.AdjustedRealTime - transitionStartTime) / (transitionEndTime - transitionStartTime)); BlendState(oldState, newState, mCurrentState, normalizedTransition); yield return(null); } //finish transition BlendState(oldState, newState, mCurrentState, 1.0f); OnTransitionFinish(oldState, newState, mCurrentState); yield break; }
public void OnRestorePower() { creature.TryToRevive(); //won't do anything if it's not stunned //SearchLight.LightEnabled = true; LuminteTrail.enabled = true; //create our search light if (SearchLight == null) { SearchLight = LightManager.GetWorldLight("RefinedLightLuminite", LuminiteLightPivot, Vector3.zero, true, WorldLightType.AlwaysOn); } OrbSpotlightForward.enabled = true; OrbSpotlightBottom.enabled = true; OrbPointLight.enabled = true; LuminiteParticles.enableEmission = true; PowerSource.CanRemoveSource = false; OrbSpeak(OrbSpeakUnit.ResumingNormalRoutine, worlditem.tr); }