made the initial inventory loadout into a resource to initialize the injected dependency with

This commit is contained in:
2026-04-26 17:38:25 +02:00
parent 319cbf722e
commit cd7a230615
11 changed files with 331 additions and 247 deletions

View File

@@ -89,61 +89,61 @@ jobs:
# name: Test Report # name: Test Report
# path: ${{ github.workspace }}/reports/test-result.html # path: ${{ github.workspace }}/reports/test-result.html
# #
OtherTest: # OtherTest:
runs-on: godot # runs-on: godot
env: # env:
RUNNER_TOOL_CACHE: /toolcache # Runner Tool Cache # RUNNER_TOOL_CACHE: /toolcache # Runner Tool Cache
steps: # steps:
- name: Checkout with LFS # - name: Checkout with LFS
uses: https://git.game-dev.space/minimata/checkout-with-lfs.git@main # uses: https://git.game-dev.space/minimata/checkout-with-lfs.git@main
#
- uses: actions/setup-dotnet@v5 # - uses: actions/setup-dotnet@v5
name: 💽 Setup .NET SDK # name: 💽 Setup .NET SDK
with: # with:
dotnet-version: '9.0.x' # dotnet-version: '9.0.x'
#
- name: 📦 Restore Dependencies # - name: 📦 Restore Dependencies
run: | # run: |
dotnet --version # dotnet --version
dotnet restore # dotnet restore
dotnet build # dotnet build
dotnet list package # dotnet list package
#
- uses: chickensoft-games/setup-godot@v2 # - uses: chickensoft-games/setup-godot@v2
name: 🤖 Setup Godot # name: 🤖 Setup Godot
with: # with:
# Version must include major, minor, and patch, and be >= 4.0.0 # # Version must include major, minor, and patch, and be >= 4.0.0
# Pre-release label is optional. # # Pre-release label is optional.
version: '4.6.2' # version: '4.6.2'
# Use .NET-enabled version of Godot (the default is also true). # # Use .NET-enabled version of Godot (the default is also true).
use-dotnet: true # use-dotnet: true
# Include the Godot Export Templates (the default is false). # # Include the Godot Export Templates (the default is false).
include-templates: true # include-templates: true
#
- name: 🔬 Verify Setup # - name: 🔬 Verify Setup
run: | # run: |
dotnet --version # dotnet --version
godot --version # godot --version
#
- name: 🧑‍🔬 Generate .NET Bindings # - name: 🧑‍🔬 Generate .NET Bindings
run: godot --headless --build-solutions --import --quit || exit 0 # run: godot --headless --build-solutions --import --quit || exit 0
#
- name: 🦺 Build Projects # - name: 🦺 Build Projects
run: dotnet build --configuration ExportRelease # run: dotnet build --configuration ExportRelease
#
- name: Run C# Tests # - name: Run C# Tests
env: # env:
GODOT_BIN: /root/bin/godot # GODOT_BIN: /root/bin/godot
shell: bash # shell: bash
run: | # run: |
dotnet test --no-build --settings .runsettings --results-directory ./reports --logger "console;verbosity=normal" --logger "trx;LogFileName=results.xml" -- GdUnit4.Parameters="--headless --import --quit" # dotnet test --no-build --settings .runsettings --results-directory ./reports --logger "console;verbosity=normal" --logger "trx;LogFileName=results.xml" -- GdUnit4.Parameters="--headless --import --quit"
#
- name: Upload test report # - name: Upload test report
uses: actions/upload-artifact@v3-node20 # uses: actions/upload-artifact@v3-node20
if: always() # if: always()
with: # with:
name: Test Report # name: Test Report
path: ${{ github.workspace }}/reports/test-result.html # path: ${{ github.workspace }}/reports/test-result.html
Export: Export:
runs-on: godot runs-on: godot

View File

@@ -1,36 +1,40 @@
using System.Collections.Generic; using System.Collections.Generic;
using Chickensoft.AutoInject;
using Chickensoft.Introspection;
using Gamesmiths.Forge.Godot.Resources.Abilities; using Gamesmiths.Forge.Godot.Resources.Abilities;
using Godot; using Godot;
using Movementtests.systems; using Movementtests.systems;
namespace Movementtests.managers; namespace Movementtests.managers;
public partial class WeaponEventAbilityData(WeaponSystem.WeaponEvent forEvent, Resource ability) public partial class WeaponEventAbilityData(WeaponSystem.WeaponEvent forEvent, ForgeAbilityBehavior ability)
: RefCounted : RefCounted
{ {
public WeaponSystem.WeaponEvent ForEvent { get; private set; } = forEvent; public WeaponSystem.WeaponEvent ForEvent { get; private set; } = forEvent;
public Resource Ability { get; private set; } = ability; public ForgeAbilityBehavior Ability { get; private set; } = ability;
} }
[GlobalClass]
public partial class InventoryManager : Node public partial class InventoryManager : Node
{ {
[Signal] #region Signals
public delegate void InventoryChangedEventHandler();
[Signal]
public delegate void WeaponEventInventoryChangedEventHandler();
[Signal] [Signal]
public delegate void WeaponEventAbilityAddedEventHandler(WeaponEventAbilityData data); public delegate void WeaponEventAbilityAddedEventHandler(WeaponEventAbilityData data);
[Signal] [Signal]
public delegate void WeaponEventAbilityRemovedEventHandler(WeaponEventAbilityData data); public delegate void WeaponEventAbilityRemovedEventHandler(WeaponEventAbilityData data);
public Dictionary<WeaponSystem.WeaponEvent, HashSet<Resource>> WeaponEventsInventory { get; } = []; #endregion
public override void _Ready() public Dictionary<WeaponSystem.WeaponEvent, HashSet<ForgeAbilityBehavior>> WeaponEventsInventory { get;
private set;
} = [];
public void InitializeFromResource(WeaponInventory inventory)
{ {
WeaponEventsInventory[WeaponSystem.WeaponEvent.FlyingTick] = new HashSet<Resource>(); WeaponEventsInventory[WeaponSystem.WeaponEvent.FlyingTick] = new HashSet<ForgeAbilityBehavior>(inventory.OnWeaponFlyingTickAbilities);
WeaponEventsInventory[WeaponSystem.WeaponEvent.StartedFlying] = new HashSet<Resource>(); WeaponEventsInventory[WeaponSystem.WeaponEvent.StartedFlying] = new HashSet<ForgeAbilityBehavior>(inventory.OnWeaponStartedFlyingAbilities);
WeaponEventsInventory[WeaponSystem.WeaponEvent.StoppedFlying] = new HashSet<Resource>(); WeaponEventsInventory[WeaponSystem.WeaponEvent.StoppedFlying] = new HashSet<ForgeAbilityBehavior>(inventory.OnWeaponStoppedFlyingAbilities);
} }
public void AddAbilityForWeaponEvent(WeaponSystem.WeaponEvent forEvent, ForgeAbilityBehavior abilityBehavior) public void AddAbilityForWeaponEvent(WeaponSystem.WeaponEvent forEvent, ForgeAbilityBehavior abilityBehavior)
@@ -39,7 +43,6 @@ public partial class InventoryManager : Node
var addedAbilityToInventory = inventoryForEvent.Add(abilityBehavior); var addedAbilityToInventory = inventoryForEvent.Add(abilityBehavior);
if (!addedAbilityToInventory) return; if (!addedAbilityToInventory) return;
EmitSignalWeaponEventInventoryChanged();
EmitSignalWeaponEventAbilityAdded(new WeaponEventAbilityData(forEvent, abilityBehavior)); EmitSignalWeaponEventAbilityAdded(new WeaponEventAbilityData(forEvent, abilityBehavior));
} }
@@ -49,7 +52,6 @@ public partial class InventoryManager : Node
var removedFromInventory = inventoryForEvent.Remove(abilityBehavior); var removedFromInventory = inventoryForEvent.Remove(abilityBehavior);
if (!removedFromInventory) return; if (!removedFromInventory) return;
EmitSignalWeaponEventInventoryChanged();
EmitSignalWeaponEventAbilityRemoved(new WeaponEventAbilityData(forEvent, abilityBehavior)); EmitSignalWeaponEventAbilityRemoved(new WeaponEventAbilityData(forEvent, abilityBehavior));
} }
} }

