protected virtual void KillEffects() { Beam?.Destroy(true); Beam = null; BeamActive = false; EndNoHit?.Destroy(false); EndNoHit = null; if (lastGrabbedEntity.IsValid()) { foreach (var child in lastGrabbedEntity.Children.OfType <ModelEntity>()) { if (child is Player) { continue; } if (child.Components.TryGet <Glow>(out var childglow)) { childglow.Active = false; } } if (lastGrabbedEntity.Components.TryGet <Glow>(out var glow)) { glow.Active = false; } lastGrabbedEntity = null; } }
protected virtual void KillEffects() { if (effects == null) { return; } effects.Destroy(false); effects = null; }
protected virtual void KillEffects() { Beam?.Destroy(true); Beam = null; BeamActive = false; EndNoHit?.Destroy(false); EndNoHit = null; if (lastGrabbedEntity.IsValid()) { foreach (var child in lastGrabbedEntity.Children.OfType <ModelEntity>()) { child.GlowActive = false; child.GlowState = GlowStates.GlowStateOff; } lastGrabbedEntity.GlowActive = false; lastGrabbedEntity.GlowState = GlowStates.GlowStateOff; lastGrabbedEntity = null; } }
protected override void OnDestroy() { base.OnDestroy(); if (AttachJoint.IsValid()) { AttachJoint.Remove(); } if (AttachRope != null) { AttachRope.Destroy(true); } }
public virtual void OnCollected(TankPlayer player) // Called by player upon collecting us { IsCollected = true; collector = player; if (RandomSpawner.IsValid()) { RandomSpawner.IsPowerupWaiting = false; } mainParticles?.Destroy(false); fieldUpParticles?.Destroy(false); fieldDownParticles?.Destroy(false); if (ShouldEmitEffects) { using (Prediction.Off()) { Particles.Create(collected, Position + Vector3.Up * 0.5f); Sound.FromWorld("mtk_powerup", Position); } } player.AddPoints(1, "Powerup Collected"); }
private void explode(bool withEffects) { if (withEffects) { using (Prediction.Off()) { Particles.Create("particles/explode_rocket.vpcf", Position); Sound.FromWorld("explosion", Position); } var light = new PointLightEntity { Position = Position, DynamicShadows = true, Color = new(1, 0.6f, 0.3f), Brightness = 5, Range = 64, }; _ = fadeExplosionLight(light); } Delete(); TrailEffect.Destroy(false); Light.Delete(); }
public override void OnDiscarded(TankPlayer player) { activeEffect?.Destroy(false); base.OnDiscarded(player); }