knockback forge implemented
This commit is contained in:
@@ -6,20 +6,27 @@ using Godot;
|
||||
|
||||
namespace Movementtests.forge.abilities;
|
||||
|
||||
public record SimpleHitEffectData(Vector3 SourceLocation, Vector3 TargetLocation);
|
||||
|
||||
public class SimpleHitBehavior(ForgeEffectData? damage) : IAbilityBehavior
|
||||
{
|
||||
public void OnStarted(AbilityBehaviorContext context)
|
||||
{
|
||||
if (context.Target == null || damage == null) return;
|
||||
|
||||
var effect = new Effect(damage.GetEffectData(), new EffectOwnership(context.Owner, context.Owner));
|
||||
context.Target.EffectsManager.ApplyEffect(effect);
|
||||
var sourceLocation = (context.Source as Node3D)?.GlobalPosition ?? Vector3.Zero;
|
||||
var targetLocation = (context.Target as Node3D)?.GlobalPosition ?? Vector3.Zero;
|
||||
|
||||
context.AbilityHandle.CommitAbility();
|
||||
context.InstanceHandle.End();
|
||||
var effect = new Effect(damage.GetEffectData(), new EffectOwnership(context.Owner, context.Owner));
|
||||
context.Target.EffectsManager.ApplyEffect(effect, new SimpleHitEffectData(sourceLocation, targetLocation));
|
||||
|
||||
// context.InstanceHandle.End();
|
||||
}
|
||||
|
||||
public void OnEnded(AbilityBehaviorContext context) {}
|
||||
public void OnEnded(AbilityBehaviorContext context)
|
||||
{
|
||||
context.AbilityHandle.CommitAbility();
|
||||
}
|
||||
}
|
||||
|
||||
[Tool]
|
||||
|
||||
Reference in New Issue
Block a user