View File

@@ -0,0 +1,22 @@
using System.Collections.Generic;
using Gamesmiths.Forge.Godot.Resources.Abilities;
using Godot;
namespace Movementtests.managers;
[GlobalClass]
public partial class WeaponInventory(
ForgeAbilityBehavior[] onWeaponStartedFlyingAbilities,
ForgeAbilityBehavior[] onWeaponFlyingTickAbilities,
ForgeAbilityBehavior[] onWeaponStoppedFlyingAbilities
) : Resource
{
[Export]
public ForgeAbilityBehavior[] OnWeaponStartedFlyingAbilities { get; set; } = onWeaponStartedFlyingAbilities;
[Export]
public ForgeAbilityBehavior[] OnWeaponFlyingTickAbilities { get; set; } = onWeaponFlyingTickAbilities;
[Export]
public ForgeAbilityBehavior[] OnWeaponStoppedFlyingAbilities { get; set; } = onWeaponStoppedFlyingAbilities;
public WeaponInventory() : this([], [], []) {}
}

View File

@@ -0,0 +1 @@
uid://cgaahnfgxcrr6

View File

@@ -13,33 +13,36 @@ using Movementtests.systems;
public partial class MainSceneTemplate : Node3D, IProvide<InventoryManager> public partial class MainSceneTemplate : Node3D, IProvide<InventoryManager>
{ {
public override void _Notification(int what) => this.Notify(what); public override void _Notification(int what) => this.Notify(what);
[Node("PlayerFellRespawn")] private Marker3D? PlayerRespawnMarker { get; set; }
private AnimationPlayer? _animationPlayer;
private Node3D? _respawnabble;
private Area3D? _playerFellPlane; #region Nodes
private Area3D? _deathPlane;
[Node("PlayerFellRespawn")] public required Marker3D PlayerRespawnMarker { get; set; }
[Node("AnimationPlayer")] public required AnimationPlayer AnimationPlayer { get; set; }
[Node("PlayerFellTP")] public required Area3D PlayerFellPlane { get; set; }
[Node("DeathPlane")] public required Area3D DeathPlane { get; set; }
#endregion
private Node3D? Respawnabble { get; set; }
#region Exports
[Export] public WeaponInventory? InitialWeaponInventory { get; set; }
#endregion
public required InventoryManager InventoryManager { get; set; } public required InventoryManager InventoryManager { get; set; }
InventoryManager IProvide<InventoryManager>.Value() => InventoryManager; InventoryManager IProvide<InventoryManager>.Value() => InventoryManager;
public void OnReady() public void OnReady()
{ {
_animationPlayer = GetNode<AnimationPlayer>("AnimationPlayer"); PlayerFellPlane.BodyEntered += StartResetPlayerAnimation;
DeathPlane.BodyEntered += KillEnemy;
_playerFellPlane = GetNode<Area3D>("PlayerFellTP");
_deathPlane = GetNode<Area3D>("DeathPlane");
if (PlayerRespawnMarker == null) throw new Exception("Player respawn marker is null");
if (_animationPlayer == null) throw new Exception("Animation player is null");
if (_playerFellPlane == null) throw new Exception("Player reset plane is null");
if (_deathPlane == null) throw new Exception("Enemy death plane is null");
_playerFellPlane.BodyEntered += StartResetPlayerAnimation;
_deathPlane.BodyEntered += KillEnemy;
InventoryManager = new InventoryManager(); InventoryManager = new InventoryManager();
if (InitialWeaponInventory != null)
InventoryManager.InitializeFromResource(InitialWeaponInventory);
AddChild(InventoryManager); AddChild(InventoryManager);
this.Provide(); this.Provide();
} }
@@ -53,8 +56,8 @@ public partial class MainSceneTemplate : Node3D, IProvide<InventoryManager>
public void ResetPlayerPosition() public void ResetPlayerPosition()
{ {
if (_respawnabble == null || PlayerRespawnMarker == null) throw new Exception("Player or respawn marker is null"); if (Respawnabble == null || PlayerRespawnMarker == null) throw new Exception("Player or respawn marker is null");
_respawnabble.GlobalPosition = PlayerRespawnMarker.GlobalPosition; Respawnabble.GlobalPosition = PlayerRespawnMarker.GlobalPosition;
} }
public void StartResetPlayerAnimation(Node3D body) public void StartResetPlayerAnimation(Node3D body)
@@ -66,23 +69,19 @@ public partial class MainSceneTemplate : Node3D, IProvide<InventoryManager>
weapon.SetLinearVelocity(Vector3.Down); weapon.SetLinearVelocity(Vector3.Down);
return; return;
} }
_respawnabble = body as PlayerController; Respawnabble = body as PlayerController;
if (_respawnabble == null || _animationPlayer == null) throw new Exception("Player or anim player is null"); if (Respawnabble == null || AnimationPlayer == null) throw new Exception("Player or anim player is null");
_animationPlayer.Play("player_fell"); AnimationPlayer.Play("player_fell");
} }
public void KillEnemy(Node3D body) public void KillEnemy(Node3D body)
{ {
if (body is not IKillable killable) if (body is not (IKillable killable and IHealthable healthable))
{
body.QueueFree();
return;
}
if (killable is not IHealthable healthable)
{ {
body.QueueFree(); body.QueueFree();
return; return;
} }
killable.Kill(healthable); killable.Kill(healthable);
} }
} }

