More weapon events and abilities

This commit is contained in:
2026-05-06 11:05:55 +02:00
parent 1db30eafd9
commit bcc748ca6b
14 changed files with 455 additions and 190 deletions

View File

@@ -1,6 +1,7 @@
using System.Collections.Generic;
using Gamesmiths.Forge.Godot.Resources.Abilities;
using Godot;
using Movementtests.systems;
namespace Movementtests.managers;
@@ -8,15 +9,41 @@ namespace Movementtests.managers;
public partial class WeaponInventory(
ForgeAbilityBehavior[] onWeaponStartedFlyingAbilities,
ForgeAbilityBehavior[] onWeaponFlyingTickAbilities,
ForgeAbilityBehavior[] onWeaponStoppedFlyingAbilities
ForgeAbilityBehavior[] onWeaponStoppedFlyingAbilities,
ForgeAbilityBehavior[] onWeaponStartedPlantedAbilities,
ForgeAbilityBehavior[] onWeaponPlantedTickAbilities,
ForgeAbilityBehavior[] onWeaponStoppedPlantedAbilities
) : Resource
{
[ExportGroup("Flying abilities")]
[Export]
public ForgeAbilityBehavior[] OnWeaponStartedFlyingAbilities { get; set; } = onWeaponStartedFlyingAbilities;
[Export]
public ForgeAbilityBehavior[] OnWeaponFlyingTickAbilities { get; set; } = onWeaponFlyingTickAbilities;
[Export]
public ForgeAbilityBehavior[] OnWeaponStoppedFlyingAbilities { get; set; } = onWeaponStoppedFlyingAbilities;
[ExportGroup("Planted abilities")]
[Export]
public ForgeAbilityBehavior[] OnWeaponStartedPlantedAbilities { get; set; } = onWeaponStartedPlantedAbilities;
[Export]
public ForgeAbilityBehavior[] OnWeaponPlantedTickAbilities { get; set; } = onWeaponPlantedTickAbilities;
[Export]
public ForgeAbilityBehavior[] OnWeaponStoppedPlantedAbilities { get; set; } = onWeaponStoppedPlantedAbilities;
public WeaponInventory() : this([], [], []) {}
public Dictionary<WeaponSystem.WeaponEvent, ForgeAbilityBehavior[]> EventMap { get; private set; } = [];
public WeaponInventory() : this([], [], [], [], [], [])
{
EventMap = new Dictionary<WeaponSystem.WeaponEvent, ForgeAbilityBehavior[]>
{
{ WeaponSystem.WeaponEvent.StartedFlying, OnWeaponStartedFlyingAbilities },
{ WeaponSystem.WeaponEvent.StoppedFlying, OnWeaponStoppedFlyingAbilities },
{ WeaponSystem.WeaponEvent.FlyingTick, OnWeaponFlyingTickAbilities },
{ WeaponSystem.WeaponEvent.StartedPlanted, OnWeaponStartedPlantedAbilities },
{ WeaponSystem.WeaponEvent.StoppedPlanted, OnWeaponStoppedPlantedAbilities },
{ WeaponSystem.WeaponEvent.PlantedTick, OnWeaponPlantedTickAbilities },
};
}
}