Add healing effect resource and integrate into game systems
This commit is contained in:
@@ -18,6 +18,7 @@ public class EffectFactory
|
||||
DamageEffectResource damage => new DamageEffect(damage.Amount),
|
||||
HitscanEffectResource hitscan => new HitscanEffect(hitscan.Range),
|
||||
ConsumeAmmoCostResource consumeAmmo => new ConsumeAmmoCost(consumeAmmo.AmmoId, consumeAmmo.Amount),
|
||||
HealEffectResource heal => new HealEffect(heal.Amount),
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(resource),
|
||||
$"Effect type {resource.GetType().Name} not recognized")
|
||||
};
|
||||
|
||||
@@ -84,6 +84,7 @@ public partial class GamePresenter : Node
|
||||
_world.RegisterSystem(new ProjectileSystem());
|
||||
_world.RegisterSystem(new ProjectileInitializationSystem(_world));
|
||||
|
||||
_world.RegisterSystem(new HealingSystem(_world));
|
||||
_world.RegisterSystem(new DamageSystem(_world));
|
||||
_world.RegisterSystem(new ProjectileCleanupSystem());
|
||||
_world.RegisterSystem(new DestructionSystem());
|
||||
|
||||
9
Code/Resources/HealEffectResource.cs
Normal file
9
Code/Resources/HealEffectResource.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using Godot;
|
||||
|
||||
namespace CryptonymThunder.Code.Resources;
|
||||
|
||||
[GlobalClass]
|
||||
public partial class HealEffectResource : EffectResource
|
||||
{
|
||||
[Export(PropertyHint.Range, "1,1000,1")] public float Amount { get; set; } = 10f;
|
||||
}
|
||||
1
Code/Resources/HealEffectResource.cs.uid
Normal file
1
Code/Resources/HealEffectResource.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dh30an2xwhfgu
|
||||
@@ -42,7 +42,9 @@ public class GodotWorldQuery(GamePresenter ownerNode) : IWorldQuery
|
||||
return new HitResult
|
||||
{
|
||||
DidHit = true,
|
||||
HitEntity = hitEntity
|
||||
HitEntity = hitEntity,
|
||||
Position = result["position"].AsVector3().ToGameCore(),
|
||||
Normal = result["normal"].AsVector3().ToGameCore()
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
[gd_resource type="Resource" script_class="PickupComponentResource" load_steps=4 format=3 uid="uid://cpw3nyfu40vyo"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cg8upylcrj8le" path="res://Code/Resources/PickupComponentResource.cs" id="1_2ktm0"]
|
||||
[ext_resource type="Script" uid="uid://btv24gsw1p850" path="res://Code/Resources/Effects/DamageEffectResource.cs" id="1_3n6l8"]
|
||||
[ext_resource type="Script" uid="uid://dh30an2xwhfgu" path="res://Code/Resources/HealEffectResource.cs" id="1_3n6l8"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_qa1ki"]
|
||||
script = ExtResource("1_3n6l8")
|
||||
Amount = -25.0
|
||||
metadata/_custom_type_script = "uid://btv24gsw1p850"
|
||||
metadata/_custom_type_script = "uid://dh30an2xwhfgu"
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_2ktm0")
|
||||
|
||||
Reference in New Issue
Block a user