View File

@@ -64,7 +64,7 @@ size = Vector3(5, 2.25, 3.75)
size = Vector3(5.5, 4.5, 2) size = Vector3(5.5, 4.5, 2)
[sub_resource type="BoxShape3D" id="BoxShape3D_prjj8"] [sub_resource type="BoxShape3D" id="BoxShape3D_prjj8"]
size = Vector3(2, 3.25, 5.25) size = Vector3(2, 3.25, 4)
[sub_resource type="BoxShape3D" id="BoxShape3D_trte5"] [sub_resource type="BoxShape3D" id="BoxShape3D_trte5"]
size = Vector3(6.75, 8.25, 7.25) size = Vector3(6.75, 8.25, 7.25)
@@ -420,7 +420,7 @@ input_related_text = "at enemy"
tuto_text = "dash through" tuto_text = "dash through"
[node name="CollisionShape3D" type="CollisionShape3D" parent="Tutorial/Triggers/TutoTrigger6" index="1" unique_id=1214410006] [node name="CollisionShape3D" type="CollisionShape3D" parent="Tutorial/Triggers/TutoTrigger6" index="1" unique_id=1214410006]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.625, 1.75, -0.75) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.625, 1.75, -0.125)
shape = SubResource("BoxShape3D_prjj8") shape = SubResource("BoxShape3D_prjj8")
[node name="TutoTrigger7" parent="Tutorial/Triggers" index="5" unique_id=271532103 instance=ExtResource("10_vqwwk")] [node name="TutoTrigger7" parent="Tutorial/Triggers" index="5" unique_id=271532103 instance=ExtResource("10_vqwwk")]
@@ -616,15 +616,15 @@ size = Vector3(7.25, 7.75, 2)
material = ExtResource("3_4m8g1") material = ExtResource("3_4m8g1")
[node name="CSGBox3D124" type="CSGBox3D" parent="Tutorial/DashWithMantle" index="26" unique_id=1068505352] [node name="CSGBox3D124" type="CSGBox3D" parent="Tutorial/DashWithMantle" index="26" unique_id=1068505352]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 10.5, 19.487345, 11.25) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 10.5, 19.237345, 11.25)
use_collision = true use_collision = true
size = Vector3(3, 5, 8.5) size = Vector3(3, 4.5, 8.5)
material = ExtResource("3_4m8g1") material = ExtResource("3_4m8g1")
[node name="CSGBox3D129" type="CSGBox3D" parent="Tutorial/DashWithMantle" index="27" unique_id=302301078] [node name="CSGBox3D129" type="CSGBox3D" parent="Tutorial/DashWithMantle" index="27" unique_id=302301078]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 7.25, 19.487345, 38.625) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 7.25, 19.487345, 38)
use_collision = true use_collision = true
size = Vector3(9.5, 5, 11.75) size = Vector3(9.5, 5, 13)
material = ExtResource("3_4m8g1") material = ExtResource("3_4m8g1")
[node name="CSGBox3D133" type="CSGBox3D" parent="Tutorial/DashWithMantle" index="28" unique_id=672467040] [node name="CSGBox3D133" type="CSGBox3D" parent="Tutorial/DashWithMantle" index="28" unique_id=672467040]
@@ -775,5 +775,9 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.5, 1.5, 0)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.5, 25, 4) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.5, 25, 4)
[node name="OmniLight3D2" type="OmniLight3D" parent="." index="14" unique_id=2016820716] [node name="OmniLight3D2" type="OmniLight3D" parent="." index="14" unique_id=2016820716]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.5, 25, -9.5) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.5, 25, -10)
omni_range = 12.0
[node name="OmniLight3D3" type="OmniLight3D" parent="." index="15" unique_id=845858088]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.5, 25, -25.5)
omni_range = 12.0 omni_range = 12.0

View File

