empowered action as a forge ability

This commit is contained in:
2026-03-11 15:56:17 +01:00
parent 14d29d68bb
commit b15a4fef95
8 changed files with 94 additions and 66 deletions

View File

@@ -3,14 +3,10 @@ using System;
using Movementtests.interfaces;
[GlobalClass, Icon("res://assets/ui/IconGodotNode/white/icon_heart.png")]
public partial class RHealth : Resource
public partial class RHealth(float startingHealth) : Resource
{
[Export]
public float StartingHealth { get; set;}
public float StartingHealth { get; set;} = startingHealth;
public RHealth() : this(100.0f) {}
public RHealth(float startingHealth)
{
StartingHealth = startingHealth;
}
}

View File

@@ -17,6 +17,7 @@
[ext_resource type="Resource" uid="uid://t612lts1wi1s" path="res://inputs/base_mode/move_right.tres" id="6_q7bng"]
[ext_resource type="Script" uid="uid://cwbvxlfvmocc1" path="res://scenes/player_controller/scripts/StairsSystem.cs" id="7_bmt5a"]
[ext_resource type="Resource" uid="uid://brswsknpgwal2" path="res://inputs/base_mode/move_front.tres" id="7_m8gvy"]
[ext_resource type="Resource" uid="uid://7dpkk5rk3di5" path="res://scenes/player_controller/resources/forge_empowered_action.tres" id="7_qheee"]
[ext_resource type="PackedScene" uid="uid://bctpe34ddamg5" path="res://scenes/components/knockback/CKnockback.tscn" id="7_x835q"]
[ext_resource type="Resource" uid="uid://s1l0n1iitc6m" path="res://inputs/base_mode/move_back.tres" id="8_jb43f"]
[ext_resource type="Resource" uid="uid://j1o5ud0plk4" path="res://inputs/base_mode/aim_release.tres" id="8_lhb11"]
@@ -162,6 +163,7 @@ MinimumWallRunUpwardSpeed = 4.0
MinimumWallRunHorizontalSpeed = 8.0
WallRunAltitudeLossSpeed = 8.0
WallRunSpeedThreshold = 1.0
EmpoweredAction = ExtResource("7_qheee")
[node name="CHealth" parent="." unique_id=1244478698 instance=ExtResource("3_q7bng")]
RHealth = ExtResource("4_m8gvy")

View File

@@ -0,0 +1,9 @@
[gd_resource type="Resource" script_class="REmpoweredAction" format=3 uid="uid://7dpkk5rk3di5"]
[ext_resource type="Script" uid="uid://d0l07gcx1ef18" path="res://forge/abilities/REmpoweredAction.cs" id="1_1rxoq"]
[resource]
script = ExtResource("1_1rxoq")
Cost = 50.0
Cooldown = 1.0
metadata/_custom_type_script = "uid://d0l07gcx1ef18"

View File

@@ -409,6 +409,8 @@ public partial class PlayerController : CharacterBody3D,
private AbilityHandle? _empoweredActionHandle;
[Export] public REmpoweredAction EmpoweredAction = null!;
public override void _Ready()
{
LoadSettings();
@@ -439,11 +441,10 @@ public partial class PlayerController : CharacterBody3D,
Abilities = new(this);
Events = new();
var empoweredAction = new EmpoweredAction(forgeManager.TagsManager);
var empoweredActionData = new AbilityData(
name: "Empowered Action",
costEffect: empoweredAction.EmpoweredActionCostEffect,
cooldownEffects: [empoweredAction.EmpoweredActionCooldown],
costEffect: EmpoweredAction.CostEffect(),
cooldownEffects: [EmpoweredAction.CooldownEffect(forgeManager.TagsManager)],
instancingPolicy: AbilityInstancingPolicy.PerEntity,
behaviorFactory: () => new EmpoweredActionBehavior());