mirror of
https://github.com/celisej567/gm_construct_port.git
synced 2026-01-07 14:10:26 +03:00
47 lines
643 B
C#
47 lines
643 B
C#
using Sandbox;
|
|
|
|
public partial class ThrusterEntity
|
|
{
|
|
private Particles effects;
|
|
|
|
[Event.Frame]
|
|
public void OnFrame()
|
|
{
|
|
UpdateEffects();
|
|
}
|
|
|
|
protected void CreateEffects()
|
|
{
|
|
if ( effects != null )
|
|
return;
|
|
|
|
effects = Particles.Create( "particles/physgun_end_nohit.vpcf" );
|
|
}
|
|
|
|
protected virtual void KillEffects()
|
|
{
|
|
if ( effects == null )
|
|
return;
|
|
|
|
effects.Destroy( false );
|
|
effects = null;
|
|
}
|
|
|
|
protected virtual void UpdateEffects()
|
|
{
|
|
if ( Enabled )
|
|
{
|
|
CreateEffects();
|
|
}
|
|
else
|
|
{
|
|
KillEffects();
|
|
}
|
|
|
|
if ( effects == null )
|
|
return;
|
|
|
|
effects.SetPosition( 0, Position + Rotation.Up * 20 );
|
|
}
|
|
}
|