Ejemplo n.º 1
0
    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;
        }
    }
Ejemplo n.º 2
0
    protected virtual void KillEffects()
    {
        if (effects == null)
        {
            return;
        }

        effects.Destroy(false);
        effects = null;
    }
Ejemplo n.º 3
0
    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;
        }
    }
Ejemplo n.º 4
0
    protected override void OnDestroy()
    {
        base.OnDestroy();

        if (AttachJoint.IsValid())
        {
            AttachJoint.Remove();
        }

        if (AttachRope != null)
        {
            AttachRope.Destroy(true);
        }
    }
Ejemplo n.º 5
0
 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");
 }
Ejemplo n.º 6
0
        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();
        }
Ejemplo n.º 7
0
 public override void OnDiscarded(TankPlayer player)
 {
     activeEffect?.Destroy(false);
     base.OnDiscarded(player);
 }