Add new components: CannotStompComponent, SkillUnlockedComponent, SpaceshipEnterComponent, SpaceshipExitComponent, SpinComponent, StompDamageComponent, StraightMotionComponent, TerrainHitFx, TooltipComponent, TrailComponent, and UnlockOnRequirementComponent
This commit is contained in:
33
scripts/components/TerrainHitFx.cs
Normal file
33
scripts/components/TerrainHitFx.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Godot;
|
||||
|
||||
namespace Mr.BrickAdventures.scripts.components;
|
||||
|
||||
public partial class TerrainHitFx : Node
|
||||
{
|
||||
private List<GpuParticles2D> _gpuParticles = [];
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
if (Owner is GpuParticles2D gpuParticle) _gpuParticles.Add(gpuParticle);
|
||||
|
||||
foreach (var child in GetChildren())
|
||||
{
|
||||
if (child is GpuParticles2D p)
|
||||
{
|
||||
_gpuParticles.Add(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void TriggerFx()
|
||||
{
|
||||
foreach (var fx in _gpuParticles.Where(fx => fx != null))
|
||||
{
|
||||
fx.Restart();
|
||||
fx.Emitting = true;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user