@@ -1,8 +1,10 @@
[gd_scene format=3 uid="uid://ndnor8g7kq07"] [gd_scene format=3 uid="uid://ndnor8g7kq07"]
[ext_resource type="PackedScene" uid="uid://55wehh6xombr" path="res://maps/_templates/main_scene_template.tscn" id="1_k7f42"] [ext_resource type="PackedScene" uid="uid://55wehh6xombr" path="res://maps/_templates/main_scene_template.tscn" id="1_k7f42"]
[ext_resource type="Resource" uid="uid://ifeavnlps7hy" path="res://scenes/player_controller/resources/forge/exploding_sword.tres" id="2_ctafv"]
[ext_resource type="PackedScene" uid="uid://y77cdg7gg3y7" path="res://maps/levels/_arenas/playtest_1.tscn" id="2_kutfq"] [ext_resource type="PackedScene" uid="uid://y77cdg7gg3y7" path="res://maps/levels/_arenas/playtest_1.tscn" id="2_kutfq"]
[ext_resource type="Material" uid="uid://31aulub2nqov" path="res://assets/materials/greybox/m_greybox.tres" id="3_1qo78"] [ext_resource type="Material" uid="uid://31aulub2nqov" path="res://assets/materials/greybox/m_greybox.tres" id="3_1qo78"]
[ext_resource type="Script" uid="uid://cgaahnfgxcrr6" path="res://managers/WeaponInventory.cs" id="3_nix1q"]
[ext_resource type="PackedScene" uid="uid://c305mfrtumcyq" path="res://scenes/spawners/spawner.tscn" id="4_jaqjx"] [ext_resource type="PackedScene" uid="uid://c305mfrtumcyq" path="res://scenes/spawners/spawner.tscn" id="4_jaqjx"]
[ext_resource type="PackedScene" uid="uid://dxt0e2ugmttqq" path="res://scenes/enemies/grounded_enemy/grounded_enemy.tscn" id="5_iq67o"] [ext_resource type="PackedScene" uid="uid://dxt0e2ugmttqq" path="res://scenes/enemies/grounded_enemy/grounded_enemy.tscn" id="5_iq67o"]
[ext_resource type="Resource" uid="uid://bqq6uukbdfysr" path="res://scenes/enemies/grounded_enemy/grounded_enemy_movement.tres" id="6_l44fp"] [ext_resource type="Resource" uid="uid://bqq6uukbdfysr" path="res://scenes/enemies/grounded_enemy/grounded_enemy_movement.tres" id="6_l44fp"]
@@ -15,10 +17,18 @@
[ext_resource type="PackedScene" uid="uid://qup00a7x2sji" path="res://scenes/fixed_dash_target/fixed_dashthrough_target.tscn" id="13_iq67o"] [ext_resource type="PackedScene" uid="uid://qup00a7x2sji" path="res://scenes/fixed_dash_target/fixed_dashthrough_target.tscn" id="13_iq67o"]
[ext_resource type="PackedScene" uid="uid://b8aet6m4m2i83" path="res://scenes/tuto_trigger/TutoTrigger.tscn" id="14_lthgu"] [ext_resource type="PackedScene" uid="uid://b8aet6m4m2i83" path="res://scenes/tuto_trigger/TutoTrigger.tscn" id="14_lthgu"]
[sub_resource type="Resource" id="Resource_udq24"]
script = ExtResource("3_nix1q")
OnWeaponStartedFlyingAbilities = Array[Object]([ExtResource("2_ctafv")])
OnWeaponFlyingTickAbilities = Array[Object]([ExtResource("2_ctafv")])
OnWeaponStoppedFlyingAbilities = Array[Object]([ExtResource("2_ctafv")])
metadata/_custom_type_script = "uid://cgaahnfgxcrr6"
[sub_resource type="BoxShape3D" id="BoxShape3D_lthgu"] [sub_resource type="BoxShape3D" id="BoxShape3D_lthgu"]
size = Vector3(7.5, 3.75, 10.25) size = Vector3(7.5, 3.75, 10.25)
[node name="Main" unique_id=955321579 instance=ExtResource("1_k7f42")] [node name="Main" unique_id=955321579 instance=ExtResource("1_k7f42")]
InitialWeaponInventory = SubResource("Resource_udq24")
[node name="PlaytestArena" parent="." index="6" unique_id=664535670 instance=ExtResource("2_kutfq")] [node name="PlaytestArena" parent="." index="6" unique_id=664535670 instance=ExtResource("2_kutfq")]

View File

