mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-09 16:45:55 +00:00
Movement for nodes patterns
This commit is contained in:
parent
36df2274c0
commit
e4d7a9159f
6 changed files with 172 additions and 96 deletions
|
|
@ -29,23 +29,26 @@ public partial class CreateEmitterPattern : AttackPattern
|
|||
public void Start()
|
||||
{
|
||||
Emitter = pattern.CreateAsChild
|
||||
? parent.CreateChild<AutonomousBulletEmitter>(pattern.Prefab, parent.GlobalPosition + pattern.SpawnOffset)
|
||||
: parent.CreateSibling<AutonomousBulletEmitter>(pattern.Prefab, parent.GlobalPosition + pattern.SpawnOffset);
|
||||
? parent.CreateChild<AutonomousBulletEmitter>(pattern.Prefab,
|
||||
parent.GlobalPosition + pattern.SpawnOffset)
|
||||
: parent.CreateSibling<AutonomousBulletEmitter>(pattern.Prefab,
|
||||
parent.GlobalPosition + pattern.SpawnOffset);
|
||||
Emitter.Script = pattern.Script;
|
||||
Emitter.EmitOnStart = true;
|
||||
Emitter.LifeTime = pattern.LifeTime;
|
||||
|
||||
|
||||
_active = true;
|
||||
Emitter.Autonomous = !pattern.WaitForCompletion;
|
||||
|
||||
|
||||
Emitter.Death += EmitterOnDeath;
|
||||
|
||||
|
||||
Emitter.Start();
|
||||
}
|
||||
|
||||
private void EmitterOnDeath()
|
||||
{
|
||||
_active = false;
|
||||
Emitter.Death -= EmitterOnDeath;
|
||||
}
|
||||
|
||||
public void UpdatePattern(double delta)
|
||||
|
|
@ -57,12 +60,11 @@ public partial class CreateEmitterPattern : AttackPattern
|
|||
Emitter.Update(delta);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public bool IsComplete()
|
||||
{
|
||||
if (pattern.WaitForCompletion)
|
||||
if (pattern.WaitForCompletion)
|
||||
return !_active;
|
||||
return _active;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue