public override void SpawnSetup(Map map, bool respawningAfterLoad) { base.SpawnSetup(map, respawningAfterLoad); if (!respawningAfterLoad) { PoweringUpTicks = POWER_UP_TICKS; } if (beam == null) { beam = new UpBeam(map, this.TrueCenter() + new Vector3(0f, 0f, 1.2f)); beam.IsActive = false; } if(chargeEffect == null) { chargeEffect = Object.Instantiate(Content.MeguminChargePrefab).GetComponent<ParticleSystem>(); chargeEffect.transform.position = this.TrueCenter() + new Vector3(0f, 0f, 1.1f); chargeEffect.transform.eulerAngles = new Vector3(90f, 0f, 0f); } if (!IsPoweringUp) chargeEffect.Stop(true, ParticleSystemStopBehavior.StopEmittingAndClear); }
public override void DeSpawn(DestroyMode mode = DestroyMode.Vanish) { base.DeSpawn(mode); beam?.Dispose(); beam = null; }
private void OnGUI() { return; try { GUILayout.Space(120); bool spawn = GUILayout.Button("Spawn"); bool openWiki = GUILayout.Button("Show wiki window"); if (spawn) { Vector3 pos = new Vector3(15, 0, 15); var thing = new UpBeam(Find.CurrentMap, pos); thing.SetVisScale(1f); } if (openWiki) { WikiWindow.Open(ModCore.Instance.Wiki); } if (Find.CurrentMap != null && Current.ProgramState == ProgramState.Playing) { float points = StorytellerUtility.DefaultThreatPointsNow(Find.CurrentMap); GUILayout.Label("Current map raid points: " + points); GUILayout.Label("Tick rate: " + Find.TickManager.TickRateMultiplier); } if (Find.CurrentMap != null) { var grid = AI_AvoidGrid.Ensure(Find.CurrentMap); GUILayout.Label("Current map avoidance providers: " + grid.AvoidanceProviders.Count); } } catch (Exception e) { Log.Warning($"GUI draw error: {e}"); } }