more encapsulated effect application
This commit is contained in:
@@ -242,9 +242,7 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
|
||||
|
||||
Events.Subscribe<WeaponEventPayload>(WeaponStoppedFlyingEventTag, data =>
|
||||
{
|
||||
GD.Print("This is removing the periodic effect to the flying weapon");
|
||||
GD.Print(data.Payload.Message);
|
||||
if (_flyingWeaponEffectHandle is { IsValid: true }) EffectsManager.RemoveEffect(_flyingWeaponEffectHandle);
|
||||
_weaponFlyingAbility.Cancel();
|
||||
});
|
||||
}
|
||||
private ActiveEffectHandle? _flyingWeaponEffectHandle;
|
||||
@@ -266,15 +264,12 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
|
||||
abilityTags: WeaponFlyingAbilityTag.GetSingleTagContainer(),
|
||||
instancingPolicy: AbilityInstancingPolicy.PerEntity,
|
||||
abilityTriggerData: AbilityTriggerData.ForEvent<WeaponEventPayload>(WeaponStartedFlyingEventTag),
|
||||
behaviorFactory: () => new ClosureBehavior<WeaponEventPayload>((ctx, payload) =>
|
||||
{
|
||||
GD.Print("This is applying the periodic effect to the flying weapon");
|
||||
GD.Print(payload.Message);
|
||||
_flyingWeaponEffectHandle = EffectsManager.ApplyEffect(new Effect(flyingWeaponEffectData, new EffectOwnership(this, this)));
|
||||
}));
|
||||
Abilities.GrantAbilityPermanently(weaponHandToFlyingAbilityData, 1, LevelComparison.None, this);
|
||||
behaviorFactory: () => new FlyingSwordBehavior(this, flyingWeaponEffectData));
|
||||
_weaponFlyingAbility = Abilities.GrantAbilityPermanently(weaponHandToFlyingAbilityData, 1, LevelComparison.None, this);
|
||||
}
|
||||
|
||||
private AbilityHandle _weaponFlyingAbility;
|
||||
|
||||
public void GrantNewAbilityForWeaponFly(RExplodingSword ability)
|
||||
{
|
||||
var weaponFlyingAbilityData = new AbilityData(
|
||||
|
||||
Reference in New Issue
Block a user