@@ -1,82 +1,92 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Chickensoft.AutoInject;
using Chickensoft.Introspection;
using Gamesmiths.Forge.Godot.Resources.Abilities; using Gamesmiths.Forge.Godot.Resources.Abilities;
using Godot; using Godot;
using Movementtests.systems; using Movementtests.systems;
[Tool, GlobalClass] [Tool, GlobalClass, Meta(typeof(IAutoConnect))]
public partial class AbilitySelection : Control public partial class AbilitySelection : Control
{ {
public override void _Notification(int what) => this.Notify(what);
#region Signals
[Signal] public delegate void AbilityAddedEventHandler(WeaponSystem.WeaponEvent forEvent, ForgeAbilityBehavior behavior); [Signal] public delegate void AbilityAddedEventHandler(WeaponSystem.WeaponEvent forEvent, ForgeAbilityBehavior behavior);
[Signal] public delegate void AbilityRemovedEventHandler(WeaponSystem.WeaponEvent forEvent, ForgeAbilityBehavior behavior); [Signal] public delegate void AbilityRemovedEventHandler(WeaponSystem.WeaponEvent forEvent, ForgeAbilityBehavior behavior);
#endregion
#region Exports
[Export] public WeaponSystem.WeaponEvent ForEvent { get; set; } = WeaponSystem.WeaponEvent.StartedFlying; [Export] public WeaponSystem.WeaponEvent ForEvent { get; set; } = WeaponSystem.WeaponEvent.StartedFlying;
[Export] public string Title { get; set; } = string.Empty; [Export] public string Title { get; set; } = string.Empty;
[Export] public PackedScene? AbilitySelectedItem { get; set; }
[Export] public PackedScene AbilitySelectedItem { get; set; } [Export] public ForgeAbilityBehavior[] AbilityBehaviors { get; set; } = [];
[Export] public ForgeAbilityBehavior[] AbilityBehaviors { get; set; }
private VBoxContainer _selectedAbilities; #endregion
private MenuButton _addAbility;
private PopupMenu _addAbilityMenu; #region Nodes
[Node("%SelectedAbilities")] public required VBoxContainer SelectedAbilities { get; set; }
[Node("%AddAbility")] public required MenuButton AddAbility { get; set; }
public required PopupMenu AddAbilityMenu { get; set; }
#endregion
public override void _Ready() public void OnReady()
{ {
// Initialize title (also in Editor as Tool)
var titleLabel = GetNode<Label>("%TitleLabel"); var titleLabel = GetNode<Label>("%TitleLabel");
titleLabel.Text = Title; titleLabel.Text = Title;
_selectedAbilities = GetNode<VBoxContainer>("%SelectedAbilities"); AddAbilityMenu = AddAbility.GetPopup();
_addAbility = GetNode<MenuButton>("%AddAbility");
_addAbilityMenu = _addAbility.GetPopup();
if (Engine.IsEditorHint()) return; if (Engine.IsEditorHint()) return; // Editor flow stops here
var i = 0; var i = 0;
foreach (var behavior in AbilityBehaviors) foreach (var behavior in AbilityBehaviors)
{ {
_addAbilityMenu.AddIconItem(behavior.Icon, behavior.Name); AddAbilityMenu.AddIconItem(behavior.Icon, behavior.Name);
_addAbilityMenu.SetItemMetadata(i, behavior); AddAbilityMenu.SetItemMetadata(i, behavior);
i += 1; i += 1;
} }
_addAbilityMenu.IndexPressed += AddAbilityMenuOnIndexPressed; AddAbilityMenu.IndexPressed += AddAbilityMenuOnIndexPressed;
} }
public void Initialize(IEnumerable<Resource> equippedAbilities) public void Initialize(IEnumerable<ForgeAbilityBehavior> equippedAbilities)
{ {
foreach (var equippedAbility in equippedAbilities) foreach (var equippedAbility in equippedAbilities)
{ {
if (equippedAbility is not ForgeAbilityBehavior ability) continue; AddSelectedAbility(equippedAbility);
AddSelectedAbility(ability);
} }
} }
private void AddAbilityMenuOnIndexPressed(long index) private void AddAbilityMenuOnIndexPressed(long index)
{ {
var indexInt = Convert.ToInt32(index); var indexInt = Convert.ToInt32(index);
var metadata = (ForgeAbilityBehavior) _addAbilityMenu.GetItemMetadata(indexInt); var metadata = (ForgeAbilityBehavior) AddAbilityMenu.GetItemMetadata(indexInt);
EmitSignalAbilityAdded(ForEvent, metadata); EmitSignalAbilityAdded(ForEvent, metadata);
} }
public void AddSelectedAbility(ForgeAbilityBehavior behavior) public void AddSelectedAbility(ForgeAbilityBehavior behavior)
{ {
var newSelectedAbilityItem = AbilitySelectedItem.Instantiate() as SelectedAbility; if (AbilitySelectedItem?.Instantiate() is not SelectedAbility newSelectedAbilityItem) return;
if (newSelectedAbilityItem == null) return;
newSelectedAbilityItem.SetAbility(behavior); newSelectedAbilityItem.SetAbility(behavior);
newSelectedAbilityItem.AbilityRemoved += ability => EmitSignalAbilityRemoved(ForEvent, ability); newSelectedAbilityItem.AbilityRemoved += ability => EmitSignalAbilityRemoved(ForEvent, ability);
_selectedAbilities.AddChild(newSelectedAbilityItem); SelectedAbilities.AddChild(newSelectedAbilityItem);
} }
public void RemoveSelectedAbility(ForgeAbilityBehavior behavior) public void RemoveSelectedAbility(ForgeAbilityBehavior behavior)
{ {
foreach (var child in _selectedAbilities.GetChildren()) foreach (var child in SelectedAbilities.GetChildren())
{ {
if (child is not SelectedAbility selectedAbility || selectedAbility.Ability != behavior) continue; if (child is not SelectedAbility selectedAbility || selectedAbility.Ability != behavior) continue;
_selectedAbilities.RemoveChild(selectedAbility); SelectedAbilities.RemoveChild(selectedAbility);
_addAbility.GrabFocus(); AddAbility.GrabFocus();
return; return;
} }
} }

View File

@@ -66,18 +66,14 @@ public partial class InventoryUi : Control
public void OnWeaponEventInventoryAdded(WeaponEventAbilityData data) public void OnWeaponEventInventoryAdded(WeaponEventAbilityData data)
{ {
if (data.Ability is not ForgeAbilityBehavior abilityBehavior) return;
var selection = GetAbilitySelection(data.ForEvent); var selection = GetAbilitySelection(data.ForEvent);
selection.AddSelectedAbility(abilityBehavior); selection.AddSelectedAbility(data.Ability);
} }
public void OnWeaponEventInventoryRemoved(WeaponEventAbilityData data) public void OnWeaponEventInventoryRemoved(WeaponEventAbilityData data)
{ {
if (data.Ability is not ForgeAbilityBehavior abilityBehavior) return;
var selection = GetAbilitySelection(data.ForEvent); var selection = GetAbilitySelection(data.ForEvent);
selection.RemoveSelectedAbility(abilityBehavior); selection.RemoveSelectedAbility(data.Ability);
} }
public AbilitySelection GetAbilitySelection(WeaponSystem.WeaponEvent forEvent) public AbilitySelection GetAbilitySelection(WeaponSystem.WeaponEvent forEvent)

View File

@@ -33,54 +33,32 @@ namespace Movementtests.systems;
[GlobalClass, Icon("res://assets/ui/IconGodotNode/node_3D/icon_sword.png")] [GlobalClass, Icon("res://assets/ui/IconGodotNode/node_3D/icon_sword.png")]
public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
{ {
#region Enums
public enum WeaponEvent
{
StartedFlying,
StoppedFlying,
FlyingTick
}
#endregion
#region Signals
[Signal] [Signal]
public delegate void WeaponThrownEventHandler(); public delegate void WeaponThrownEventHandler();
[Signal] [Signal]
public delegate void WeaponRetrievedEventHandler(); public delegate void WeaponRetrievedEventHandler();
[Export]
public ForgeTagContainer BaseTags { get; set; }
[Export] public ForgeAbilityData FlyingTickAbility { get; set; }
[Export]
public RDamage RDamage { get; set; }
[Export(PropertyHint.Range, "0,2,0.01,or_greater")]
public float ThrowForce { get; set; } = 1f;
[Export(PropertyHint.Range, "0,0.2,0.01,or_greater")]
public float StraightThrowDuration { get; set; } = 0.1f;
public EntityAttributes Attributes { get; set; } = null!;
public EntityTags Tags { get; set; } = null!;
public EffectsManager EffectsManager { get; set; } = null!;
public EntityAbilities Abilities { get; set; } = null!;
public EventManager Events { get; set; } = null!;
public Variables SharedVariables { get; }
private StateChart _weaponState = null!; #endregion
public StateChartState InHandState = null!;
public StateChartState FlyingState = null!;
public StateChartState PlantedState = null!;
private Transition _handToFlying = null!;
private Transition _flyingToHand = null!;
private Transition _plantedToHand = null!;
private Transition _plantedToFlying = null!;
private Transition _toPlanted = null!;
private ShapeCast3D _dashCast3D = null!; #region Forge
public Timer WeaponFlyingTick = null!;
private Transform3D _startTransform;
private Vector3 _startMeshRotation;
private Vector3 _throwDirection; private Dictionary<ForgeAbilityBehavior, ActiveEffectHandle> _grantedWeaponStartedFlyingAbilities = new ();
public Vector3 PlantLocation { get; set; } private Dictionary<ForgeAbilityBehavior, ActiveEffectHandle> _grantedWeaponStoppedFlyingAbilities = new ();
public Vector3 PlantNormal { get; set; } private Dictionary<ForgeAbilityBehavior, ActiveEffectHandle> _grantedWeaponFlyingTickAbilities = new ();
public Node? PlantObject { get; set; }
public MeshInstance3D WeaponLocationIndicator { get; set; } = null!;
public StandardMaterial3D WeaponLocationIndicatorMaterial { get; set; } = null!;
public MeshInstance3D WeaponMesh { get; set; } = null!;
public Tag WeaponFlyingTickEventTag; public Tag WeaponFlyingTickEventTag;
public Tag WeaponStartedFlyingEventTag; public Tag WeaponStartedFlyingEventTag;
@@ -99,6 +77,66 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
private AbilityHandle? _weaponFlyingAbility; private AbilityHandle? _weaponFlyingAbility;
#endregion
#region Inspector
[Export]
public ForgeTagContainer BaseTags { get; set; }
[Export] public ForgeAbilityData FlyingTickAbility { get; set; }
[Export]
public RDamage RDamage { get; set; }
[Export(PropertyHint.Range, "0,2,0.01,or_greater")]
public float ThrowForce { get; set; } = 1f;
[Export(PropertyHint.Range, "0,0.2,0.01,or_greater")]
public float StraightThrowDuration { get; set; } = 0.1f;
#endregion
#region Publics
public EntityAttributes Attributes { get; set; } = null!;
public EntityTags Tags { get; set; } = null!;
public EffectsManager EffectsManager { get; set; } = null!;
public EntityAbilities Abilities { get; set; } = null!;
public EventManager Events { get; set; } = null!;
public Variables SharedVariables { get; }
public StateChartState InHandState = null!;
public StateChartState FlyingState = null!;
public StateChartState PlantedState = null!;
public Timer WeaponFlyingTick = null!;
public Vector3 PlantLocation { get; set; }
public Vector3 PlantNormal { get; set; }
public Node? PlantObject { get; set; }
public MeshInstance3D WeaponLocationIndicator { get; set; } = null!;
public StandardMaterial3D WeaponLocationIndicatorMaterial { get; set; } = null!;
public MeshInstance3D WeaponMesh { get; set; } = null!;
#endregion
#region Privates
private StateChart _weaponState = null!;
private Transition _handToFlying = null!;
private Transition _flyingToHand = null!;
private Transition _plantedToHand = null!;
private Transition _plantedToFlying = null!;
private Transition _toPlanted = null!;
private ShapeCast3D _dashCast3D = null!;
private Transform3D _startTransform;
private Vector3 _startMeshRotation;
private Vector3 _throwDirection;
#endregion
public void Init() public void Init()
{ {
_weaponState = StateChart.Of(GetNode("StateChart")); _weaponState = StateChart.Of(GetNode("StateChart"));
@@ -163,7 +201,6 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
Abilities = new(this); Abilities = new(this);
Events = new(); Events = new();
// TODO: Waiting on bug resolve
_weaponFlyingAbility = Abilities.GrantAbilityPermanently(FlyingTickAbility.GetAbilityData(), 1, LevelComparison.None, this); _weaponFlyingAbility = Abilities.GrantAbilityPermanently(FlyingTickAbility.GetAbilityData(), 1, LevelComparison.None, this);
BodyEntered += OnThrownWeaponReachesGround; BodyEntered += OnThrownWeaponReachesGround;
@@ -171,6 +208,8 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
InHandState.StateExited += WeaponLeft; InHandState.StateExited += WeaponLeft;
InHandState.StateEntered += WeaponBack; InHandState.StateEntered += WeaponBack;
#region EventRaising
_handToFlying.Taken += () => _handToFlying.Taken += () =>
{ {
Events.Raise(new EventData Events.Raise(new EventData
@@ -237,24 +276,14 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
}); });
}; };
#endregion
Events.Subscribe(WeaponStoppedFlyingEventTag, _ => { _weaponFlyingAbility.Cancel(); }); Events.Subscribe(WeaponStoppedFlyingEventTag, _ => { _weaponFlyingAbility.Cancel(); });
} }
private Dictionary<ForgeAbilityBehavior, ActiveEffectHandle> _grantedWeaponStartedFlyingAbilities = new ();
private Dictionary<ForgeAbilityBehavior, ActiveEffectHandle> _grantedWeaponStoppedFlyingAbilities = new ();
private Dictionary<ForgeAbilityBehavior, ActiveEffectHandle> _grantedWeaponFlyingTickAbilities = new ();
public enum WeaponEvent
{
StartedFlying,
StoppedFlying,
FlyingTick
}
public void GrantNewAbilityForEvent(WeaponEvent forEvent, ForgeAbilityBehavior abilityBehavior) public void GrantNewAbilityForEvent(WeaponEvent forEvent, ForgeAbilityBehavior abilityBehavior)
{ {
var relevantMap = GetGrantedAbilities(forEvent); var relevantMap = GetGrantedAbilities(forEvent);
GD.Print($"Granted {abilityBehavior} for {forEvent}");
if (relevantMap.ContainsKey(abilityBehavior)) return; if (relevantMap.ContainsKey(abilityBehavior)) return;
var eventTagsMap = new Dictionary<WeaponEvent, Tag> var eventTagsMap = new Dictionary<WeaponEvent, Tag>
@@ -296,6 +325,19 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
relevantMap.Remove(abilityBehavior); relevantMap.Remove(abilityBehavior);
} }
public void RemoveAllEventAbilities()
{
foreach (var weaponEvent in Enum.GetValues<WeaponEvent>())
{
var abilities = GetGrantedAbilities(weaponEvent);
foreach (var ability in abilities.Values)
{
EffectsManager.RemoveEffect(ability);
}
abilities.Clear();
}
}
public Dictionary<ForgeAbilityBehavior, ActiveEffectHandle> GetGrantedAbilities(WeaponEvent forEvent) public Dictionary<ForgeAbilityBehavior, ActiveEffectHandle> GetGrantedAbilities(WeaponEvent forEvent)
{ {
var abilitiesMap = new Dictionary<WeaponEvent, Dictionary<ForgeAbilityBehavior, ActiveEffectHandle>> var abilitiesMap = new Dictionary<WeaponEvent, Dictionary<ForgeAbilityBehavior, ActiveEffectHandle>>

View File

@@ -48,19 +48,13 @@ public partial class PlayerController : CharacterBody3D,
{ {
public override void _Notification(int what) => this.Notify(what); public override void _Notification(int what) => this.Notify(what);
#region Dependencies
[Dependency] [Dependency]
public InventoryManager InventoryManager => this.DependOn<InventoryManager>(); public InventoryManager InventoryManager => this.DependOn<InventoryManager>();
#endregion
// Enums
public enum AllowedInputs #region Enums
{
All,
MoveCamera,
None,
}
private bool _isUsingGamepad;
public AllowedInputs CurrentlyAllowedInputs { get; set; } = AllowedInputs.All;
public enum BufferedActions public enum BufferedActions
{ {
None, None,
@@ -69,22 +63,22 @@ public partial class PlayerController : CharacterBody3D,
Dash, Dash,
MantleDash MantleDash
} }
private BufferedActions _bufferedAction = BufferedActions.None;
#endregion
///////////////////////////
// Signals and events // #region Signals
///////////////////////////
[Signal] [Signal]
public delegate void PlayerDiedEventHandler(); public delegate void PlayerDiedEventHandler();
public event Action<IDamageable, DamageRecord> DamageTaken = null!; public event Action<IDamageable, DamageRecord> DamageTaken = null!;
public event Action<IHealthable, HealthChangedRecord> HealthChanged = null!; public event Action<IHealthable, HealthChangedRecord> HealthChanged = null!;
public event Action<IHealthable> HealthDepleted = null!; public event Action<IHealthable> HealthDepleted = null!;
/////////////////////////// #endregion
// Public stuff //
/////////////////////////// #region Publics
public HeadSystem HeadSystem = null!; public HeadSystem HeadSystem = null!;
public StairsSystem StairsSystem = null!; public StairsSystem StairsSystem = null!;
public MantleSystem MantleSystem = null!; public MantleSystem MantleSystem = null!;
@@ -114,7 +108,9 @@ public partial class PlayerController : CharacterBody3D,
public EventManager Events { get; set; } = null!; public EventManager Events { get; set; } = null!;
public Variables SharedVariables { get; } public Variables SharedVariables { get; }
// Inspector stuff #endregion
#region Inspector
[Export] public bool HasSword { get; set; } = true; [Export] public bool HasSword { get; set; } = true;
[Export] public bool HasParry { get; set; } = true; [Export] public bool HasParry { get; set; } = true;
@@ -306,10 +302,10 @@ public partial class PlayerController : CharacterBody3D,
public float WallRunAltitudeLossSpeed { get; set; } = 10f; public float WallRunAltitudeLossSpeed { get; set; } = 10f;
[Export(PropertyHint.Range, "0,20,0.1,or_greater")] [Export(PropertyHint.Range, "0,20,0.1,or_greater")]
public float WallRunSpeedThreshold { get; set; } = 8f; public float WallRunSpeedThreshold { get; set; } = 8f;
#endregion
#region Privates
///////////////////////////
// Private stuff //
///////////////////////////
// Stairs and shit // Stairs and shit
private float _lastFrameWasOnFloor = -Mathf.Inf; private float _lastFrameWasOnFloor = -Mathf.Inf;
private const int NumOfHeadCollisionDetectors = 4; private const int NumOfHeadCollisionDetectors = 4;
@@ -317,7 +313,8 @@ public partial class PlayerController : CharacterBody3D,
private AudioStreamPlaybackInteractive _audioStream = null!; private AudioStreamPlaybackInteractive _audioStream = null!;
// Basic movement // Basic movement
private bool _movementEnabled = true; private bool _isUsingGamepad;
private BufferedActions _bufferedAction = BufferedActions.None;
private Vector3 _inputMove = Vector3.Zero; private Vector3 _inputMove = Vector3.Zero;
private Vector3 _inputMoveKeyboard = Vector3.Zero; private Vector3 _inputMoveKeyboard = Vector3.Zero;
private float _inputRotateY; private float _inputRotateY;
@@ -434,22 +431,21 @@ public partial class PlayerController : CharacterBody3D,
private AbilityHandle? _empoweredActionHandle; private AbilityHandle? _empoweredActionHandle;
#endregion
public void OnReady() public void OnReady()
{ {
LoadSettings(); LoadSettings();
///////////////////////////
// Getting components /////
///////////////////////////
// General use stuff // General use stuff
PlayerUi = GetNode<PlayerUi>("UI"); PlayerUi = GetNode<PlayerUi>("UI");
_closeEnemyDetector = GetNode<ShapeCast3D>("%CloseEnemyDetector"); _closeEnemyDetector = GetNode<ShapeCast3D>("%CloseEnemyDetector");
_closeEnemyDetector.TargetPosition = _closeEnemyDetector.TargetPosition.Normalized() * TargetingDistance; _closeEnemyDetector.TargetPosition = _closeEnemyDetector.TargetPosition.Normalized() * TargetingDistance;
_aimAssisRayCast = GetNode<RayCast3D>("AimAssistRayCast"); _aimAssisRayCast = GetNode<RayCast3D>("AimAssistRayCast");
_aimAssisRayCast.TargetPosition = _aimAssisRayCast.TargetPosition.Normalized() * (TargetingDistance*1.5f); _aimAssisRayCast.TargetPosition = _aimAssisRayCast.TargetPosition.Normalized() * (TargetingDistance*1.5f);
#region Forge
// Forge stuff
var tagsManager = ForgeManagers.Instance.TagsManager; var tagsManager = ForgeManagers.Instance.TagsManager;
var cuesManager = ForgeManagers.Instance.CuesManager; var cuesManager = ForgeManagers.Instance.CuesManager;
@@ -500,6 +496,7 @@ public partial class PlayerController : CharacterBody3D,
EffectsManager.ApplyEffect(new Effect(effect.GetEffectData(), new EffectOwnership(this, this))); EffectsManager.ApplyEffect(new Effect(effect.GetEffectData(), new EffectOwnership(this, this)));
}); });
} }
#endregion
// DashIndicator = GetNode<TextureRect>("%DashIndicator"); // DashIndicator = GetNode<TextureRect>("%DashIndicator");
TargetSpeed = WalkSpeed; TargetSpeed = WalkSpeed;
@@ -567,8 +564,9 @@ public partial class PlayerController : CharacterBody3D,
CDamageable.DamageTaken += (_, record) => RegisterKnockback(new KnockbackRecord(record)); CDamageable.DamageTaken += (_, record) => RegisterKnockback(new KnockbackRecord(record));
CHealth.HealthChanged += PlayerUi.OnHealthChanged; CHealth.HealthChanged += PlayerUi.OnHealthChanged;
CHealth.HealthDepleted += (_) => Kill(); CHealth.HealthDepleted += (_) => Kill();
#region StateManagement
// State management
_playerState = StateChart.Of(GetNode("StateChart")); _playerState = StateChart.Of(GetNode("StateChart"));
_aiming = StateChartState.Of(GetNode("StateChart/Root/Aim/On")); _aiming = StateChartState.Of(GetNode("StateChart/Root/Aim/On"));
@@ -617,6 +615,7 @@ public partial class PlayerController : CharacterBody3D,
_airborneDashCooldownTimer = GetNode<Timer>("AirborneDashCooldown"); _airborneDashCooldownTimer = GetNode<Timer>("AirborneDashCooldown");
_invincibilityTimer = GetNode<Timer>("InvincibilityTime"); _invincibilityTimer = GetNode<Timer>("InvincibilityTime");
_attackCooldown = GetNode<Timer>("AttackCooldown"); _attackCooldown = GetNode<Timer>("AttackCooldown");
#endregion
/////////////////////////// ///////////////////////////
// Initialize components // // Initialize components //
@@ -642,10 +641,9 @@ public partial class PlayerController : CharacterBody3D,
// PlaceWeaponForTutorial(); // PlaceWeaponForTutorial();
HeadSystem.SetWeaponsVisible(HasSword, HasParry); HeadSystem.SetWeaponsVisible(HasSword, HasParry);
#region SignalBinding
///////////////////////////
// Signal setup ///////////
///////////////////////////
_invincibilityTimer.Timeout += ResetInvincibility; _invincibilityTimer.Timeout += ResetInvincibility;
_attackCooldown.Timeout += ResetAttackCooldown; _attackCooldown.Timeout += ResetAttackCooldown;
@@ -723,6 +721,8 @@ public partial class PlayerController : CharacterBody3D,
_attackDash.StateEntered += OnDashAttackStarted; _attackDash.StateEntered += OnDashAttackStarted;
_parryStandard.StateEntered += OnStandardParryStarted; _parryStandard.StateEntered += OnStandardParryStarted;
_parryDash.StateEntered += OnDashParryStarted; _parryDash.StateEntered += OnDashParryStarted;
#endregion
// Forge events // Forge events
var weaponLeftToken = WeaponSystem.Events.Subscribe(WeaponSystem.WeaponStartedFlyingEventTag, OnWeaponLeft); var weaponLeftToken = WeaponSystem.Events.Subscribe(WeaponSystem.WeaponStartedFlyingEventTag, OnWeaponLeft);
@@ -731,14 +731,28 @@ public partial class PlayerController : CharacterBody3D,
public void OnResolved() public void OnResolved()
{ {
// All of my dependencies are now available! Do whatever you want with // Initialize weapon with inventory abilities
// them here. WeaponSystem.RemoveAllEventAbilities();
foreach (var (weaponEvent, abilities) in InventoryManager.WeaponEventsInventory)
{
foreach (var ability in abilities)
{
if (ability is not ForgeAbilityBehavior abilityBehavior) continue;
WeaponSystem.GrantNewAbilityForEvent(weaponEvent, abilityBehavior);
}
}
// Inventory Management // Inventory changes signal binding
InventoryManager.WeaponEventAbilityAdded += OnWeaponEventAbilityAdded; InventoryManager.WeaponEventAbilityAdded += OnWeaponEventAbilityAdded;
InventoryManager.WeaponEventAbilityRemoved += OnWeaponEventAbilityRemoved; InventoryManager.WeaponEventAbilityRemoved += OnWeaponEventAbilityRemoved;
} }
public void OnExitTree()
{
InventoryManager.WeaponEventAbilityAdded -= OnWeaponEventAbilityAdded;
InventoryManager.WeaponEventAbilityRemoved -= OnWeaponEventAbilityRemoved;
}
public void OnWeaponLeft(EventData data) public void OnWeaponLeft(EventData data)
{ {
var target = data.Target; var target = data.Target;
@@ -768,33 +782,17 @@ public partial class PlayerController : CharacterBody3D,
public void OnWeaponEventAbilityAdded(WeaponEventAbilityData data) public void OnWeaponEventAbilityAdded(WeaponEventAbilityData data)
{ {
if (data.Ability is not ForgeAbilityBehavior abilityBehavior) return; WeaponSystem.GrantNewAbilityForEvent(data.ForEvent, data.Ability);
WeaponSystem.GrantNewAbilityForEvent(data.ForEvent, abilityBehavior);
} }
public void OnWeaponEventAbilityRemoved(WeaponEventAbilityData data) public void OnWeaponEventAbilityRemoved(WeaponEventAbilityData data)
{ {
if (data.Ability is not ForgeAbilityBehavior abilityBehavior) return; WeaponSystem.RemoveAbilityForEvent(data.ForEvent, data.Ability);
WeaponSystem.RemoveAbilityForEvent(data.ForEvent, abilityBehavior);
} }
/////////////////////////// ///////////////////////////
// Settings & tutorial // // Settings & tutorial //
/////////////////////////// ///////////////////////////
public void SetAllowedInputsAll()
{
CurrentlyAllowedInputs = AllowedInputs.All;
}
public void SetAllowedInputsMoveCamera()
{
CurrentlyAllowedInputs = AllowedInputs.MoveCamera;
}
public void SetAllowedInputsNone()
{
CurrentlyAllowedInputs = AllowedInputs.None;
}
public void LoadSettings() public void LoadSettings()
{ {
var config = new ConfigFile(); var config = new ConfigFile();