Compare commits

..

10 Commits

Author SHA1 Message Date
dc81796d52 fixed cue issue and setup proper waves
Some checks failed
Create tag and build when new code gets to main / BumpTag (push) Successful in 26s
Create tag and build when new code gets to main / Export (push) Has been cancelled
2026-05-16 20:56:20 +02:00
2103832e46 all spawners available can be used on first wave tick 2026-05-16 19:56:07 +02:00
1898d91a28 wave behavior and fixed explosion 2026-05-16 19:48:48 +02:00
b3ae3e37ea fixed weapon loss bug 2026-05-16 13:19:01 +02:00
4cd67023d9 token manager for projectile 2026-05-16 01:29:02 +02:00
afa335e7bf stunnable targets on hit 2026-05-15 15:29:24 +02:00
a0e99a959f parrying projectiles
All checks were successful
Create tag and build when new code gets to main / BumpTag (push) Successful in 28s
Create tag and build when new code gets to main / Export (push) Successful in 6m44s
2026-05-14 16:11:22 +02:00
0cd942d90e homing projectiles 2026-05-10 12:26:43 +02:00
150e007b22 basic projectiles
All checks were successful
Create tag and build when new code gets to main / BumpTag (push) Successful in 26s
Create tag and build when new code gets to main / Export (push) Successful in 5m9s
2026-05-07 14:53:30 +02:00
01a2e7582b enemy grant hit ability + prep projectiles 2026-05-06 19:55:05 +02:00
74 changed files with 2004 additions and 181 deletions

View File

@@ -3,19 +3,21 @@
importer="texture" importer="texture"
type="CompressedTexture2D" type="CompressedTexture2D"
uid="uid://bun38n3ff5wvv" uid="uid://bun38n3ff5wvv"
path="res://.godot/imported/keyboard_shift_icon_outline.svg-21854f9aeab065c26ab9185b7d09e5f2.ctex" path.s3tc="res://.godot/imported/keyboard_shift_icon_outline.svg-21854f9aeab065c26ab9185b7d09e5f2.s3tc.ctex"
path.etc2="res://.godot/imported/keyboard_shift_icon_outline.svg-21854f9aeab065c26ab9185b7d09e5f2.etc2.ctex"
metadata={ metadata={
"vram_texture": false "imported_formats": ["s3tc_bptc", "etc2_astc"],
"vram_texture": true
} }
[deps] [deps]
source_file="res://assets/ui/input-prompts/Keyboard & Mouse/Vector/keyboard_shift_icon_outline.svg" source_file="res://assets/ui/input-prompts/Keyboard & Mouse/Vector/keyboard_shift_icon_outline.svg"
dest_files=["res://.godot/imported/keyboard_shift_icon_outline.svg-21854f9aeab065c26ab9185b7d09e5f2.ctex"] dest_files=["res://.godot/imported/keyboard_shift_icon_outline.svg-21854f9aeab065c26ab9185b7d09e5f2.s3tc.ctex", "res://.godot/imported/keyboard_shift_icon_outline.svg-21854f9aeab065c26ab9185b7d09e5f2.etc2.ctex"]
[params] [params]
compress/mode=0 compress/mode=2
compress/high_quality=false compress/high_quality=false
compress/lossy_quality=0.7 compress/lossy_quality=0.7
compress/uastc_level=0 compress/uastc_level=0
@@ -23,7 +25,7 @@ compress/rdo_quality_loss=0.0
compress/hdr_compression=1 compress/hdr_compression=1
compress/normal_map=0 compress/normal_map=0
compress/channel_pack=0 compress/channel_pack=0
mipmaps/generate=false mipmaps/generate=true
mipmaps/limit=-1 mipmaps/limit=-1
roughness/mode=0 roughness/mode=0
roughness/src_normal="" roughness/src_normal=""
@@ -37,7 +39,7 @@ process/normal_map_invert_y=false
process/hdr_as_srgb=false process/hdr_as_srgb=false
process/hdr_clamp_exposure=false process/hdr_clamp_exposure=false
process/size_limit=0 process/size_limit=0
detect_3d/compress_to=1 detect_3d/compress_to=0
svg/scale=1.0 svg/scale=1.0
editor/scale_with_editor_scale=false editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false editor/convert_colors_with_editor_theme=false

View File

@@ -44,6 +44,10 @@ public partial class ForgeEntityNode : Node3D, IForgeEntity
public required Variables SharedVariables { get; set; } public required Variables SharedVariables { get; set; }
public void OnReady() public void OnReady()
{
}
public void OnResolved()
{ {
BaseTags ??= new ForgeTagContainer(); BaseTags ??= new ForgeTagContainer();
Tags = new EntityTags(BaseTags.GetTagContainer()); Tags = new EntityTags(BaseTags.GetTagContainer());
@@ -53,10 +57,7 @@ public partial class ForgeEntityNode : Node3D, IForgeEntity
SharedVariables = new Variables(); SharedVariables = new Variables();
SharedVariableDefinitions?.PopulateVariables(SharedVariables); SharedVariableDefinitions?.PopulateVariables(SharedVariables);
}
public void OnResolved()
{
EffectsManager = new EffectsManager(this, CuesManager); EffectsManager = new EffectsManager(this, CuesManager);
var effectApplier = new EffectApplier(this); var effectApplier = new EffectApplier(this);
effectApplier.ApplyEffects(this, this, this); effectApplier.ApplyEffects(this, this, this);

View File

@@ -6,18 +6,21 @@ using Godot;
namespace Movementtests.forge.abilities; namespace Movementtests.forge.abilities;
public class ManualCancelHitBehavior(ForgeEffectData? damage) : IAbilityBehavior public class ManualCancelHitBehavior(ForgeEffectData[] effects) : IAbilityBehavior
{ {
public void OnStarted(AbilityBehaviorContext context) public void OnStarted(AbilityBehaviorContext context)
{ {
if (context.Target == null || damage == null) return; if (context.Target == null) return;
var sourceLocation = (context.Source as Node3D)?.GlobalPosition ?? Vector3.Zero; var sourceLocation = (context.Source as Node3D)?.GlobalPosition ?? Vector3.Zero;
var targetLocation = (context.Target as Node3D)?.GlobalPosition ?? Vector3.Zero; var targetLocation = (context.Target as Node3D)?.GlobalPosition ?? Vector3.Zero;
var magnitude = context.Magnitude == 0 ? 1 : context.Magnitude; var magnitude = context.Magnitude == 0 ? 1 : context.Magnitude;
var effect = new Effect(damage.GetEffectData(), new EffectOwnership(context.Owner, context.Owner));
context.Target.EffectsManager.ApplyEffect(effect, new SimpleHitEffectData(sourceLocation, targetLocation, magnitude)); foreach (var effectData in effects)
{
var effect = new Effect(effectData.GetEffectData(), new EffectOwnership(context.Owner, context.Owner));
context.Target.EffectsManager.ApplyEffect(effect, new SimpleHitEffectData(sourceLocation, targetLocation, magnitude));
}
} }
public void OnEnded(AbilityBehaviorContext context) public void OnEnded(AbilityBehaviorContext context)
@@ -30,6 +33,6 @@ public class ManualCancelHitBehavior(ForgeEffectData? damage) : IAbilityBehavior
[GlobalClass] [GlobalClass]
public partial class ForgeManualCancelHitBehavior : ForgeAbilityBehavior public partial class ForgeManualCancelHitBehavior : ForgeAbilityBehavior
{ {
[Export] public ForgeEffectData? DamageEffect { get; set; } [Export] public ForgeEffectData[] OnHitEffects { get; set; } = [];
public override IAbilityBehavior GetBehavior() => new ManualCancelHitBehavior(DamageEffect); public override IAbilityBehavior GetBehavior() => new ManualCancelHitBehavior(OnHitEffects);
} }

View File

@@ -0,0 +1,60 @@
using Gamesmiths.Forge.Abilities;
using Gamesmiths.Forge.Core;
using Gamesmiths.Forge.Effects;
using Gamesmiths.Forge.Godot.Resources;
using Gamesmiths.Forge.Godot.Resources.Abilities;
using Godot;
using Movementtests.interfaces;
using Movementtests.managers;
using Movementtests.tools;
namespace Movementtests.forge.abilities;
public record OnProjectileSpawned(Vector3 Direction, float SpeedMultiplier, Vector3? SpawnOffset = null, uint? CollisionOverride = null, TokenManager.Token? Token = null);
public class SpawnProjectileBehavior(PackedScene projectileScene) : IAbilityBehavior<OnProjectileSpawned>
{
public void OnStarted(AbilityBehaviorContext context, OnProjectileSpawned data)
{
if (context.Source is not Node3D source || projectileScene.Instantiate() is not Projectile projectile)
{
context.InstanceHandle.End();
return;
}
source.GetTree().GetCurrentScene().AddChild(projectile);
// Computing projectile properties
var offset = data.SpawnOffset ?? Vector3.Zero;
var startPos = source is ITargetable targetable ? targetable.GetTargetGlobalPosition() : source.GlobalPosition;
var target = context.Target as Node3D;
var magnitude = context.Magnitude != 0 ? context.Magnitude : 1;
var impulse = data.Direction * data.SpeedMultiplier * magnitude;
var collisionOverride = data.CollisionOverride ?? projectile.CollisionMask;
// Setting up projectile
projectile.GlobalPosition = startPos + offset;
projectile.Target = target;
projectile.ImpulseDirection = impulse;
projectile.CollisionMask = collisionOverride;
projectile.Token = data.Token;
if (projectile is ISpawnable spawnable) spawnable.Init();
context.AbilityHandle.CommitAbility();
context.InstanceHandle.End();
}
public void OnEnded(AbilityBehaviorContext context)
{
}
}
[Tool]
[GlobalClass]
public partial class ForgeSpawnProjectileBehavior : ForgeAbilityBehavior
{
[Export] public required PackedScene Projectile { get; set; }
public override IAbilityBehavior GetBehavior() => new SpawnProjectileBehavior(Projectile);
}

View File

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

View File

@@ -30,6 +30,7 @@ public class DamageExecution : CustomExecution
public DamageExecution(DamageType damageType, ForgeTagContainer? damageDealerEventTags, ForgeTagContainer? damageReceiverEventTags) public DamageExecution(DamageType damageType, ForgeTagContainer? damageDealerEventTags, ForgeTagContainer? damageReceiverEventTags)
{ {
// Capture target mana and magic resistance // Capture target mana and magic resistance
TargetHealth = new AttributeCaptureDefinition( TargetHealth = new AttributeCaptureDefinition(
"CharacterAttributeSet.Health", "CharacterAttributeSet.Health",
@@ -60,6 +61,8 @@ public class DamageExecution : CustomExecution
target, target,
effectEvaluatedData); effectEvaluatedData);
GD.Print(targetIncomingDamage);
if (targetIncomingDamage <= 0) if (targetIncomingDamage <= 0)
{ {
return [.. results]; return [.. results];
@@ -70,6 +73,7 @@ public class DamageExecution : CustomExecution
targetIncomingDamage *= hitEffectData.Magnitude; targetIncomingDamage *= hitEffectData.Magnitude;
} }
// Apply health reduction to target if attribute exists // Apply health reduction to target if attribute exists
if (TargetHealth.TryGetAttribute(target, out EntityAttribute? targetHealthAttribute)) if (TargetHealth.TryGetAttribute(target, out EntityAttribute? targetHealthAttribute))
{ {

View File

@@ -18,16 +18,18 @@ public record KnockbackDone(float KnockbackValue, Vector3 knockbackDirection);
public class KnockbackExecution : CustomExecution public class KnockbackExecution : CustomExecution
{ {
private readonly RKnockback _knockback; private readonly RKnockback _knockback;
private readonly ForgeTag _knockbackTag; private readonly ForgeTag _knockbackableTag;
private readonly ForgeTag _knockbackImmuneTag;
private readonly ForgeTagContainer? _knockbackReceiverEventTags; private readonly ForgeTagContainer? _knockbackReceiverEventTags;
private readonly ForgeTagContainer? _knockbackDealerEventTags; private readonly ForgeTagContainer? _knockbackDealerEventTags;
public AttributeCaptureDefinition TargetIncomingDamage { get; } public AttributeCaptureDefinition TargetIncomingDamage { get; }
public KnockbackExecution(ForgeTag knockbackTag, RKnockback knockback, ForgeTagContainer? knockbackDealerEventTags, ForgeTagContainer? knockbackReceiverEventTags) public KnockbackExecution(ForgeTag knockbackableTag, ForgeTag knockbackImmuneTag, RKnockback knockback, ForgeTagContainer? knockbackDealerEventTags, ForgeTagContainer? knockbackReceiverEventTags)
{ {
_knockback = knockback; _knockback = knockback;
_knockbackTag = knockbackTag; _knockbackableTag = knockbackableTag;
_knockbackImmuneTag = knockbackImmuneTag;
_knockbackDealerEventTags = knockbackDealerEventTags; _knockbackDealerEventTags = knockbackDealerEventTags;
_knockbackReceiverEventTags = knockbackReceiverEventTags; _knockbackReceiverEventTags = knockbackReceiverEventTags;
@@ -40,7 +42,7 @@ public class KnockbackExecution : CustomExecution
public override ModifierEvaluatedData[] EvaluateExecution(Effect effect, IForgeEntity target, EffectEvaluatedData? effectEvaluatedData) public override ModifierEvaluatedData[] EvaluateExecution(Effect effect, IForgeEntity target, EffectEvaluatedData? effectEvaluatedData)
{ {
var results = new List<ModifierEvaluatedData>(); var results = new List<ModifierEvaluatedData>();
if (!target.Tags.CombinedTags.HasTag(_knockbackTag.GetTag())) if (!target.Tags.CombinedTags.HasTag(_knockbackableTag.GetTag()) || target.Tags.CombinedTags.HasTag(_knockbackImmuneTag.GetTag()))
return [.. results]; return [.. results];
float targetIncomingDamage = CaptureAttributeMagnitude( float targetIncomingDamage = CaptureAttributeMagnitude(
@@ -91,12 +93,13 @@ public class KnockbackExecution : CustomExecution
public partial class ForgeKnockbackExecution : ForgeCustomExecution public partial class ForgeKnockbackExecution : ForgeCustomExecution
{ {
[Export] public ForgeTag? KnockbackableTag { get; set; } [Export] public ForgeTag? KnockbackableTag { get; set; }
[Export] public ForgeTag? KnockbackImmuneTag { get; set; }
[Export] public RKnockback? Knockback { get; set; } [Export] public RKnockback? Knockback { get; set; }
[Export] public ForgeTagContainer? KnockbackDealerEventTags { get; set; } [Export] public ForgeTagContainer? KnockbackDealerEventTags { get; set; }
[Export] public ForgeTagContainer? KnockbackReceiverEventTags { get; set; } [Export] public ForgeTagContainer? KnockbackReceiverEventTags { get; set; }
public override CustomExecution GetExecutionClass() public override CustomExecution GetExecutionClass()
{ {
if (Knockback == null || KnockbackableTag == null) throw new System.ArgumentException("Knockback or KnockbackableTag is null"); if (Knockback == null || KnockbackableTag == null || KnockbackImmuneTag == null) throw new System.ArgumentException("Knockback or KnockbackableTag is null");
return new KnockbackExecution(KnockbackableTag, Knockback, KnockbackDealerEventTags, KnockbackReceiverEventTags); return new KnockbackExecution(KnockbackableTag, KnockbackImmuneTag, Knockback, KnockbackDealerEventTags, KnockbackReceiverEventTags);
} }
} }

View File

@@ -4,4 +4,4 @@
[resource] [resource]
script = ExtResource("1_l686n") script = ExtResource("1_l686n")
RegisteredTags = Array[String](["character.player", "character.enemy", "weapon", "status.stunned", "status.burning", "status.frozen", "abilities.weapon.land", "abilities.weapon.flying", "abilities.weapon.left", "events.combat.damage", "events.combat.hit", "events.weapon.flyingTick", "events.weapon.startedFlying", "events.weapon.stoppedFlying", "events.weapon.handToFlying", "events.weapon.flyingToHand", "events.weapon.plantedToHand", "events.weapon.plantedToFlying", "events.weapon.planted", "cooldown.empoweredAction", "cooldown.empoweredSwordThrow", "cues.resources.mana", "events.player.empowered_action_used", "cues.resources.mana.inhibited", "cues.resources.health", "cooldown.enemy.hit", "events.combat.death", "cooldown.hit", "events.player.hit", "cues.enemy.health", "immunity.damage", "status", "traits.damageable", "traits.knockbackable", "events.combat.knockback_dealt", "events.combat.knockback_received", "events.weapon.plantedtick", "events.weapon.unplanted", "abilities.weapon.planted"]) RegisteredTags = Array[String](["character.player", "character.enemy", "status.stunned", "status.burning", "status.frozen", "abilities.weapon.land", "abilities.weapon.flying", "abilities.weapon.left", "events.combat.damage", "events.combat.hit", "events.weapon.flyingTick", "events.weapon.startedFlying", "events.weapon.stoppedFlying", "events.weapon.handToFlying", "events.weapon.flyingToHand", "events.weapon.plantedToHand", "events.weapon.plantedToFlying", "events.weapon.planted", "cooldown.empoweredAction", "cooldown.empoweredSwordThrow", "cues.resources.mana", "events.player.empowered_action_used", "cues.resources.mana.inhibited", "cues.resources.health", "cooldown.enemy.hit", "events.combat.death", "cooldown.hit", "events.player.hit", "cues.enemy.health", "immunity.damage", "status", "traits.damageable", "traits.knockbackable", "events.combat.knockback_dealt", "events.combat.knockback_received", "events.weapon.plantedtick", "events.weapon.unplanted", "abilities.weapon.planted", "events.enemy.try_hit", "events.enemy.launch_projectile", "objects.projectile", "objects.weapon", "events.enemy.request_projectile", "events.player.parry", "traits.stunnable", "immunity.knockback", "immunity.stun", "events.combat.stun_applied", "events.combat.stun_received"])

View File

@@ -6,6 +6,7 @@
[ext_resource type="Script" uid="uid://cfx62w40nd84v" path="res://forge/calculators/ForgeDamageExecution.cs" id="4_xfamx"] [ext_resource type="Script" uid="uid://cfx62w40nd84v" path="res://forge/calculators/ForgeDamageExecution.cs" id="4_xfamx"]
[ext_resource type="Script" uid="uid://b44cse62qru7j" path="res://scenes/components/knockback/RKnockback.cs" id="5_tw4gc"] [ext_resource type="Script" uid="uid://b44cse62qru7j" path="res://scenes/components/knockback/RKnockback.cs" id="5_tw4gc"]
[ext_resource type="Resource" uid="uid://bhn27s8ne0uyg" path="res://forge/resources/tag_containers/on_knockback_dealt.tres" id="6_nq3a0"] [ext_resource type="Resource" uid="uid://bhn27s8ne0uyg" path="res://forge/resources/tag_containers/on_knockback_dealt.tres" id="6_nq3a0"]
[ext_resource type="Resource" uid="uid://5obdxlcpw8qt" path="res://forge/resources/tag_containers/knockback_immune.tres" id="7_3ma4g"]
[ext_resource type="Resource" uid="uid://bkr6uu57wm3o3" path="res://forge/resources/tag_containers/on_knockback_received.tres" id="7_3utx7"] [ext_resource type="Resource" uid="uid://bkr6uu57wm3o3" path="res://forge/resources/tag_containers/on_knockback_received.tres" id="7_3utx7"]
[ext_resource type="Resource" uid="uid://45l7vnfs72b" path="res://forge/resources/tag_containers/knockbackable_tag.tres" id="8_7hfxb"] [ext_resource type="Resource" uid="uid://45l7vnfs72b" path="res://forge/resources/tag_containers/knockbackable_tag.tres" id="8_7hfxb"]
[ext_resource type="Script" uid="uid://diondfg5xp78h" path="res://forge/calculators/ForgeKnockbackExecution.cs" id="9_lysxe"] [ext_resource type="Script" uid="uid://diondfg5xp78h" path="res://forge/calculators/ForgeKnockbackExecution.cs" id="9_lysxe"]
@@ -32,6 +33,7 @@ metadata/_custom_type_script = "uid://b44cse62qru7j"
[sub_resource type="Resource" id="Resource_dy671"] [sub_resource type="Resource" id="Resource_dy671"]
script = ExtResource("9_lysxe") script = ExtResource("9_lysxe")
KnockbackableTag = ExtResource("8_7hfxb") KnockbackableTag = ExtResource("8_7hfxb")
KnockbackImmuneTag = ExtResource("7_3ma4g")
Knockback = SubResource("Resource_ndb8p") Knockback = SubResource("Resource_ndb8p")
KnockbackDealerEventTags = ExtResource("6_nq3a0") KnockbackDealerEventTags = ExtResource("6_nq3a0")
KnockbackReceiverEventTags = ExtResource("7_3utx7") KnockbackReceiverEventTags = ExtResource("7_3utx7")
@@ -89,7 +91,7 @@ BaseValue = 1
script = ExtResource("13_c85am") script = ExtResource("13_c85am")
Name = "Explosion hit" Name = "Explosion hit"
Modifiers = Array[Object]([SubResource("Resource_xwtie")]) Modifiers = Array[Object]([SubResource("Resource_xwtie")])
Components = Array[Object]([ExtResource("1_w36j6")]) Components = [ExtResource("1_w36j6")]
Executions = Array[Object]([SubResource("Resource_vy8wr"), SubResource("Resource_dy671")]) Executions = Array[Object]([SubResource("Resource_vy8wr"), SubResource("Resource_dy671")])
StackLimit = SubResource("Resource_ikb7l") StackLimit = SubResource("Resource_ikb7l")
InitialStack = SubResource("Resource_i0sj3") InitialStack = SubResource("Resource_i0sj3")

View File

@@ -11,6 +11,7 @@
[ext_resource type="Script" uid="uid://n6efm5o4uxvr" path="res://forge/abilities/ForgeSimpleHitBehavior.cs" id="10_m4f1m"] [ext_resource type="Script" uid="uid://n6efm5o4uxvr" path="res://forge/abilities/ForgeSimpleHitBehavior.cs" id="10_m4f1m"]
[ext_resource type="Script" uid="uid://dngf30hxy5go4" path="res://addons/forge/resources/components/ModifierTags.cs" id="11_8c5sq"] [ext_resource type="Script" uid="uid://dngf30hxy5go4" path="res://addons/forge/resources/components/ModifierTags.cs" id="11_8c5sq"]
[ext_resource type="Script" uid="uid://2gm1hdhi8u08" path="res://addons/forge/resources/magnitudes/ForgeModifierMagnitude.cs" id="12_2x5q6"] [ext_resource type="Script" uid="uid://2gm1hdhi8u08" path="res://addons/forge/resources/magnitudes/ForgeModifierMagnitude.cs" id="12_2x5q6"]
[ext_resource type="Resource" uid="uid://csh8jcxtrs11k" path="res://forge/resources/tag_containers/on_enemy_try_hit.tres" id="12_f6jpb"]
[ext_resource type="Script" uid="uid://dhxfbxh54pyxp" path="res://addons/forge/resources/abilities/ForgeAbilityData.cs" id="13_4nn3y"] [ext_resource type="Script" uid="uid://dhxfbxh54pyxp" path="res://addons/forge/resources/abilities/ForgeAbilityData.cs" id="13_4nn3y"]
[sub_resource type="Resource" id="Resource_rjo6h"] [sub_resource type="Resource" id="Resource_rjo6h"]
@@ -154,5 +155,7 @@ script = ExtResource("13_4nn3y")
Name = "Hit" Name = "Hit"
CooldownEffects = [SubResource("Resource_0gdnn")] CooldownEffects = [SubResource("Resource_0gdnn")]
AbilityBehavior = SubResource("Resource_m0osh") AbilityBehavior = SubResource("Resource_m0osh")
TriggerSource = 1
TriggerTag = ExtResource("12_f6jpb")
ActivationBlockedTags = SubResource("Resource_msmv1") ActivationBlockedTags = SubResource("Resource_msmv1")
metadata/_custom_type_script = "uid://dhxfbxh54pyxp" metadata/_custom_type_script = "uid://dhxfbxh54pyxp"

View File

@@ -0,0 +1,23 @@
[gd_resource type="Resource" script_class="ForgeAbilityData" format=3 uid="uid://ckfbi6lu255ep"]
[ext_resource type="Texture2D" uid="uid://g0u88alm6hcb" path="res://assets/ui/IconGodotNode/node/icon_bullet.png" id="1_hixal"]
[ext_resource type="PackedScene" uid="uid://bhp6qunnwhncf" path="res://scenes/projectile/Projectile.tscn" id="2_ljwqp"]
[ext_resource type="Script" uid="uid://dxtjifb8hv8k4" path="res://forge/abilities/ForgeSpawnProjectileBehavior.cs" id="3_urund"]
[ext_resource type="Resource" uid="uid://bkr1xfokymvp4" path="res://forge/resources/tag_containers/on_enemy_lauch_project.tres" id="4_5yymv"]
[ext_resource type="Script" uid="uid://dhxfbxh54pyxp" path="res://addons/forge/resources/abilities/ForgeAbilityData.cs" id="5_xbj7n"]
[sub_resource type="Resource" id="Resource_idpl5"]
script = ExtResource("3_urund")
Projectile = ExtResource("2_ljwqp")
Name = "Spawn projectile"
Icon = ExtResource("1_hixal")
metadata/_custom_type_script = "uid://dxtjifb8hv8k4"
[resource]
script = ExtResource("5_xbj7n")
Name = "Launch projectile"
CooldownEffects = []
AbilityBehavior = SubResource("Resource_idpl5")
TriggerSource = 1
TriggerTag = ExtResource("4_5yymv")
metadata/_custom_type_script = "uid://dhxfbxh54pyxp"

View File

@@ -6,13 +6,98 @@
[ext_resource type="Script" uid="uid://b83hf13nj37k3" path="res://addons/forge/resources/ForgeEffectData.cs" id="2_5vjbv"] [ext_resource type="Script" uid="uid://b83hf13nj37k3" path="res://addons/forge/resources/ForgeEffectData.cs" id="2_5vjbv"]
[ext_resource type="Script" uid="uid://d1bb1fvh1mnpd" path="res://forge/abilities/ForgeManualCancelHitBehavior.cs" id="2_c4wry"] [ext_resource type="Script" uid="uid://d1bb1fvh1mnpd" path="res://forge/abilities/ForgeManualCancelHitBehavior.cs" id="2_c4wry"]
[ext_resource type="Script" uid="uid://dngf30hxy5go4" path="res://addons/forge/resources/components/ModifierTags.cs" id="2_jwyed"] [ext_resource type="Script" uid="uid://dngf30hxy5go4" path="res://addons/forge/resources/components/ModifierTags.cs" id="2_jwyed"]
[ext_resource type="Resource" uid="uid://vs6kfo2ubhvr" path="res://forge/resources/effect_components/stunnable.tres" id="2_r7waw"]
[ext_resource type="Script" uid="uid://dhxfbxh54pyxp" path="res://addons/forge/resources/abilities/ForgeAbilityData.cs" id="3_w1wo0"] [ext_resource type="Script" uid="uid://dhxfbxh54pyxp" path="res://addons/forge/resources/abilities/ForgeAbilityData.cs" id="3_w1wo0"]
[ext_resource type="Script" uid="uid://cn3b4ya15fg7e" path="res://addons/forge/resources/magnitudes/ForgeScalableFloat.cs" id="4_c4wry"] [ext_resource type="Script" uid="uid://cn3b4ya15fg7e" path="res://addons/forge/resources/magnitudes/ForgeScalableFloat.cs" id="4_c4wry"]
[ext_resource type="Script" uid="uid://2gm1hdhi8u08" path="res://addons/forge/resources/magnitudes/ForgeModifierMagnitude.cs" id="5_0cyim"] [ext_resource type="Script" uid="uid://2gm1hdhi8u08" path="res://addons/forge/resources/magnitudes/ForgeModifierMagnitude.cs" id="5_0cyim"]
[ext_resource type="Script" uid="uid://br7ut4lbau66w" path="res://forge/calculators/ForgeRaiseEventTagExecution.cs" id="7_l5emy"]
[sub_resource type="Resource" id="Resource_h8gc3"]
script = ExtResource("1_w1wo0")
ContainerTags = Array[String](["status.stunned"])
metadata/_custom_type_script = "uid://cw525n4mjqgw0"
[sub_resource type="Resource" id="Resource_vioyh"]
script = ExtResource("2_jwyed")
TagsToAdd = SubResource("Resource_h8gc3")
metadata/_custom_type_script = "uid://dngf30hxy5go4"
[sub_resource type="Resource" id="Resource_m6xnn"]
script = ExtResource("4_c4wry")
BaseValue = 1.0
[sub_resource type="Resource" id="Resource_uinv8"]
script = ExtResource("4_c4wry")
[sub_resource type="Resource" id="Resource_04hqa"]
script = ExtResource("4_c4wry")
[sub_resource type="Resource" id="Resource_8fbeq"]
script = ExtResource("4_c4wry")
BaseValue = 1.0
[sub_resource type="Resource" id="Resource_ees2v"]
script = ExtResource("4_c4wry")
[sub_resource type="Resource" id="Resource_6x2ov"]
script = ExtResource("4_c4wry")
[sub_resource type="Resource" id="Resource_ml8x2"]
script = ExtResource("4_c4wry")
BaseValue = 1.0
metadata/_custom_type_script = "uid://cn3b4ya15fg7e"
[sub_resource type="Resource" id="Resource_1uqo4"]
script = ExtResource("5_0cyim")
ScalableFloat = SubResource("Resource_ml8x2")
Coefficient = SubResource("Resource_8fbeq")
PreMultiplyAdditiveValue = SubResource("Resource_6x2ov")
PostMultiplyAdditiveValue = SubResource("Resource_ees2v")
CalculatorCoefficient = SubResource("Resource_m6xnn")
CalculatorPreMultiplyAdditiveValue = SubResource("Resource_04hqa")
CalculatorPostMultiplyAdditiveValue = SubResource("Resource_uinv8")
metadata/_custom_type_script = "uid://2gm1hdhi8u08"
[sub_resource type="Resource" id="Resource_fyrcc"]
script = ExtResource("1_w1wo0")
ContainerTags = Array[String](["events.combat.stun_applied"])
metadata/_custom_type_script = "uid://cw525n4mjqgw0"
[sub_resource type="Resource" id="Resource_sgtcb"]
script = ExtResource("1_w1wo0")
ContainerTags = Array[String](["events.combat.stun_received"])
metadata/_custom_type_script = "uid://cw525n4mjqgw0"
[sub_resource type="Resource" id="Resource_3p0ly"]
script = ExtResource("7_l5emy")
EventTags = SubResource("Resource_fyrcc")
TargetEventTags = SubResource("Resource_sgtcb")
metadata/_custom_type_script = "uid://br7ut4lbau66w"
[sub_resource type="Resource" id="Resource_ewmvj"]
script = ExtResource("1_l0l1a")
BaseValue = 1
[sub_resource type="Resource" id="Resource_8wvcn"]
script = ExtResource("1_l0l1a")
BaseValue = 1
[sub_resource type="Resource" id="Resource_no8t2"]
script = ExtResource("2_5vjbv")
Name = "Basic stun"
Modifiers = Array[Object]([])
Components = Array[Object]([ExtResource("2_r7waw"), SubResource("Resource_vioyh")])
Executions = [SubResource("Resource_3p0ly")]
DurationType = 2
Duration = SubResource("Resource_1uqo4")
StackLimit = SubResource("Resource_8wvcn")
InitialStack = SubResource("Resource_ewmvj")
Cues = []
metadata/_custom_type_script = "uid://b83hf13nj37k3"
[sub_resource type="Resource" id="Resource_0cyim"] [sub_resource type="Resource" id="Resource_0cyim"]
script = ExtResource("2_c4wry") script = ExtResource("2_c4wry")
DamageEffect = ExtResource("1_c4wry") OnHitEffects = [ExtResource("1_c4wry"), SubResource("Resource_no8t2")]
Name = "Player hit" Name = "Player hit"
metadata/_custom_type_script = "uid://d1bb1fvh1mnpd" metadata/_custom_type_script = "uid://d1bb1fvh1mnpd"

View File

@@ -30,8 +30,8 @@ BaseValue = 1
[sub_resource type="Resource" id="Resource_hgeae"] [sub_resource type="Resource" id="Resource_hgeae"]
script = ExtResource("4_4348y") script = ExtResource("4_4348y")
Name = "Raise Planted Tick Periodically" Name = "Raise Planted Tick Periodically"
Modifiers = null Modifiers = []
Components = null Components = []
Executions = Array[Object]([SubResource("Resource_l3tir")]) Executions = Array[Object]([SubResource("Resource_l3tir")])
DurationType = 1 DurationType = 1
HasPeriodicApplication = true HasPeriodicApplication = true
@@ -39,7 +39,7 @@ Period = SubResource("Resource_cykp3")
ExecuteOnApplication = true ExecuteOnApplication = true
StackLimit = SubResource("Resource_rvogu") StackLimit = SubResource("Resource_rvogu")
InitialStack = SubResource("Resource_yc0gp") InitialStack = SubResource("Resource_yc0gp")
Cues = null Cues = []
metadata/_custom_type_script = "uid://b83hf13nj37k3" metadata/_custom_type_script = "uid://b83hf13nj37k3"
[sub_resource type="Resource" id="Resource_jiqxq"] [sub_resource type="Resource" id="Resource_jiqxq"]

View File

@@ -6,5 +6,5 @@
[resource] [resource]
script = ExtResource("2_f5qgs") script = ExtResource("2_f5qgs")
EffectData = ExtResource("1_hlq5f") EffectData = ExtResource("1_hlq5f")
Name = "Planted tick application" Name = "Flying tick application"
metadata/_custom_type_script = "uid://cl5hudinl1rex" metadata/_custom_type_script = "uid://cl5hudinl1rex"

View File

@@ -3,6 +3,7 @@
[ext_resource type="Script" uid="uid://b44cse62qru7j" path="res://scenes/components/knockback/RKnockback.cs" id="1_kcl5u"] [ext_resource type="Script" uid="uid://b44cse62qru7j" path="res://scenes/components/knockback/RKnockback.cs" id="1_kcl5u"]
[ext_resource type="Resource" uid="uid://bhn27s8ne0uyg" path="res://forge/resources/tag_containers/on_knockback_dealt.tres" id="2_oqtq1"] [ext_resource type="Resource" uid="uid://bhn27s8ne0uyg" path="res://forge/resources/tag_containers/on_knockback_dealt.tres" id="2_oqtq1"]
[ext_resource type="Resource" uid="uid://bkr6uu57wm3o3" path="res://forge/resources/tag_containers/on_knockback_received.tres" id="3_1va1b"] [ext_resource type="Resource" uid="uid://bkr6uu57wm3o3" path="res://forge/resources/tag_containers/on_knockback_received.tres" id="3_1va1b"]
[ext_resource type="Resource" uid="uid://5obdxlcpw8qt" path="res://forge/resources/tag_containers/knockback_immune.tres" id="3_oqtq1"]
[ext_resource type="Resource" uid="uid://45l7vnfs72b" path="res://forge/resources/tag_containers/knockbackable_tag.tres" id="4_0i0oh"] [ext_resource type="Resource" uid="uid://45l7vnfs72b" path="res://forge/resources/tag_containers/knockbackable_tag.tres" id="4_0i0oh"]
[ext_resource type="Script" uid="uid://diondfg5xp78h" path="res://forge/calculators/ForgeKnockbackExecution.cs" id="5_babc1"] [ext_resource type="Script" uid="uid://diondfg5xp78h" path="res://forge/calculators/ForgeKnockbackExecution.cs" id="5_babc1"]
@@ -14,6 +15,7 @@ metadata/_custom_type_script = "uid://b44cse62qru7j"
[resource] [resource]
script = ExtResource("5_babc1") script = ExtResource("5_babc1")
KnockbackableTag = ExtResource("4_0i0oh") KnockbackableTag = ExtResource("4_0i0oh")
KnockbackImmuneTag = ExtResource("3_oqtq1")
Knockback = SubResource("Resource_6x2ov") Knockback = SubResource("Resource_6x2ov")
KnockbackDealerEventTags = ExtResource("2_oqtq1") KnockbackDealerEventTags = ExtResource("2_oqtq1")
KnockbackReceiverEventTags = ExtResource("3_1va1b") KnockbackReceiverEventTags = ExtResource("3_1va1b")

View File

@@ -0,0 +1,20 @@
[gd_resource type="Resource" script_class="TargetTagRequirements" format=3 uid="uid://vs6kfo2ubhvr"]
[ext_resource type="Script" uid="uid://cw525n4mjqgw0" path="res://addons/forge/resources/ForgeTagContainer.cs" id="1_52mex"]
[ext_resource type="Script" uid="uid://b0eq12mjqfage" path="res://addons/forge/resources/components/TargetTagRequirements.cs" id="2_d06a4"]
[sub_resource type="Resource" id="Resource_r7waw"]
script = ExtResource("1_52mex")
ContainerTags = Array[String](["immunity.stun"])
metadata/_custom_type_script = "uid://cw525n4mjqgw0"
[sub_resource type="Resource" id="Resource_vioyh"]
script = ExtResource("1_52mex")
ContainerTags = Array[String](["traits.stunnable"])
metadata/_custom_type_script = "uid://cw525n4mjqgw0"
[resource]
script = ExtResource("2_d06a4")
ApplicationRequiredTags = SubResource("Resource_vioyh")
ApplicationIgnoredTags = SubResource("Resource_r7waw")
metadata/_custom_type_script = "uid://b0eq12mjqfage"

View File

@@ -20,7 +20,7 @@ BaseValue = 1
[resource] [resource]
script = ExtResource("4_7ma6b") script = ExtResource("4_7ma6b")
Name = "Call Planted Tick Event Periodically" Name = "Call Flying Tick Event Periodically"
Modifiers = [] Modifiers = []
Components = [] Components = []
Executions = Array[Object]([ExtResource("1_cd13a")]) Executions = Array[Object]([ExtResource("1_cd13a")])

View File

@@ -4,5 +4,5 @@
[resource] [resource]
script = ExtResource("1_kdy2b") script = ExtResource("1_kdy2b")
ContainerTags = Array[String](["character.enemy", "traits.damageable", "traits.knockbackable"]) ContainerTags = Array[String](["character.enemy", "traits.damageable", "traits.knockbackable", "traits.stunnable"])
metadata/_custom_type_script = "uid://cw525n4mjqgw0" metadata/_custom_type_script = "uid://cw525n4mjqgw0"

View File

@@ -0,0 +1,8 @@
[gd_resource type="Resource" script_class="ForgeTag" format=3 uid="uid://5obdxlcpw8qt"]
[ext_resource type="Script" uid="uid://dpakv7agvir6y" path="res://addons/forge/resources/ForgeTag.cs" id="1_pjklh"]
[resource]
script = ExtResource("1_pjklh")
Tag = "immunity.knockback"
metadata/_custom_type_script = "uid://dpakv7agvir6y"

View File

@@ -0,0 +1,8 @@
[gd_resource type="Resource" script_class="ForgeTag" format=3 uid="uid://bkr1xfokymvp4"]
[ext_resource type="Script" uid="uid://dpakv7agvir6y" path="res://addons/forge/resources/ForgeTag.cs" id="1_ux16b"]
[resource]
script = ExtResource("1_ux16b")
Tag = "events.enemy.launch_projectile"
metadata/_custom_type_script = "uid://dpakv7agvir6y"

View File

@@ -0,0 +1,8 @@
[gd_resource type="Resource" script_class="ForgeTag" format=3 uid="uid://csh8jcxtrs11k"]
[ext_resource type="Script" uid="uid://dpakv7agvir6y" path="res://addons/forge/resources/ForgeTag.cs" id="1_3ab6s"]
[resource]
script = ExtResource("1_3ab6s")
Tag = "events.enemy.try_hit"
metadata/_custom_type_script = "uid://dpakv7agvir6y"

View File

@@ -5,9 +5,10 @@ namespace Movementtests.interfaces;
public record MovementInputs( public record MovementInputs(
Vector3 Velocity = default, Vector3 Velocity = default,
Vector3 TargetLocation = default, Vector3 TargetLocation = default,
bool isOnFloor = false, bool IsOnFloor = false,
Vector3 gravity = default, bool IsStunned = false,
double delta = 0); Vector3 Gravity = default,
double Delta = 0);
public interface IMoveable public interface IMoveable
{ {

61
managers/TokenManager.cs Normal file
View File

@@ -0,0 +1,61 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Chickensoft.AutoInject;
using Chickensoft.Introspection;
using Godot;
namespace Movementtests.managers;
[GlobalClass, Meta(typeof(IAutoNode))]
public partial class TokenManager : Node
{
public override void _Notification(int what) => this.Notify(what);
public record struct Token(ulong InstanceId, Action OnUse);
private Dictionary<ulong, Token> Tokens { get; set; } = [];
public int TokenCount => Tokens.Count;
private Queue<ulong> RequestQueue { get; set; } = [];
public int MaxTokens { get; set;}
public void Initialize(int maxTokens)
{
MaxTokens = maxTokens;
}
public Token? RequestToken(Node owner)
{
if (Tokens.ContainsKey(owner.GetInstanceId()))
{
GD.Print("Already has a token");
return null; // Already has a token
}
if (TokenCount >= MaxTokens)
{
GD.Print($"Max tokens reached: {TokenCount}");
return null; // Max tokens reached
}
if (!RequestQueue.Contains(owner.GetInstanceId()))
{
RequestQueue.Enqueue(owner.GetInstanceId());
}
if (RequestQueue.First() != owner.GetInstanceId())
{
GD.Print("Waiting its turn");
return null; // Next in line is not the requester
}
var ownerInstanceId = RequestQueue.Dequeue();
var token = new Token(ownerInstanceId, () => UseToken(ownerInstanceId));
Tokens.Add(token.InstanceId, token);
return token;
}
public void UseToken(ulong instanceId)
{
Tokens.Remove(instanceId);
}
}

View File

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

View File

@@ -0,0 +1,22 @@
using Godot;
namespace Movementtests.managers;
[GlobalClass]
public partial class EnemyDescription(PackedScene scene, EnemyDescription.EnemyType type, RMovement? movementOverride) : Resource
{
public enum EnemyType
{
Normal,
Flying,
Projectile,
}
[Export(PropertyHint.NodeType)] public required PackedScene Scene { get; set; } = scene;
[Export] public required EnemyType Type { get; set; } = type;
[Export] public RMovement? MovementOverride { get; set; } = movementOverride;
public EnemyDescription() : this(ResourceLoader.Load<PackedScene>("uid://dxt0e2ugmttqq"), EnemyType.Normal, null) {}
}

View File

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

View File

@@ -0,0 +1,13 @@
using System.Collections.Generic;
using Godot;
namespace Movementtests.managers;
[GlobalClass]
public partial class SingleWave(EnemyDescription[] enemies) : Resource
{
[Export] public Godot.Collections.Dictionary<EnemyDescription, int> EnemiesToSpawn { get; set; } = [];
public SingleWave() : this([]) {}
}

View File

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

View File

@@ -0,0 +1,11 @@
using Godot;
namespace Movementtests.managers;
[GlobalClass]
public partial class WaveContent(SingleWave[] waves) : Resource
{
[Export] public SingleWave[] Waves { get; set; } = waves;
public WaveContent() : this([]) {}
}

View File

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

View File

@@ -0,0 +1,121 @@
using System.Collections.Generic;
using System.Linq;
using Chickensoft.AutoInject;
using Chickensoft.Collections;
using Chickensoft.Introspection;
using Godot;
using Movementtests.tools;
namespace Movementtests.managers;
[GlobalClass, Meta(typeof(IAutoNode))]
public partial class WaveManager : Node
{
public override void _Notification(int what) => this.Notify(what);
public WaveContent WaveContent { get; set; }
public int CurrentWaveIndex { get; set; }
public int CurrentWaveCount => WaveContent.Waves.Length;
public Godot.Collections.Dictionary<EnemyDescription, int> CurrentWave =>
WaveContent.Waves[CurrentWaveIndex].EnemiesToSpawn;
public Dictionary<ulong, Enemy?> CurrentSpawnedEnemies { get; set; } = [];
public Set<Spawner> SpawnersInUse { get; set; } = [];
public List<Spawner> Spawners { get; set; } = [];
public void RegisterSpawner(Spawner spawner) => Spawners.Add(spawner);
public void InitializeFromResource(WaveContent waveContent) => WaveContent = waveContent;
public void StartWaves()
{
CurrentWaveIndex = 0;
StartNextWave();
}
public void StartNextWave()
{
if (CurrentWave.Count == 0)
{
GD.PrintErr("Wave has no enemies");
return;
}
if (Spawners.Count == 0)
{
GD.PrintErr("No spawners registered");
return;
}
SpawnEnemiesAsAvailable();
}
public void SpawnEnemiesAsAvailable()
{
var randomizedSpawners = Spawners.ToArray();
randomizedSpawners.Shuffle();
foreach (var spawner in randomizedSpawners)
{
if (SpawnersInUse.Contains(spawner)) continue;
foreach (var (enemyDescription, numberRemaining) in CurrentWave)
{
if (numberRemaining <= 0) continue;
if (!spawner.SupportedEnemyTypes.Contains(enemyDescription.Type)) continue;
var spawnedEnemy = spawner.SpawnEnemy(enemyDescription);
if (spawnedEnemy == null) continue;
CurrentSpawnedEnemies[spawnedEnemy.GetInstanceId()] = spawnedEnemy;
SpawnersInUse.Add(spawner);
spawnedEnemy.OnKilled += instanceId=> SpawnedEnemyDied(instanceId, spawner);
CurrentWave[enemyDescription]--;
break;
}
}
// foreach (var (enemyDescription, numberRemaining) in CurrentWave)
// {
// if (numberRemaining <= 0) continue;
// foreach (var spawner in randomizedSpawners)
// {
// if (!spawner.SupportedEnemyTypes.Contains(enemyDescription.Type)) continue;
// if (SpawnersInUse.Contains(spawner)) continue;
//
// var spawnedEnemy = spawner.SpawnEnemy(enemyDescription);
// if (spawnedEnemy == null) continue;
//
// CurrentSpawnedEnemies[spawnedEnemy.GetInstanceId()] = spawnedEnemy;
// SpawnersInUse.Add(spawner);
//
// spawnedEnemy.OnKilled += instanceId=> SpawnedEnemyDied(instanceId, spawner);
//
// CurrentWave[enemyDescription]--;
// break;
// }
// }
var remainingEnemiesToSpawn = CurrentWave.Values.Sum();
if (remainingEnemiesToSpawn <= 0) return; // Wave is fully spawned
GetTree().CreateTimer(1.0f).Timeout += SpawnEnemiesAsAvailable; // Call back the same function later to try and spawn the rest
}
public void SpawnedEnemyDied(ulong instanceId, Spawner spawner)
{
CurrentSpawnedEnemies.Remove(instanceId);
SpawnersInUse.Remove(spawner);
if (CurrentSpawnedEnemies.Count == 0) FinishWave();
}
public void FinishWave()
{
if (CurrentWaveIndex >= CurrentWaveCount) return; // All waves finished
CurrentWaveIndex++;
GetTree().CreateTimer(1.0f).Timeout += StartNextWave; // Start next wave in 1s
}
}

View File

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

View File

@@ -0,0 +1,12 @@
[gd_resource type="Resource" script_class="EnemyDescription" format=3 uid="uid://cfyafss8ncbhh"]
[ext_resource type="Resource" uid="uid://bwqjaom4k7rc3" path="res://scenes/enemies/flying_enemy/flying_enemy_movement.tres" id="1_hsb6g"]
[ext_resource type="PackedScene" uid="uid://cmlud1hwkd6sv" path="res://scenes/enemies/flying_enemy/flying_enemy.tscn" id="1_yvgr4"]
[ext_resource type="Script" uid="uid://rhdkfi7nuvu1" path="res://managers/Wave/EnemyDescription.cs" id="2_hsb6g"]
[resource]
script = ExtResource("2_hsb6g")
Scene = ExtResource("1_yvgr4")
Type = 1
MovementOverride = ExtResource("1_hsb6g")
metadata/_custom_type_script = "uid://rhdkfi7nuvu1"

View File

@@ -0,0 +1,9 @@
[gd_resource type="Resource" script_class="EnemyDescription" format=3 uid="uid://3clksludry8g"]
[ext_resource type="PackedScene" uid="uid://dxt0e2ugmttqq" path="res://scenes/enemies/grounded_enemy/grounded_enemy.tscn" id="1_wxdbf"]
[ext_resource type="Script" uid="uid://rhdkfi7nuvu1" path="res://managers/Wave/EnemyDescription.cs" id="2_gk6ig"]
[resource]
script = ExtResource("2_gk6ig")
Scene = ExtResource("1_wxdbf")
metadata/_custom_type_script = "uid://rhdkfi7nuvu1"

View File

@@ -0,0 +1,17 @@
[gd_resource type="Resource" script_class="SingleWave" format=3 uid="uid://dm71u0ryn0w1o"]
[ext_resource type="Resource" uid="uid://cfyafss8ncbhh" path="res://managers/Wave/resources/flying_enemy_desc.tres" id="1_bcssi"]
[ext_resource type="Script" uid="uid://rhdkfi7nuvu1" path="res://managers/Wave/EnemyDescription.cs" id="2_3r6ce"]
[ext_resource type="Resource" uid="uid://3clksludry8g" path="res://managers/Wave/resources/grounded_enemy_desc.tres" id="2_mmsra"]
[ext_resource type="Resource" uid="uid://lnturc3ibr5c" path="res://managers/Wave/resources/projectile_enemy_desc.tres" id="3_3r6ce"]
[ext_resource type="Script" uid="uid://cr8wog705ane6" path="res://managers/Wave/SingleWave.cs" id="5_qckro"]
[resource]
script = ExtResource("5_qckro")
Enemies = Array[Object]([ExtResource("1_bcssi"), ExtResource("2_mmsra"), ExtResource("3_3r6ce")])
EnemiesToSpawn = Dictionary[ExtResource("2_3r6ce"), int]({
ExtResource("1_bcssi"): 1,
ExtResource("2_mmsra"): 1,
ExtResource("3_3r6ce"): 1
})
metadata/_custom_type_script = "uid://cr8wog705ane6"

View File

@@ -0,0 +1,10 @@
[gd_resource type="Resource" script_class="EnemyDescription" format=3 uid="uid://lnturc3ibr5c"]
[ext_resource type="PackedScene" uid="uid://dx3y8sjftqk8f" path="res://scenes/enemies/projectile_enemy/projectile_enemy.tscn" id="1_2nepo"]
[ext_resource type="Script" uid="uid://rhdkfi7nuvu1" path="res://managers/Wave/EnemyDescription.cs" id="2_bn1dh"]
[resource]
script = ExtResource("2_bn1dh")
Scene = ExtResource("1_2nepo")
Type = 1
metadata/_custom_type_script = "uid://rhdkfi7nuvu1"

View File

@@ -13,7 +13,12 @@ using Movementtests.systems;
typeof(IAutoConnect), typeof(IAutoConnect),
typeof(IProvider) typeof(IProvider)
)] )]
public partial class MainSceneTemplate : Node3D, IProvide<InventoryManager>, IProvide<TagsManager>, IProvide<CuesManager> public partial class MainSceneTemplate : Node3D,
IProvide<InventoryManager>,
IProvide<TagsManager>,
IProvide<CuesManager>,
IProvide<TokenManager>,
IProvide<WaveManager>
{ {
public override void _Notification(int what) => this.Notify(what); public override void _Notification(int what) => this.Notify(what);
@@ -31,6 +36,8 @@ public partial class MainSceneTemplate : Node3D, IProvide<InventoryManager>, IPr
#region Exports #region Exports
[Export] public WeaponInventory? InitialWeaponInventory { get; set; } [Export] public WeaponInventory? InitialWeaponInventory { get; set; }
[Export] public int MaxNumberOfProjectiles { get; set; } = 3;
[Export] public WaveContent? WaveContent { get; set; }
#endregion #endregion
@@ -40,6 +47,12 @@ public partial class MainSceneTemplate : Node3D, IProvide<InventoryManager>, IPr
TagsManager IProvide<TagsManager>.Value() => ForgeManagers.Instance.TagsManager; TagsManager IProvide<TagsManager>.Value() => ForgeManagers.Instance.TagsManager;
CuesManager IProvide<CuesManager>.Value() => ForgeManagers.Instance.CuesManager; CuesManager IProvide<CuesManager>.Value() => ForgeManagers.Instance.CuesManager;
public required TokenManager TokenManager { get; set; }
TokenManager IProvide<TokenManager>.Value() => TokenManager;
public required WaveManager WaveManager { get; set; }
WaveManager IProvide<WaveManager>.Value() => WaveManager;
public void OnReady() public void OnReady()
{ {
PlayerFellPlane.BodyEntered += StartResetPlayerAnimation; PlayerFellPlane.BodyEntered += StartResetPlayerAnimation;
@@ -49,9 +62,25 @@ public partial class MainSceneTemplate : Node3D, IProvide<InventoryManager>, IPr
if (InitialWeaponInventory != null) if (InitialWeaponInventory != null)
InventoryManager.InitializeFromResource(InitialWeaponInventory); InventoryManager.InitializeFromResource(InitialWeaponInventory);
AddChild(InventoryManager); AddChild(InventoryManager);
TokenManager = new TokenManager();
TokenManager.Initialize(MaxNumberOfProjectiles);
AddChild(TokenManager);
WaveManager = new WaveManager();
if (WaveContent != null)
WaveManager.InitializeFromResource(WaveContent);
AddChild(WaveManager);
this.Provide(); this.Provide();
} }
public void OnProvided()
{
if (WaveContent != null)
GetTree().CreateTimer(3).Timeout += WaveManager.StartWaves;
}
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");

View File

@@ -16,8 +16,6 @@
[ext_resource type="Texture2D" uid="uid://bhlrmh5v3fa2n" path="res://assets/ui/input-prompts/Keyboard & Mouse/Vector/mouse_left_outline.svg" id="16_ca01l"] [ext_resource type="Texture2D" uid="uid://bhlrmh5v3fa2n" path="res://assets/ui/input-prompts/Keyboard & Mouse/Vector/mouse_left_outline.svg" id="16_ca01l"]
[ext_resource type="Texture2D" uid="uid://b580m114ivbse" path="res://assets/ui/input-prompts/Xbox Series/Vector/xbox_button_menu_outline.svg" id="17_5461m"] [ext_resource type="Texture2D" uid="uid://b580m114ivbse" path="res://assets/ui/input-prompts/Xbox Series/Vector/xbox_button_menu_outline.svg" id="17_5461m"]
[ext_resource type="Texture2D" uid="uid://goerc3svgoqd" path="res://assets/ui/input-prompts/Keyboard & Mouse/Vector/keyboard_escape_outline.svg" id="18_22eiu"] [ext_resource type="Texture2D" uid="uid://goerc3svgoqd" path="res://assets/ui/input-prompts/Keyboard & Mouse/Vector/keyboard_escape_outline.svg" id="18_22eiu"]
[ext_resource type="Texture2D" uid="uid://db6uqhcmcfs5t" path="res://assets/ui/input-prompts/Xbox Series/Vector/xbox_lb_outline.svg" id="19_ci5dp"]
[ext_resource type="Texture2D" uid="uid://ybwqghk70io" path="res://assets/ui/input-prompts/Keyboard & Mouse/Vector/keyboard_f_outline.svg" id="20_4ouww"]
[sub_resource type="Resource" id="Resource_nwk5u"] [sub_resource type="Resource" id="Resource_nwk5u"]
script = ExtResource("6_465vr") script = ExtResource("6_465vr")
@@ -58,6 +56,18 @@ use_collision = true
size = Vector3(1, 17.5, 9.5) size = Vector3(1, 17.5, 9.5)
material = ExtResource("3_4m8g1") material = ExtResource("3_4m8g1")
[node name="CSGBox3D109" type="CSGBox3D" parent="Playground/PlaytestArena" index="89" unique_id=167333800]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 50, 24.75, -41.74998)
use_collision = true
size = Vector3(1, 1.5, 9.5)
material = ExtResource("3_4m8g1")
[node name="CSGBox3D112" type="CSGBox3D" parent="Playground/PlaytestArena" index="90" unique_id=2075934946]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 45.5, 24.75, -46.999954)
use_collision = true
size = Vector3(10, 1.5, 1)
material = ExtResource("3_4m8g1")
[node name="Targets" type="Node3D" parent="Playground" index="1" unique_id=1727473773] [node name="Targets" type="Node3D" parent="Playground" index="1" unique_id=1727473773]
[node name="FixedDashthroughTarget" parent="Playground/Targets" index="0" unique_id=1291663508 instance=ExtResource("4_4u5eu")] [node name="FixedDashthroughTarget" parent="Playground/Targets" index="0" unique_id=1291663508 instance=ExtResource("4_4u5eu")]
@@ -235,7 +245,7 @@ Target = NodePath("../../../Player")
RMovement = SubResource("Resource_nwk5u") RMovement = SubResource("Resource_nwk5u")
[node name="Enemy24" parent="Playground/GroundedEnemies" index="16" unique_id=2068813971 node_paths=PackedStringArray("Target") instance=ExtResource("7_egib5")] [node name="Enemy24" parent="Playground/GroundedEnemies" index="16" unique_id=2068813971 node_paths=PackedStringArray("Target") instance=ExtResource("7_egib5")]
transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, 45, 24.5, -43.336807) transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, 45, 24.5, -43.336803)
Target = NodePath("../../../Player") Target = NodePath("../../../Player")
RMovement = SubResource("Resource_nwk5u") RMovement = SubResource("Resource_nwk5u")
@@ -345,8 +355,8 @@ shape = SubResource("BoxShape3D_dkfm7")
[node name="TutoTrigger4" parent="Tutorial/Triggers" index="3" unique_id=321542244 instance=ExtResource("10_vqwwk")] [node name="TutoTrigger4" parent="Tutorial/Triggers" index="3" unique_id=321542244 instance=ExtResource("10_vqwwk")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -11.5, 17.75, -27.5) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -11.5, 17.75, -27.5)
first_input_icon = ExtResource("15_1s3jl") first_input_icon = ExtResource("13_ocbap")
first_input_icon_keyboard = ExtResource("16_ca01l") first_input_icon_keyboard = ExtResource("14_4hfom")
input_related_text = "at target" input_related_text = "at target"
tuto_text = "dash through" tuto_text = "dash through"
@@ -356,8 +366,8 @@ shape = SubResource("BoxShape3D_nwk5u")
[node name="TutoTrigger6" parent="Tutorial/Triggers" index="4" unique_id=26112457 instance=ExtResource("10_vqwwk")] [node name="TutoTrigger6" parent="Tutorial/Triggers" index="4" unique_id=26112457 instance=ExtResource("10_vqwwk")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5.75, 22.75, 11.25) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5.75, 22.75, 11.25)
first_input_icon = ExtResource("15_1s3jl") first_input_icon = ExtResource("13_ocbap")
first_input_icon_keyboard = ExtResource("16_ca01l") first_input_icon_keyboard = ExtResource("14_4hfom")
input_related_text = "at enemy" input_related_text = "at enemy"
tuto_text = "dash through" tuto_text = "dash through"
@@ -389,10 +399,9 @@ shape = SubResource("BoxShape3D_trte5")
[node name="TutoTrigger8" parent="Tutorial/Triggers" index="7" unique_id=36196488 instance=ExtResource("10_vqwwk")] [node name="TutoTrigger8" parent="Tutorial/Triggers" index="7" unique_id=36196488 instance=ExtResource("10_vqwwk")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5, 21.75, 28.25) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5, 21.75, 28.25)
first_input_icon = ExtResource("19_ci5dp") first_input_icon = ExtResource("15_1s3jl")
first_input_icon_keyboard = ExtResource("20_4ouww") first_input_icon_keyboard = ExtResource("16_ca01l")
input_related_text = "at enemy" tuto_text = "hit"
tuto_text = "knockback"
[node name="CollisionShape3D" type="CollisionShape3D" parent="Tutorial/Triggers/TutoTrigger8" index="1" unique_id=929676345] [node name="CollisionShape3D" type="CollisionShape3D" parent="Tutorial/Triggers/TutoTrigger8" index="1" unique_id=929676345]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.125, 1.875, 0.375) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.125, 1.875, 0.375)

View File

@@ -50,7 +50,6 @@ EnemyToSpawn = ExtResource("5_iq67o")
MovementInputs = ExtResource("6_l44fp") MovementInputs = ExtResource("6_l44fp")
Target = NodePath("../Player") Target = NodePath("../Player")
SpawnInterval = 5.0 SpawnInterval = 5.0
IsActiveOnStart = false
[node name="GroundedSpawner3" parent="." index="10" unique_id=241829575 node_paths=PackedStringArray("Target") instance=ExtResource("4_jaqjx")] [node name="GroundedSpawner3" parent="." index="10" unique_id=241829575 node_paths=PackedStringArray("Target") instance=ExtResource("4_jaqjx")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 44.5, 0, -3) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 44.5, 0, -3)

View File

@@ -0,0 +1,348 @@
[gd_scene format=3 uid="uid://b2g2gys4dopmn"]
[ext_resource type="PackedScene" uid="uid://55wehh6xombr" path="res://maps/_templates/main_scene_template.tscn" id="1_pxwoj"]
[ext_resource type="PackedScene" uid="uid://y77cdg7gg3y7" path="res://maps/levels/_arenas/playtest_1.tscn" id="2_apgv3"]
[ext_resource type="Material" uid="uid://31aulub2nqov" path="res://assets/materials/greybox/m_greybox.tres" id="3_452yy"]
[ext_resource type="Script" uid="uid://rhdkfi7nuvu1" path="res://managers/Wave/EnemyDescription.cs" id="3_a6jwd"]
[ext_resource type="Resource" uid="uid://cfyafss8ncbhh" path="res://managers/Wave/resources/flying_enemy_desc.tres" id="3_re07p"]
[ext_resource type="PackedScene" uid="uid://c305mfrtumcyq" path="res://scenes/spawners/spawner.tscn" id="4_6q0yp"]
[ext_resource type="Resource" uid="uid://3clksludry8g" path="res://managers/Wave/resources/grounded_enemy_desc.tres" id="4_7ijxg"]
[ext_resource type="Script" uid="uid://cr8wog705ane6" path="res://managers/Wave/SingleWave.cs" id="5_7ijxg"]
[ext_resource type="Resource" uid="uid://lnturc3ibr5c" path="res://managers/Wave/resources/projectile_enemy_desc.tres" id="5_hm1dp"]
[ext_resource type="Script" uid="uid://dijmv0wqc1xuv" path="res://managers/Wave/WaveContent.cs" id="6_hm1dp"]
[sub_resource type="Resource" id="Resource_7ijxg"]
script = ExtResource("5_7ijxg")
EnemiesToSpawn = Dictionary[ExtResource("3_a6jwd"), int]({
ExtResource("4_7ijxg"): 4
})
metadata/_custom_type_script = "uid://cr8wog705ane6"
[sub_resource type="Resource" id="Resource_hm1dp"]
script = ExtResource("5_7ijxg")
EnemiesToSpawn = Dictionary[ExtResource("3_a6jwd"), int]({
ExtResource("4_7ijxg"): 8,
ExtResource("3_re07p"): 3
})
metadata/_custom_type_script = "uid://cr8wog705ane6"
[sub_resource type="Resource" id="Resource_a6jwd"]
script = ExtResource("5_7ijxg")
EnemiesToSpawn = Dictionary[ExtResource("3_a6jwd"), int]({
ExtResource("5_hm1dp"): 3
})
metadata/_custom_type_script = "uid://cr8wog705ane6"
[sub_resource type="Resource" id="Resource_wllel"]
script = ExtResource("5_7ijxg")
EnemiesToSpawn = Dictionary[ExtResource("3_a6jwd"), int]({
ExtResource("4_7ijxg"): 4,
ExtResource("5_hm1dp"): 4,
ExtResource("3_re07p"): 4
})
metadata/_custom_type_script = "uid://cr8wog705ane6"
[sub_resource type="Resource" id="Resource_re07p"]
script = ExtResource("5_7ijxg")
EnemiesToSpawn = Dictionary[ExtResource("3_a6jwd"), int]({
ExtResource("3_re07p"): 15
})
metadata/_custom_type_script = "uid://cr8wog705ane6"
[sub_resource type="Resource" id="Resource_t6pb5"]
script = ExtResource("5_7ijxg")
EnemiesToSpawn = Dictionary[ExtResource("3_a6jwd"), int]({
ExtResource("4_7ijxg"): 15,
ExtResource("5_hm1dp"): 10,
ExtResource("3_re07p"): 10
})
metadata/_custom_type_script = "uid://cr8wog705ane6"
[sub_resource type="Resource" id="Resource_e88eg"]
script = ExtResource("6_hm1dp")
Waves = Array[Object]([SubResource("Resource_7ijxg"), SubResource("Resource_hm1dp"), SubResource("Resource_a6jwd"), SubResource("Resource_wllel"), SubResource("Resource_re07p"), SubResource("Resource_t6pb5")])
metadata/_custom_type_script = "uid://dijmv0wqc1xuv"
[node name="Main" unique_id=955321579 instance=ExtResource("1_pxwoj")]
WaveContent = SubResource("Resource_e88eg")
[node name="PlaytestArena" parent="." index="12" unique_id=664535670 instance=ExtResource("2_apgv3")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -16, 0, 9.5)
[node name="CSGBox3D108" type="CSGBox3D" parent="PlaytestArena" index="89" unique_id=94297910]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.5, 8.75, 2.25)
use_collision = true
size = Vector3(1, 17.5, 9.5)
material = ExtResource("3_452yy")
[node name="Spawner2" parent="." index="13" unique_id=1982641431 node_paths=PackedStringArray("Target") instance=ExtResource("4_6q0yp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -8.5, 1, -4)
SupportedEnemyTypes = Array[int]([0])
Target = NodePath("../Player")
IsActiveOnStart = false
[node name="Spawner3" parent="." index="14" unique_id=1743153579 node_paths=PackedStringArray("Target") instance=ExtResource("4_6q0yp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4.5, 1, -4)
SupportedEnemyTypes = Array[int]([1])
Target = NodePath("../Player")
IsActiveOnStart = false
[node name="Spawner4" parent="." index="15" unique_id=536869732 node_paths=PackedStringArray("Target") instance=ExtResource("4_6q0yp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 8, 1, -4)
SupportedEnemyTypes = Array[int]([1, 0])
Target = NodePath("../Player")
IsActiveOnStart = false
[node name="Spawner5" parent="." index="16" unique_id=275129467 node_paths=PackedStringArray("Target") instance=ExtResource("4_6q0yp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 13, 1, -4)
SupportedEnemyTypes = Array[int]([1, 0])
Target = NodePath("../Player")
IsActiveOnStart = false
[node name="Spawners" type="Node3D" parent="." index="17" unique_id=1784503796]
[node name="Grounded" type="Node3D" parent="Spawners" index="0" unique_id=2135113359]
[node name="Spawner" parent="Spawners/Grounded" index="0" unique_id=580981173 node_paths=PackedStringArray("Target") instance=ExtResource("4_6q0yp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -12, 1, -4)
SupportedEnemyTypes = Array[int]([0])
Target = NodePath("../../../Player")
IsActiveOnStart = false
[node name="Spawner13" parent="Spawners/Grounded" index="1" unique_id=771710160 node_paths=PackedStringArray("Target") instance=ExtResource("4_6q0yp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, -4)
SupportedEnemyTypes = Array[int]([0])
Target = NodePath("../../../Player")
IsActiveOnStart = false
[node name="Spawner14" parent="Spawners/Grounded" index="2" unique_id=947491829 node_paths=PackedStringArray("Target") instance=ExtResource("4_6q0yp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 12.5, 1, -4)
SupportedEnemyTypes = Array[int]([0])
Target = NodePath("../../../Player")
IsActiveOnStart = false
[node name="Spawner15" parent="Spawners/Grounded" index="3" unique_id=519369782 node_paths=PackedStringArray("Target") instance=ExtResource("4_6q0yp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 12.5, 1, 5.5)
SupportedEnemyTypes = Array[int]([0])
Target = NodePath("../../../Player")
IsActiveOnStart = false
[node name="Spawner16" parent="Spawners/Grounded" index="4" unique_id=1219755801 node_paths=PackedStringArray("Target") instance=ExtResource("4_6q0yp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 12.5, 1, -9.5)
SupportedEnemyTypes = Array[int]([0])
Target = NodePath("../../../Player")
IsActiveOnStart = false
[node name="Spawner17" parent="Spawners/Grounded" index="5" unique_id=1403055240 node_paths=PackedStringArray("Target") instance=ExtResource("4_6q0yp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 22.5, 1, -9.5)
SupportedEnemyTypes = Array[int]([0])
Target = NodePath("../../../Player")
IsActiveOnStart = false
[node name="Spawner18" parent="Spawners/Grounded" index="6" unique_id=1479410245 node_paths=PackedStringArray("Target") instance=ExtResource("4_6q0yp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 29.5, 1, 7.5)
SupportedEnemyTypes = Array[int]([0])
Target = NodePath("../../../Player")
IsActiveOnStart = false
[node name="Spawner19" parent="Spawners/Grounded" index="7" unique_id=1743292696 node_paths=PackedStringArray("Target") instance=ExtResource("4_6q0yp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 29.5, 7, -9.5)
SupportedEnemyTypes = Array[int]([0])
Target = NodePath("../../../Player")
IsActiveOnStart = false
[node name="Spawner21" parent="Spawners/Grounded" index="8" unique_id=1801083740 node_paths=PackedStringArray("Target") instance=ExtResource("4_6q0yp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 29.5, 11.5, -24.5)
SupportedEnemyTypes = Array[int]([0])
Target = NodePath("../../../Player")
IsActiveOnStart = false
[node name="Spawner22" parent="Spawners/Grounded" index="9" unique_id=1296256003 node_paths=PackedStringArray("Target") instance=ExtResource("4_6q0yp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 11.5, 11.5, -24.5)
SupportedEnemyTypes = Array[int]([0])
Target = NodePath("../../../Player")
IsActiveOnStart = false
[node name="Spawner20" parent="Spawners/Grounded" index="10" unique_id=1527237523 node_paths=PackedStringArray("Target") instance=ExtResource("4_6q0yp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 18.5, 7, -9.5)
SupportedEnemyTypes = Array[int]([0])
Target = NodePath("../../../Player")
IsActiveOnStart = false
[node name="Spawner2" parent="Spawners/Grounded" index="11" unique_id=834604221 node_paths=PackedStringArray("Target") instance=ExtResource("4_6q0yp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -12, 1, -23.5)
SupportedEnemyTypes = Array[int]([0])
Target = NodePath("../../../Player")
IsActiveOnStart = false
[node name="Spawner3" parent="Spawners/Grounded" index="12" unique_id=270195635 node_paths=PackedStringArray("Target") instance=ExtResource("4_6q0yp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -8, 1, -30.5)
SupportedEnemyTypes = Array[int]([0])
Target = NodePath("../../../Player")
IsActiveOnStart = false
[node name="Spawner4" parent="Spawners/Grounded" index="13" unique_id=1202580658 node_paths=PackedStringArray("Target") instance=ExtResource("4_6q0yp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6, 1, -33)
SupportedEnemyTypes = Array[int]([0])
Target = NodePath("../../../Player")
IsActiveOnStart = false
[node name="Spawner5" parent="Spawners/Grounded" index="14" unique_id=1987649511 node_paths=PackedStringArray("Target") instance=ExtResource("4_6q0yp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 11.5, 1, -33)
SupportedEnemyTypes = Array[int]([0])
Target = NodePath("../../../Player")
IsActiveOnStart = false
[node name="Spawner6" parent="Spawners/Grounded" index="15" unique_id=1276050304 node_paths=PackedStringArray("Target") instance=ExtResource("4_6q0yp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 26.5, 1, -25)
SupportedEnemyTypes = Array[int]([0])
Target = NodePath("../../../Player")
IsActiveOnStart = false
[node name="Spawner7" parent="Spawners/Grounded" index="16" unique_id=825475214 node_paths=PackedStringArray("Target") instance=ExtResource("4_6q0yp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 26.5, 1, -17.5)
SupportedEnemyTypes = Array[int]([0])
Target = NodePath("../../../Player")
IsActiveOnStart = false
[node name="Spawner8" parent="Spawners/Grounded" index="17" unique_id=1896505808 node_paths=PackedStringArray("Target") instance=ExtResource("4_6q0yp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.5, 6, -17.5)
SupportedEnemyTypes = Array[int]([0])
Target = NodePath("../../../Player")
IsActiveOnStart = false
[node name="Spawner11" parent="Spawners/Grounded" index="18" unique_id=1922800453 node_paths=PackedStringArray("Target") instance=ExtResource("4_6q0yp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 7, -8)
SupportedEnemyTypes = Array[int]([0])
Target = NodePath("../../../Player")
IsActiveOnStart = false
[node name="Spawner12" parent="Spawners/Grounded" index="19" unique_id=172297553 node_paths=PackedStringArray("Target") instance=ExtResource("4_6q0yp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -14, 7, -8)
SupportedEnemyTypes = Array[int]([0])
Target = NodePath("../../../Player")
IsActiveOnStart = false
[node name="Spawner9" parent="Spawners/Grounded" index="20" unique_id=242104600 node_paths=PackedStringArray("Target") instance=ExtResource("4_6q0yp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6, 5, -17.5)
SupportedEnemyTypes = Array[int]([0])
Target = NodePath("../../../Player")
IsActiveOnStart = false
[node name="Spawner10" parent="Spawners/Grounded" index="21" unique_id=1537236940 node_paths=PackedStringArray("Target") instance=ExtResource("4_6q0yp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 12.5, 3.5, -17.5)
SupportedEnemyTypes = Array[int]([0])
Target = NodePath("../../../Player")
IsActiveOnStart = false
[node name="Flying" type="Node3D" parent="Spawners" index="1" unique_id=1568736683]
[node name="Spawner2" parent="Spawners/Flying" index="0" unique_id=540145996 node_paths=PackedStringArray("Target") instance=ExtResource("4_6q0yp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 26.051147, -34)
SupportedEnemyTypes = Array[int]([1])
Target = NodePath("../../../Player")
IsActiveOnStart = false
[node name="Spawner3" parent="Spawners/Flying" index="1" unique_id=286744715 node_paths=PackedStringArray("Target") instance=ExtResource("4_6q0yp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 27, 26.051147, -34)
SupportedEnemyTypes = Array[int]([1])
Target = NodePath("../../../Player")
IsActiveOnStart = false
[node name="Spawner4" parent="Spawners/Flying" index="2" unique_id=97624405 node_paths=PackedStringArray("Target") instance=ExtResource("4_6q0yp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 30.5, 26.051147, -31)
SupportedEnemyTypes = Array[int]([1])
Target = NodePath("../../../Player")
IsActiveOnStart = false
[node name="Spawner5" parent="Spawners/Flying" index="3" unique_id=452318421 node_paths=PackedStringArray("Target") instance=ExtResource("4_6q0yp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 20.5, 13.051147, 3.5)
SupportedEnemyTypes = Array[int]([1])
Target = NodePath("../../../Player")
IsActiveOnStart = false
[node name="Spawner6" parent="Spawners/Flying" index="4" unique_id=1238823469 node_paths=PackedStringArray("Target") instance=ExtResource("4_6q0yp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 20.5, 13.051147, 8)
SupportedEnemyTypes = Array[int]([1])
Target = NodePath("../../../Player")
IsActiveOnStart = false
[node name="Projectile" type="Node3D" parent="Spawners" index="2" unique_id=1258161549]
[node name="Spawner3" parent="Spawners/Projectile" index="0" unique_id=1747138734 node_paths=PackedStringArray("Target") instance=ExtResource("4_6q0yp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 7.5, 8.5)
SupportedEnemyTypes = Array[int]([2])
Target = NodePath("../../../Player")
IsActiveOnStart = false
[node name="Spawner4" parent="Spawners/Projectile" index="1" unique_id=1503627609 node_paths=PackedStringArray("Target") instance=ExtResource("4_6q0yp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 7, 11, 9.5)
SupportedEnemyTypes = Array[int]([2])
Target = NodePath("../../../Player")
IsActiveOnStart = false
[node name="Spawner5" parent="Spawners/Projectile" index="2" unique_id=2041198655 node_paths=PackedStringArray("Target") instance=ExtResource("4_6q0yp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 20.5, 11, 9.5)
SupportedEnemyTypes = Array[int]([2])
Target = NodePath("../../../Player")
IsActiveOnStart = false
[node name="Spawner6" parent="Spawners/Projectile" index="3" unique_id=552715567 node_paths=PackedStringArray("Target") instance=ExtResource("4_6q0yp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 20.5, 11, 1.5)
SupportedEnemyTypes = Array[int]([2])
Target = NodePath("../../../Player")
IsActiveOnStart = false
[node name="Spawner7" parent="Spawners/Projectile" index="4" unique_id=70054371 node_paths=PackedStringArray("Target") instance=ExtResource("4_6q0yp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 22.5, 12, -9.5)
SupportedEnemyTypes = Array[int]([2])
Target = NodePath("../../../Player")
IsActiveOnStart = false
[node name="Spawner8" parent="Spawners/Projectile" index="5" unique_id=1180979948 node_paths=PackedStringArray("Target") instance=ExtResource("4_6q0yp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 17, 12, -9.5)
SupportedEnemyTypes = Array[int]([2])
Target = NodePath("../../../Player")
IsActiveOnStart = false
[node name="Spawner9" parent="Spawners/Projectile" index="6" unique_id=1257162636 node_paths=PackedStringArray("Target") instance=ExtResource("4_6q0yp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 11.5, 12, -9.5)
SupportedEnemyTypes = Array[int]([2])
Target = NodePath("../../../Player")
IsActiveOnStart = false
[node name="Spawner10" parent="Spawners/Projectile" index="7" unique_id=508868686 node_paths=PackedStringArray("Target") instance=ExtResource("4_6q0yp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 17.5, -8.5)
SupportedEnemyTypes = Array[int]([2])
Target = NodePath("../../../Player")
IsActiveOnStart = false
[node name="Spawner11" parent="Spawners/Projectile" index="8" unique_id=1732590308 node_paths=PackedStringArray("Target") instance=ExtResource("4_6q0yp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 17.5, -17.5)
SupportedEnemyTypes = Array[int]([2])
Target = NodePath("../../../Player")
IsActiveOnStart = false
[node name="Spawner12" parent="Spawners/Projectile" index="9" unique_id=1601257376 node_paths=PackedStringArray("Target") instance=ExtResource("4_6q0yp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 7, 17.5, -24.5)
SupportedEnemyTypes = Array[int]([2])
Target = NodePath("../../../Player")
IsActiveOnStart = false
[node name="Spawner13" parent="Spawners/Projectile" index="10" unique_id=391332199 node_paths=PackedStringArray("Target") instance=ExtResource("4_6q0yp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 17, 17.5, -24.5)
SupportedEnemyTypes = Array[int]([2])
Target = NodePath("../../../Player")
IsActiveOnStart = false
[node name="Spawner14" parent="Spawners/Projectile" index="11" unique_id=1920158287 node_paths=PackedStringArray("Target") instance=ExtResource("4_6q0yp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 29.5, 17.5, -24.5)
SupportedEnemyTypes = Array[int]([2])
Target = NodePath("../../../Player")
IsActiveOnStart = false
[node name="Spawner15" parent="Spawners/Projectile" index="12" unique_id=1099390523 node_paths=PackedStringArray("Target") instance=ExtResource("4_6q0yp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -12, 11, -26.5)
SupportedEnemyTypes = Array[int]([2])
Target = NodePath("../../../Player")
IsActiveOnStart = false

View File

@@ -6,9 +6,7 @@
[ext_resource type="PackedScene" uid="uid://dxt0e2ugmttqq" path="res://scenes/enemies/grounded_enemy/grounded_enemy.tscn" id="4_1cb4f"] [ext_resource type="PackedScene" uid="uid://dxt0e2ugmttqq" path="res://scenes/enemies/grounded_enemy/grounded_enemy.tscn" id="4_1cb4f"]
[ext_resource type="Script" uid="uid://dtpxijlnb2c5" path="res://scenes/components/movement/RMovement.cs" id="5_vuwkd"] [ext_resource type="Script" uid="uid://dtpxijlnb2c5" path="res://scenes/components/movement/RMovement.cs" id="5_vuwkd"]
[ext_resource type="PackedScene" uid="uid://cmlud1hwkd6sv" path="res://scenes/enemies/flying_enemy/flying_enemy.tscn" id="7_vkl5g"] [ext_resource type="PackedScene" uid="uid://cmlud1hwkd6sv" path="res://scenes/enemies/flying_enemy/flying_enemy.tscn" id="7_vkl5g"]
[ext_resource type="PackedScene" uid="uid://c305mfrtumcyq" path="res://scenes/spawners/spawner.tscn" id="8_1upfw"] [ext_resource type="PackedScene" uid="uid://dx3y8sjftqk8f" path="res://scenes/enemies/projectile_enemy/projectile_enemy.tscn" id="10_mm5sa"]
[ext_resource type="Resource" uid="uid://bqq6uukbdfysr" path="res://scenes/enemies/grounded_enemy/grounded_enemy_movement.tres" id="9_ynw2y"]
[ext_resource type="Resource" uid="uid://bwqjaom4k7rc3" path="res://scenes/enemies/flying_enemy/flying_enemy_movement.tres" id="11_luuoi"]
[sub_resource type="Resource" id="Resource_xixm3"] [sub_resource type="Resource" id="Resource_xixm3"]
script = ExtResource("5_vuwkd") script = ExtResource("5_vuwkd")
@@ -110,19 +108,17 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 10, 7, -16)
Target = NodePath("../Player") Target = NodePath("../Player")
RMovement = SubResource("Resource_xixm3") RMovement = SubResource("Resource_xixm3")
[node name="GroundedSpawner" parent="." index="14" unique_id=557145011 node_paths=PackedStringArray("Target") instance=ExtResource("8_1upfw")] [node name="ProjectileEnemy" parent="." index="14" unique_id=1747444936 node_paths=PackedStringArray("Target") instance=ExtResource("10_mm5sa")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5, 2.5, -15) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.0893264, -1.9073486e-06, -17.405575)
EnemyToSpawn = ExtResource("4_1cb4f")
MovementInputs = ExtResource("9_ynw2y")
Target = NodePath("../Player") Target = NodePath("../Player")
IsActiveOnStart = false
[node name="FlyingSpawner" parent="." index="15" unique_id=974076606 node_paths=PackedStringArray("Target") instance=ExtResource("8_1upfw")] [node name="ProjectileEnemy2" parent="." index="15" unique_id=1908678308 node_paths=PackedStringArray("Target") instance=ExtResource("10_mm5sa")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 18, 11, -14) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.42922592, -3.8146973e-06, -20.257122)
EnemyToSpawn = ExtResource("7_vkl5g")
MovementInputs = ExtResource("11_luuoi")
Target = NodePath("../Player") Target = NodePath("../Player")
IsActiveOnStart = false
[node name="Player" parent="." index="17" unique_id=1309399929] [node name="ProjectileEnemy3" parent="." index="16" unique_id=1327447050 node_paths=PackedStringArray("Target") instance=ExtResource("10_mm5sa")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.4421315, -1.9073486e-06, -13.8114)
Target = NodePath("../Player")
[node name="Player" parent="." index="18" unique_id=1309399929]
transform = Transform3D(0.99999994, 0, 0, 0, 1, 0, 0, 0, 0.99999994, 2, 1.5, 9.5) transform = Transform3D(0.99999994, 0, 0, 0, 1, 0, 0, 0, 0.99999994, 2, 1.5, 9.5)

View File

@@ -43,7 +43,7 @@ item_0/text = "1 - ExampleLevel"
[node name="SceneLister" type="Node" parent="." unique_id=149935027] [node name="SceneLister" type="Node" parent="." unique_id=149935027]
script = ExtResource("3_stdqw") script = ExtResource("3_stdqw")
files = Array[String](["res://maps/levels/1 - tuto_movement.tscn", "res://maps/levels/2 - tuto_sword.tscn", "res://maps/levels/3 - tuto_enemies.tscn", "res://maps/zoos/grounded_flying_ennemies.tscn", "res://maps/gyms/metrics.tscn"]) files = Array[String](["res://maps/levels/1 - tuto_movement.tscn", "res://maps/levels/2 - tuto_sword.tscn", "res://maps/levels/3 - tuto_enemies.tscn", "res://maps/levels/4 - tuto_waves.tscn"])
directory = "res://maps" directory = "res://maps"
[connection signal="item_activated" from="Control/LevelButtonsContainer" to="." method="_on_level_buttons_container_item_activated"] [connection signal="item_activated" from="Control/LevelButtonsContainer" to="." method="_on_level_buttons_container_item_activated"]

View File

@@ -21,14 +21,18 @@ public partial class CFlyingMovement : Node3D, IMoveable
public Vector3 ComputeVelocity(MovementInputs inputs) public Vector3 ComputeVelocity(MovementInputs inputs)
{ {
if (inputs.IsStunned) return inputs.Velocity.Lerp(Vector3.Zero, (float) inputs.Delta * RMovement.Acceleration);
var velocity = inputs.Velocity; var velocity = inputs.Velocity;
var spaceState = GetWorld3D().DirectSpaceState; var spaceState = GetWorld3D().DirectSpaceState;
var target = inputs.TargetLocation; var target = inputs.TargetLocation;
var direction = (target - GlobalPosition).Normalized(); var direction = GlobalPosition.DirectionTo(target);
velocity = velocity.Lerp(direction * RMovement.Speed, (float) inputs.Delta * RMovement.Acceleration);
return velocity;
// Check if we have a direct line of sight to the player // Check if we have a direct line of sight to the player
if (!_movingToDesiredHeight) if (!_movingToDesiredHeight)
{ {
velocity = velocity.Lerp(direction * RMovement.Speed, (float) inputs.delta * RMovement.Acceleration); velocity = velocity.Lerp(direction * RMovement.Speed, (float) inputs.Delta * RMovement.Acceleration);
var query = PhysicsRayQueryParameters3D.Create(GlobalPosition, target, TerrainCollision); var query = PhysicsRayQueryParameters3D.Create(GlobalPosition, target, TerrainCollision);
var result = spaceState.IntersectRay(query); var result = spaceState.IntersectRay(query);
@@ -40,7 +44,7 @@ public partial class CFlyingMovement : Node3D, IMoveable
} }
else else
{ {
velocity = velocity.Lerp(_randomDirection * RMovement.Speed, (float) inputs.delta * RMovement.Acceleration); velocity = velocity.Lerp(_randomDirection * RMovement.Speed, (float) inputs.Delta * RMovement.Acceleration);
var groundQuery = PhysicsRayQueryParameters3D.Create(GlobalPosition, GlobalPosition+Vector3.Down*RMovement.TargetHeight, TerrainCollision); var groundQuery = PhysicsRayQueryParameters3D.Create(GlobalPosition, GlobalPosition+Vector3.Down*RMovement.TargetHeight, TerrainCollision);
var groundResult = spaceState.IntersectRay(groundQuery); var groundResult = spaceState.IntersectRay(groundQuery);

View File

@@ -19,15 +19,18 @@ public partial class CGroundedMovement : Node3D, IMoveable
var targetPlane = new Vector3(target.X, GlobalPosition.Y, target.Z); var targetPlane = new Vector3(target.X, GlobalPosition.Y, target.Z);
LookAt(targetPlane); LookAt(targetPlane);
float xAcc = (float) Mathf.Lerp(velocity.X, direction.X * RMovement.Speed, inputs.delta * RMovement.Acceleration);
float zAcc = (float) Mathf.Lerp(velocity.Z, direction.Z * RMovement.Speed, inputs.delta * RMovement.Acceleration); var targetXSpeed = inputs.IsStunned ? 0 : direction.X * RMovement.Speed;
var targetZSpeed = inputs.IsStunned ? 0 : direction.Z * RMovement.Speed;
float xAcc = (float) Mathf.Lerp(velocity.X, targetXSpeed, inputs.Delta * RMovement.Acceleration);
float zAcc = (float) Mathf.Lerp(velocity.Z, targetZSpeed, inputs.Delta * RMovement.Acceleration);
velocity.X = xAcc; velocity.X = xAcc;
velocity.Z = zAcc; velocity.Z = zAcc;
if (WallInFrontRayCast.IsColliding()) if (WallInFrontRayCast.IsColliding() && !inputs.IsStunned)
velocity.Y = RMovement.Speed; velocity.Y = RMovement.Speed;
else if (!inputs.isOnFloor) else if (!inputs.IsOnFloor)
velocity += inputs.gravity * (float)inputs.delta * RMovement.GravityModifier; velocity += inputs.Gravity * (float)inputs.Delta * RMovement.GravityModifier;
return velocity; return velocity;
} }

View File

@@ -8,11 +8,14 @@ using Gamesmiths.Forge.Core;
using Gamesmiths.Forge.Cues; using Gamesmiths.Forge.Cues;
using Gamesmiths.Forge.Effects; using Gamesmiths.Forge.Effects;
using Gamesmiths.Forge.Events; using Gamesmiths.Forge.Events;
using Gamesmiths.Forge.Godot.Resources;
using Gamesmiths.Forge.Godot.Resources.Abilities; using Gamesmiths.Forge.Godot.Resources.Abilities;
using Gamesmiths.Forge.Statescript; using Gamesmiths.Forge.Statescript;
using Gamesmiths.Forge.Tags; using Gamesmiths.Forge.Tags;
using Godot; using Godot;
using Movementtests.forge.abilities;
using Movementtests.interfaces; using Movementtests.interfaces;
using Movementtests.managers;
using Movementtests.scenes.components.knockback; using Movementtests.scenes.components.knockback;
using Movementtests.systems; using Movementtests.systems;
using Movementtests.tools; using Movementtests.tools;
@@ -36,7 +39,15 @@ public partial class Enemy : CharacterBody3D,
public TagsManager TagsManager => this.DependOn<TagsManager>(); public TagsManager TagsManager => this.DependOn<TagsManager>();
[Dependency] [Dependency]
public CuesManager CuesManager => this.DependOn<CuesManager>(); public CuesManager CuesManager => this.DependOn<CuesManager>();
[Dependency]
public TokenManager TokenManager => this.DependOn<TokenManager>();
#endregion
#region Signals
[Signal] public delegate void OnKilledEventHandler(ulong instanceId);
#endregion #endregion
#region Inspector #region Inspector
@@ -44,7 +55,6 @@ public partial class Enemy : CharacterBody3D,
// Public export components // Public export components
[Export] [Export]
public Node3D? Target { get; set; } public Node3D? Target { get; set; }
[Export] public required ForgeAbilityData HitAbility { get; set; }
[Export] [Export]
public float EnemyHeight { get; set; } = 1f; public float EnemyHeight { get; set; } = 1f;
[Export] [Export]
@@ -108,7 +118,6 @@ public partial class Enemy : CharacterBody3D,
public void OnReady() public void OnReady()
{ {
Init(); Init();
SetupSignals();
} }
public void Init() public void Init()
@@ -117,8 +126,6 @@ public partial class Enemy : CharacterBody3D,
CMovement.RMovement = RMovement; CMovement.RMovement = RMovement;
CKnockback = GetNode<Node>("CKnockback") as IKnockbackable ?? throw new Exception("Knockback component not found"); CKnockback = GetNode<Node>("CKnockback") as IKnockbackable ?? throw new Exception("Knockback component not found");
CKnockback.RKnockback = RKnockback; CKnockback.RKnockback = RKnockback;
_hitAbilityHandle = Abilities.GrantAbilityPermanently(HitAbility.GetAbilityData(), 1, LevelComparison.None, this);
} }
public void OnResolved() public void OnResolved()
@@ -127,54 +134,78 @@ public partial class Enemy : CharacterBody3D,
HealthBarWrapper.ResourceBar.Init(healthAttribute); HealthBarWrapper.ResourceBar.Init(healthAttribute);
healthAttribute.OnValueChanged += OnHealthChanged; healthAttribute.OnValueChanged += OnHealthChanged;
Events.Subscribe(Tag.RequestTag(TagsManager, "events.combat.hit"), // Events.Subscribe(Tag.RequestTag(TagsManager, "events.combat.hit"), data => {GD.Print("Hit!");});
data => {GD.Print("Hit!");});
Events.Subscribe<DamageDone>(Tag.RequestTag(TagsManager, "events.combat.damage"), OnDamageReceived); Events.Subscribe<DamageDone>(Tag.RequestTag(TagsManager, "events.combat.damage"), OnDamageReceived);
Events.Subscribe<KnockbackDone>(Tag.RequestTag(TagsManager, "events.combat.knockback_received"), OnKnockbackReceived); Events.Subscribe<KnockbackDone>(Tag.RequestTag(TagsManager, "events.combat.knockback_received"), OnKnockbackReceived);
Events.Subscribe(Tag.RequestTag(TagsManager, "events.combat.death"), OnDeath); Events.Subscribe(Tag.RequestTag(TagsManager, "events.combat.death"), OnDeath);
Events.Subscribe(Tag.RequestTag(TagsManager, "events.enemy.request_projectile"), ProjectileTokenRequested);
}
private bool IsStunned()
{
return Tags.CombinedTags.HasTag(Tag.RequestTag(TagsManager, "status.stunned"));
}
private void ProjectileTokenRequested(EventData obj)
{
if (IsStunned()) return;
var token = TokenManager.RequestToken(this);
if (token == null) return;
Events.Raise(new EventData<OnProjectileSpawned>
{
EventTags = Tag.RequestTag(TagsManager, "events.enemy.launch_projectile").GetSingleTagContainer()!,
Source = this,
Target = Target as IForgeEntity,
Payload = new OnProjectileSpawned(Vector3.Up, 20, Vector3.Up, Token: token)
});
} }
public void OnKnockbackReceived(EventData<KnockbackDone> data) public void OnKnockbackReceived(EventData<KnockbackDone> data)
{ {
RegisterKnockback(new KnockbackRecord(data.Payload.knockbackDirection, data.EventMagnitude)); RegisterKnockback(new KnockbackRecord(data.Payload.knockbackDirection, data.EventMagnitude));
} }
public void SetupSignals()
{
}
public override void _PhysicsProcess(double delta) public override void _PhysicsProcess(double delta)
{ {
// Only trigger gameplay related effects on specific frames // Only trigger gameplay-related effects on specific frames
if(Engine.GetPhysicsFrames() % 10 == 0) ProcessGameplay(delta); if(Engine.GetPhysicsFrames() % 10 == 0) ProcessGameplay(delta);
var targetPlanar = new Vector3(Target.GlobalPosition.X, GlobalPosition.Y, Target.GlobalPosition.Z); if (!IsStunned())
LookAt(targetPlanar); {
var targetPlanar = new Vector3(Target.GlobalPosition.X, GlobalPosition.Y, Target.GlobalPosition.Z);
LookAt(targetPlanar);
}
var inputs = new MovementInputs( var inputs = new MovementInputs(
Velocity: Velocity, Velocity: Velocity,
TargetLocation: Target.GlobalPosition, TargetLocation: Target.GlobalPosition,
isOnFloor: IsOnFloor(), IsOnFloor: IsOnFloor(),
gravity: GetGravity(), IsStunned: IsStunned(),
delta: delta Gravity: GetGravity(),
Delta: delta
); );
Velocity = ComputeVelocity(inputs); Velocity = ComputeVelocity(inputs);
Velocity += ComputeKnockback(); Velocity += ComputeKnockback();
MoveAndSlide(); MoveAndSlide();
} }
public void ProcessGameplay(double delta) public void ProcessGameplay(double delta)
{ {
if (_hitAbilityHandle == null) return; if (IsStunned()) return;
var bodies = DamageBox.GetOverlappingBodies(); var bodies = DamageBox.GetOverlappingBodies();
foreach (var body in bodies) foreach (var body in bodies)
{ {
if (body is not IForgeEntity forgeEntity) continue; if (body is not IForgeEntity forgeEntity) continue;
var canActivate = _hitAbilityHandle.CanActivate(out var _); Events.Raise(new EventData
if (!canActivate) return; {
EventTags = Tag.RequestTag(TagsManager, "events.enemy.try_hit").GetSingleTagContainer()!,
_hitAbilityHandle.Activate(out var _, forgeEntity); Source = this,
Target = forgeEntity
});
} }
} }
@@ -223,6 +254,8 @@ public partial class Enemy : CharacterBody3D,
{ {
killable.Kill(); killable.Kill();
} }
EmitSignalOnKilled(GetInstanceId());
CallDeferred(Node.MethodName.QueueFree); CallDeferred(Node.MethodName.QueueFree);
} }

View File

@@ -10,8 +10,13 @@
[ext_resource type="Script" uid="uid://ccovd5i0wr3kk" path="res://addons/forge/editor/attributes/AttributeValues.cs" id="8_46wn3"] [ext_resource type="Script" uid="uid://ccovd5i0wr3kk" path="res://addons/forge/editor/attributes/AttributeValues.cs" id="8_46wn3"]
[ext_resource type="Resource" uid="uid://bocsykxbh8l0g" path="res://forge/resources/tag_containers/enemy_base_tags.tres" id="8_oj1ws"] [ext_resource type="Resource" uid="uid://bocsykxbh8l0g" path="res://forge/resources/tag_containers/enemy_base_tags.tres" id="8_oj1ws"]
[ext_resource type="Script" uid="uid://dtpxijlnb2c5" path="res://scenes/components/movement/RMovement.cs" id="8_on7rt"] [ext_resource type="Script" uid="uid://dtpxijlnb2c5" path="res://scenes/components/movement/RMovement.cs" id="8_on7rt"]
[ext_resource type="Script" uid="uid://dps0oef50noil" path="res://addons/forge/nodes/ForgeEffect.cs" id="9_46wn3"]
[ext_resource type="PackedScene" uid="uid://bctpe34ddamg5" path="res://scenes/components/knockback/CKnockback.tscn" id="10_dejyg"] [ext_resource type="PackedScene" uid="uid://bctpe34ddamg5" path="res://scenes/components/knockback/CKnockback.tscn" id="10_dejyg"]
[ext_resource type="Script" uid="uid://1hgogislo1l6" path="res://addons/forge/resources/magnitudes/ForgeScalableInt.cs" id="10_oj1ws"]
[ext_resource type="Resource" uid="uid://dt7a1io5o0b8s" path="res://scenes/enemies/flying_enemy/flying_enemy_knockback.tres" id="11_mpa2u"] [ext_resource type="Resource" uid="uid://dt7a1io5o0b8s" path="res://scenes/enemies/flying_enemy/flying_enemy_knockback.tres" id="11_mpa2u"]
[ext_resource type="Script" uid="uid://72kj3n4lm1em" path="res://addons/forge/resources/components/ForgeGrantAbilityConfig.cs" id="11_vfi88"]
[ext_resource type="Script" uid="uid://b3wo2uge4ddnj" path="res://addons/forge/resources/components/GrantAbility.cs" id="12_hf6k8"]
[ext_resource type="Script" uid="uid://b83hf13nj37k3" path="res://addons/forge/resources/ForgeEffectData.cs" id="13_m4ble"]
[sub_resource type="Resource" id="Resource_wxisp"] [sub_resource type="Resource" id="Resource_wxisp"]
script = ExtResource("8_46wn3") script = ExtResource("8_46wn3")
@@ -25,7 +30,41 @@ Default = 1
Min = 1 Min = 1
Max = 100 Max = 100
[sub_resource type="ViewportTexture" id="ViewportTexture_ykkxn"] [sub_resource type="Resource" id="Resource_t0vud"]
script = ExtResource("10_oj1ws")
BaseValue = 1
[sub_resource type="Resource" id="Resource_ecuuy"]
script = ExtResource("11_vfi88")
AbilityData = ExtResource("2_46wn3")
AbilityLevel = SubResource("Resource_t0vud")
metadata/_custom_type_script = "uid://72kj3n4lm1em"
[sub_resource type="Resource" id="Resource_sk2ji"]
script = ExtResource("12_hf6k8")
GrantAbilityConfigs = [SubResource("Resource_ecuuy")]
metadata/_custom_type_script = "uid://b3wo2uge4ddnj"
[sub_resource type="Resource" id="Resource_8x1id"]
script = ExtResource("10_oj1ws")
BaseValue = 1
[sub_resource type="Resource" id="Resource_66opa"]
script = ExtResource("10_oj1ws")
BaseValue = 1
[sub_resource type="Resource" id="Resource_7y1tn"]
script = ExtResource("13_m4ble")
Name = "GrantAbilities"
Modifiers = []
Components = Array[Object]([SubResource("Resource_sk2ji")])
Executions = []
StackLimit = SubResource("Resource_66opa")
InitialStack = SubResource("Resource_8x1id")
Cues = []
metadata/_custom_type_script = "uid://b83hf13nj37k3"
[sub_resource type="ViewportTexture" id="ViewportTexture_46wn3"]
viewport_path = NodePath("SubViewport") viewport_path = NodePath("SubViewport")
[sub_resource type="Resource" id="Resource_on7rt"] [sub_resource type="Resource" id="Resource_on7rt"]
@@ -57,7 +96,6 @@ collision_layer = 16
collision_mask = 273 collision_mask = 273
motion_mode = 1 motion_mode = 1
script = ExtResource("1_q8l7o") script = ExtResource("1_q8l7o")
HitAbility = ExtResource("2_46wn3")
EnemyHeight = 0.5 EnemyHeight = 0.5
RKnockback = ExtResource("11_mpa2u") RKnockback = ExtResource("11_mpa2u")
RMovement = ExtResource("4_dejyg") RMovement = ExtResource("4_dejyg")
@@ -96,9 +134,14 @@ InitialAttributeValues = Dictionary[String, ExtResource("8_46wn3")]({
}) })
metadata/_custom_type_script = "uid://cxihb42t2mfqi" metadata/_custom_type_script = "uid://cxihb42t2mfqi"
[node name="GrantEffect" type="Node" parent="ForgeEntityNode" unique_id=169684942]
script = ExtResource("9_46wn3")
EffectData = SubResource("Resource_7y1tn")
metadata/_custom_type_script = "uid://dps0oef50noil"
[node name="CHealthBar" parent="." unique_id=1635725931 instance=ExtResource("7_ykkxn")] [node name="CHealthBar" parent="." unique_id=1635725931 instance=ExtResource("7_ykkxn")]
transform = Transform3D(0.3, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.70000005, 0) transform = Transform3D(0.3, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.70000005, 0)
texture = SubResource("ViewportTexture_ykkxn") texture = SubResource("ViewportTexture_46wn3")
[node name="CMovement" parent="." unique_id=1699571730 instance=ExtResource("7_vaeds")] [node name="CMovement" parent="." unique_id=1699571730 instance=ExtResource("7_vaeds")]
RMovement = SubResource("Resource_on7rt") RMovement = SubResource("Resource_on7rt")

View File

@@ -1,8 +0,0 @@
[gd_resource type="Resource" script_class="RDamage" format=3 uid="uid://dgo65k2ceqfvy"]
[ext_resource type="Script" uid="uid://jitubgv6judn" path="res://scenes/components/damage/RDamage.cs" id="1_h6law"]
[resource]
script = ExtResource("1_h6law")
DamageDealt = 1.0
metadata/_custom_type_script = "uid://jitubgv6judn"

View File

@@ -1,8 +0,0 @@
[gd_resource type="Resource" script_class="RHealth" format=3 uid="uid://dg1xbjhyhgnnk"]
[ext_resource type="Script" uid="uid://baiapod3csndf" path="res://scenes/components/health/RHealth.cs" id="1_jht15"]
[resource]
script = ExtResource("1_jht15")
StartingHealth = 5.0
metadata/_custom_type_script = "uid://baiapod3csndf"

View File

@@ -4,7 +4,7 @@
[resource] [resource]
script = ExtResource("1_3yq0a") script = ExtResource("1_3yq0a")
Speed = 3.0 Speed = 6.0
Acceleration = 5.0 Acceleration = 8.0
TargetHeight = 10.0 TargetHeight = 8.0
metadata/_custom_type_script = "uid://dtpxijlnb2c5" metadata/_custom_type_script = "uid://dtpxijlnb2c5"

View File

@@ -10,8 +10,13 @@
[ext_resource type="Script" uid="uid://ccovd5i0wr3kk" path="res://addons/forge/editor/attributes/AttributeValues.cs" id="7_x50ya"] [ext_resource type="Script" uid="uid://ccovd5i0wr3kk" path="res://addons/forge/editor/attributes/AttributeValues.cs" id="7_x50ya"]
[ext_resource type="Resource" uid="uid://bocsykxbh8l0g" path="res://forge/resources/tag_containers/enemy_base_tags.tres" id="8_4jf2q"] [ext_resource type="Resource" uid="uid://bocsykxbh8l0g" path="res://forge/resources/tag_containers/enemy_base_tags.tres" id="8_4jf2q"]
[ext_resource type="Script" uid="uid://dtpxijlnb2c5" path="res://scenes/components/movement/RMovement.cs" id="8_6d4gl"] [ext_resource type="Script" uid="uid://dtpxijlnb2c5" path="res://scenes/components/movement/RMovement.cs" id="8_6d4gl"]
[ext_resource type="Script" uid="uid://dps0oef50noil" path="res://addons/forge/nodes/ForgeEffect.cs" id="9_4jf2q"]
[ext_resource type="PackedScene" uid="uid://bctpe34ddamg5" path="res://scenes/components/knockback/CKnockback.tscn" id="10_jqqi6"] [ext_resource type="PackedScene" uid="uid://bctpe34ddamg5" path="res://scenes/components/knockback/CKnockback.tscn" id="10_jqqi6"]
[ext_resource type="Script" uid="uid://1hgogislo1l6" path="res://addons/forge/resources/magnitudes/ForgeScalableInt.cs" id="10_ub34u"]
[ext_resource type="Script" uid="uid://72kj3n4lm1em" path="res://addons/forge/resources/components/ForgeGrantAbilityConfig.cs" id="11_0mf3g"]
[ext_resource type="Resource" uid="uid://cektf6waf4s04" path="res://scenes/enemies/grounded_enemy/grounded_enemy_knockback.tres" id="11_8k3xb"] [ext_resource type="Resource" uid="uid://cektf6waf4s04" path="res://scenes/enemies/grounded_enemy/grounded_enemy_knockback.tres" id="11_8k3xb"]
[ext_resource type="Script" uid="uid://b3wo2uge4ddnj" path="res://addons/forge/resources/components/GrantAbility.cs" id="12_v6xmd"]
[ext_resource type="Script" uid="uid://b83hf13nj37k3" path="res://addons/forge/resources/ForgeEffectData.cs" id="13_jryek"]
[sub_resource type="Resource" id="Resource_x50ya"] [sub_resource type="Resource" id="Resource_x50ya"]
script = ExtResource("7_x50ya") script = ExtResource("7_x50ya")
@@ -25,7 +30,41 @@ Default = 1
Min = 1 Min = 1
Max = 100 Max = 100
[sub_resource type="ViewportTexture" id="ViewportTexture_18xwy"] [sub_resource type="Resource" id="Resource_msmv1"]
script = ExtResource("10_ub34u")
BaseValue = 1
[sub_resource type="Resource" id="Resource_m0osh"]
script = ExtResource("11_0mf3g")
AbilityData = ExtResource("6_4jf2q")
AbilityLevel = SubResource("Resource_msmv1")
metadata/_custom_type_script = "uid://72kj3n4lm1em"
[sub_resource type="Resource" id="Resource_3gkmr"]
script = ExtResource("12_v6xmd")
GrantAbilityConfigs = [SubResource("Resource_m0osh")]
metadata/_custom_type_script = "uid://b3wo2uge4ddnj"
[sub_resource type="Resource" id="Resource_oo2a1"]
script = ExtResource("10_ub34u")
BaseValue = 1
[sub_resource type="Resource" id="Resource_q86ag"]
script = ExtResource("10_ub34u")
BaseValue = 1
[sub_resource type="Resource" id="Resource_5eesh"]
script = ExtResource("13_jryek")
Name = "Grant abilities"
Modifiers = null
Components = Array[Object]([SubResource("Resource_3gkmr")])
Executions = null
StackLimit = SubResource("Resource_q86ag")
InitialStack = SubResource("Resource_oo2a1")
Cues = null
metadata/_custom_type_script = "uid://b83hf13nj37k3"
[sub_resource type="ViewportTexture" id="ViewportTexture_5lf6m"]
viewport_path = NodePath("SubViewport") viewport_path = NodePath("SubViewport")
[sub_resource type="Resource" id="Resource_6d4gl"] [sub_resource type="Resource" id="Resource_6d4gl"]
@@ -95,9 +134,14 @@ InitialAttributeValues = Dictionary[String, ExtResource("7_x50ya")]({
}) })
metadata/_custom_type_script = "uid://cxihb42t2mfqi" metadata/_custom_type_script = "uid://cxihb42t2mfqi"
[node name="GrantEffect" type="Node" parent="ForgeEntityNode" unique_id=462009360]
script = ExtResource("9_4jf2q")
EffectData = SubResource("Resource_5eesh")
metadata/_custom_type_script = "uid://dps0oef50noil"
[node name="CHealthBar" parent="." unique_id=1278247727 instance=ExtResource("7_18xwy")] [node name="CHealthBar" parent="." unique_id=1278247727 instance=ExtResource("7_18xwy")]
transform = Transform3D(0.4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.2, 0) transform = Transform3D(0.4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.2, 0)
texture = SubResource("ViewportTexture_18xwy") texture = SubResource("ViewportTexture_5lf6m")
[node name="CMovement" parent="." unique_id=1080640834 node_paths=PackedStringArray("WallInFrontRayCast") instance=ExtResource("7_qyswd")] [node name="CMovement" parent="." unique_id=1080640834 node_paths=PackedStringArray("WallInFrontRayCast") instance=ExtResource("7_qyswd")]
RMovement = SubResource("Resource_6d4gl") RMovement = SubResource("Resource_6d4gl")

View File

@@ -1,8 +0,0 @@
[gd_resource type="Resource" script_class="RDamage" format=3 uid="uid://otfc2snh8umc"]
[ext_resource type="Script" uid="uid://jitubgv6judn" path="res://scenes/components/damage/RDamage.cs" id="1_y415a"]
[resource]
script = ExtResource("1_y415a")
DamageDealt = 2.0
metadata/_custom_type_script = "uid://jitubgv6judn"

View File

@@ -1,8 +0,0 @@
[gd_resource type="Resource" script_class="RHealth" format=3 uid="uid://bohbojc68j7y1"]
[ext_resource type="Script" uid="uid://baiapod3csndf" path="res://scenes/components/health/RHealth.cs" id="1_h6jgd"]
[resource]
script = ExtResource("1_h6jgd")
StartingHealth = 20.0
metadata/_custom_type_script = "uid://baiapod3csndf"

View File

@@ -0,0 +1,280 @@
[gd_scene format=3 uid="uid://dx3y8sjftqk8f"]
[ext_resource type="Script" uid="uid://bn7sc6id7n166" path="res://scenes/enemies/Enemy.cs" id="1_ha67n"]
[ext_resource type="Resource" uid="uid://qpdw62ubaclc" path="res://forge/resources/ability_datas/grounded_enemy_hit.tres" id="2_nbf6l"]
[ext_resource type="Resource" uid="uid://ckfbi6lu255ep" path="res://forge/resources/ability_datas/lauche_projectile.tres" id="2_rlvdp"]
[ext_resource type="Resource" uid="uid://cektf6waf4s04" path="res://scenes/enemies/grounded_enemy/grounded_enemy_knockback.tres" id="3_gciy3"]
[ext_resource type="Resource" uid="uid://c3ys18t0tkbq8" path="res://scenes/enemies/projectile_enemy/projectile_enemy_knockback.tres" id="3_ymgar"]
[ext_resource type="Resource" uid="uid://rchgikroifmg" path="res://scenes/enemies/projectile_enemy/projectile_enemy_movement.tres" id="4_0f52b"]
[ext_resource type="Script" uid="uid://rpcbb54q4atx" path="res://forge/ForgeEntityNode.cs" id="5_ya0fp"]
[ext_resource type="Resource" uid="uid://bocsykxbh8l0g" path="res://forge/resources/tag_containers/enemy_base_tags.tres" id="6_ttkdf"]
[ext_resource type="Script" uid="uid://cxihb42t2mfqi" path="res://addons/forge/nodes/ForgeAttributeSet.cs" id="7_2triq"]
[ext_resource type="Script" uid="uid://ccovd5i0wr3kk" path="res://addons/forge/editor/attributes/AttributeValues.cs" id="8_ti0v2"]
[ext_resource type="PackedScene" uid="uid://bwx2um43k0ou4" path="res://scenes/components/health/CHealthbar.tscn" id="9_6ew2r"]
[ext_resource type="Script" uid="uid://dps0oef50noil" path="res://addons/forge/nodes/ForgeEffect.cs" id="9_xdj1j"]
[ext_resource type="Script" uid="uid://dhxfbxh54pyxp" path="res://addons/forge/resources/abilities/ForgeAbilityData.cs" id="10_b62xo"]
[ext_resource type="PackedScene" uid="uid://dbr7ioio158ew" path="res://scenes/components/movement/CGroundedMovement.tscn" id="10_d3cra"]
[ext_resource type="Script" uid="uid://1hgogislo1l6" path="res://addons/forge/resources/magnitudes/ForgeScalableInt.cs" id="11_f6vvi"]
[ext_resource type="Script" uid="uid://dtpxijlnb2c5" path="res://scenes/components/movement/RMovement.cs" id="11_fi4yv"]
[ext_resource type="PackedScene" uid="uid://bctpe34ddamg5" path="res://scenes/components/knockback/CKnockback.tscn" id="12_7k8no"]
[ext_resource type="Script" uid="uid://72kj3n4lm1em" path="res://addons/forge/resources/components/ForgeGrantAbilityConfig.cs" id="12_ssnfc"]
[ext_resource type="Script" uid="uid://b3wo2uge4ddnj" path="res://addons/forge/resources/components/GrantAbility.cs" id="13_5ac6t"]
[ext_resource type="Script" uid="uid://b83hf13nj37k3" path="res://addons/forge/resources/ForgeEffectData.cs" id="14_rlvdp"]
[ext_resource type="Script" uid="uid://cw525n4mjqgw0" path="res://addons/forge/resources/ForgeTagContainer.cs" id="17_xabdf"]
[ext_resource type="Script" uid="uid://br7ut4lbau66w" path="res://forge/calculators/ForgeRaiseEventTagExecution.cs" id="18_ufku3"]
[ext_resource type="Script" uid="uid://cn3b4ya15fg7e" path="res://addons/forge/resources/magnitudes/ForgeScalableFloat.cs" id="19_hgi6f"]
[ext_resource type="Script" uid="uid://cl5hudinl1rex" path="res://forge/abilities/ForgeEffectApplicationBehavior.cs" id="21_17f1o"]
[sub_resource type="Resource" id="Resource_x50ya"]
script = ExtResource("8_ti0v2")
Default = 1
Min = 1
Max = 100
[sub_resource type="Resource" id="Resource_yk4hc"]
script = ExtResource("8_ti0v2")
Default = 1
Min = 1
Max = 100
[sub_resource type="Resource" id="Resource_55uge"]
script = ExtResource("11_f6vvi")
BaseValue = 1
[sub_resource type="Resource" id="Resource_xabdf"]
script = ExtResource("12_ssnfc")
AbilityData = ExtResource("2_nbf6l")
AbilityLevel = SubResource("Resource_55uge")
metadata/_custom_type_script = "uid://72kj3n4lm1em"
[sub_resource type="Resource" id="Resource_5xe4r"]
script = ExtResource("17_xabdf")
ContainerTags = Array[String](["events.enemy.request_projectile"])
metadata/_custom_type_script = "uid://cw525n4mjqgw0"
[sub_resource type="Resource" id="Resource_5hctm"]
script = ExtResource("18_ufku3")
EventTags = SubResource("Resource_5xe4r")
metadata/_custom_type_script = "uid://br7ut4lbau66w"
[sub_resource type="Resource" id="Resource_xq5v1"]
script = ExtResource("11_f6vvi")
BaseValue = 1
[sub_resource type="Resource" id="Resource_s7hsu"]
script = ExtResource("19_hgi6f")
BaseValue = 1.0
metadata/_custom_type_script = "uid://cn3b4ya15fg7e"
[sub_resource type="Resource" id="Resource_xuuuu"]
script = ExtResource("11_f6vvi")
BaseValue = 1
[sub_resource type="Resource" id="Resource_nr327"]
script = ExtResource("14_rlvdp")
Name = "Raise request projectile event periodically"
Modifiers = []
Components = []
Executions = Array[Object]([SubResource("Resource_5hctm")])
DurationType = 1
HasPeriodicApplication = true
Period = SubResource("Resource_s7hsu")
StackLimit = SubResource("Resource_xuuuu")
InitialStack = SubResource("Resource_xq5v1")
Cues = []
metadata/_custom_type_script = "uid://b83hf13nj37k3"
[sub_resource type="Resource" id="Resource_ov8t2"]
script = ExtResource("21_17f1o")
EffectData = SubResource("Resource_nr327")
metadata/_custom_type_script = "uid://cl5hudinl1rex"
[sub_resource type="Resource" id="Resource_gg1oy"]
script = ExtResource("10_b62xo")
Name = "Request projectile token event raise"
CooldownEffects = []
AbilityBehavior = SubResource("Resource_ov8t2")
metadata/_custom_type_script = "uid://dhxfbxh54pyxp"
[sub_resource type="Resource" id="Resource_r40oc"]
script = ExtResource("11_f6vvi")
BaseValue = 1
[sub_resource type="Resource" id="Resource_nu2lf"]
script = ExtResource("12_ssnfc")
AbilityData = SubResource("Resource_gg1oy")
AbilityLevel = SubResource("Resource_r40oc")
TryActivateOnGrant = true
metadata/_custom_type_script = "uid://72kj3n4lm1em"
[sub_resource type="Resource" id="Resource_rlvdp"]
script = ExtResource("11_f6vvi")
BaseValue = 1
[sub_resource type="Resource" id="Resource_ei7hs"]
script = ExtResource("12_ssnfc")
AbilityData = ExtResource("2_rlvdp")
AbilityLevel = SubResource("Resource_rlvdp")
metadata/_custom_type_script = "uid://72kj3n4lm1em"
[sub_resource type="Resource" id="Resource_ufku3"]
script = ExtResource("13_5ac6t")
GrantAbilityConfigs = [SubResource("Resource_xabdf"), SubResource("Resource_nu2lf"), SubResource("Resource_ei7hs")]
metadata/_custom_type_script = "uid://b3wo2uge4ddnj"
[sub_resource type="Resource" id="Resource_hgi6f"]
script = ExtResource("11_f6vvi")
BaseValue = 1
[sub_resource type="Resource" id="Resource_17f1o"]
script = ExtResource("11_f6vvi")
BaseValue = 1
[sub_resource type="Resource" id="Resource_ytrix"]
script = ExtResource("14_rlvdp")
Name = "Grant abilities"
Modifiers = []
Components = Array[Object]([SubResource("Resource_ufku3")])
Executions = []
StackLimit = SubResource("Resource_17f1o")
InitialStack = SubResource("Resource_hgi6f")
Cues = []
metadata/_custom_type_script = "uid://b83hf13nj37k3"
[sub_resource type="ViewportTexture" id="ViewportTexture_rlvdp"]
viewport_path = NodePath("SubViewport")
[sub_resource type="Resource" id="Resource_6d4gl"]
script = ExtResource("11_fi4yv")
Speed = 5.0
metadata/_custom_type_script = "uid://dtpxijlnb2c5"
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_62kkh"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_3kqd1"]
albedo_color = Color(0.9888099, 0.33454797, 0.39278528, 1)
[sub_resource type="CapsuleMesh" id="CapsuleMesh_3uydm"]
material = SubResource("StandardMaterial3D_3kqd1")
[sub_resource type="SphereMesh" id="SphereMesh_4yfjf"]
radius = 0.05
height = 0.1
radial_segments = 4
rings = 4
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_4yfjf"]
albedo_color = Color(0.06469653, 0.06469653, 0.06469653, 1)
[sub_resource type="BoxShape3D" id="BoxShape3D_4yfjf"]
size = Vector3(1, 2, 1.5)
[sub_resource type="SphereShape3D" id="SphereShape3D_k2cew"]
radius = 2.0
[node name="ProjectileEnemy" type="CharacterBody3D" unique_id=1747444936]
collision_layer = 16
collision_mask = 273
script = ExtResource("1_ha67n")
EnemyHeight = 2.0
RKnockback = ExtResource("3_ymgar")
RMovement = ExtResource("4_0f52b")
[node name="ForgeEntityNode" type="Node3D" parent="." unique_id=289553407]
script = ExtResource("5_ya0fp")
BaseTags = ExtResource("6_ttkdf")
metadata/_custom_type_script = "uid://rpcbb54q4atx"
[node name="CharacterAttributeSet" type="Node" parent="ForgeEntityNode" unique_id=1699781551]
script = ExtResource("7_2triq")
AttributeSetClass = "CharacterAttributeSet"
InitialAttributeValues = Dictionary[String, ExtResource("8_ti0v2")]({
"Health": Object(RefCounted,"script":ExtResource("8_ti0v2"),"Default":100,"Min":0,"Max":100)
})
metadata/_custom_type_script = "uid://cxihb42t2mfqi"
[node name="MetaAttributeSet" type="Node" parent="ForgeEntityNode" unique_id=1794036161]
script = ExtResource("7_2triq")
AttributeSetClass = "MetaAttributeSet"
InitialAttributeValues = Dictionary[String, ExtResource("8_ti0v2")]({
"IncomingDamage": Object(RefCounted,"script":ExtResource("8_ti0v2"),"Default":0,"Min":0,"Max":1000)
})
metadata/_custom_type_script = "uid://cxihb42t2mfqi"
[node name="EnnemyAttributeSet" type="Node" parent="ForgeEntityNode" unique_id=804252284]
script = ExtResource("7_2triq")
AttributeSetClass = "EnemyAttributeSet"
InitialAttributeValues = Dictionary[String, ExtResource("8_ti0v2")]({
"Health": Object(RefCounted,"script":ExtResource("8_ti0v2"),"Default":100,"Min":0,"Max":100)
,
"Speed": SubResource("Resource_x50ya"),
"Strength": SubResource("Resource_yk4hc")
})
metadata/_custom_type_script = "uid://cxihb42t2mfqi"
[node name="ForgeEffect" type="Node" parent="ForgeEntityNode" unique_id=401970791]
script = ExtResource("9_xdj1j")
EffectData = SubResource("Resource_ytrix")
metadata/_custom_type_script = "uid://dps0oef50noil"
[node name="CHealthBar" parent="." unique_id=1278247727 instance=ExtResource("9_6ew2r")]
transform = Transform3D(0.4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.2, 0)
texture = SubResource("ViewportTexture_rlvdp")
[node name="CMovement" parent="." unique_id=1080640834 node_paths=PackedStringArray("WallInFrontRayCast") instance=ExtResource("10_d3cra")]
RMovement = SubResource("Resource_6d4gl")
WallInFrontRayCast = NodePath("../WallInFrontRayCast")
[node name="CKnockback" parent="." unique_id=1769689477 instance=ExtResource("12_7k8no")]
RKnockback = ExtResource("3_gciy3")
[node name="CTarget" type="Marker3D" parent="." unique_id=383414478]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
[node name="CollisionShape3D" type="CollisionShape3D" parent="." unique_id=237956006]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
shape = SubResource("CapsuleShape3D_62kkh")
[node name="MeshInstance3D" type="MeshInstance3D" parent="." unique_id=1261225229]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
layers = 33
mesh = SubResource("CapsuleMesh_3uydm")
[node name="MeshInstance3D2" type="MeshInstance3D" parent="." unique_id=934245732]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.2, 1.5, -0.5)
layers = 33
cast_shadow = 0
ignore_occlusion_culling = true
mesh = SubResource("SphereMesh_4yfjf")
surface_material_override/0 = SubResource("StandardMaterial3D_4yfjf")
[node name="MeshInstance3D3" type="MeshInstance3D" parent="." unique_id=1877433806]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.2, 1.5, -0.5)
layers = 33
cast_shadow = 0
ignore_occlusion_culling = true
mesh = SubResource("SphereMesh_4yfjf")
surface_material_override/0 = SubResource("StandardMaterial3D_4yfjf")
[node name="WallInFrontRayCast" type="RayCast3D" parent="." unique_id=834403687]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.1, 0)
target_position = Vector3(0, 0, -1.5)
collision_mask = 272
[node name="DamageBox" type="Area3D" parent="." unique_id=399872344]
collision_layer = 0
monitorable = false
[node name="CollisionShape3D" type="CollisionShape3D" parent="DamageBox" unique_id=978720734]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, -0.25)
shape = SubResource("BoxShape3D_4yfjf")
[node name="AimAssistTarget" type="Area3D" parent="." unique_id=328174571]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
collision_layer = 64
collision_mask = 0
[node name="CollisionShape3D" type="CollisionShape3D" parent="AimAssistTarget" unique_id=1960476920]
shape = SubResource("SphereShape3D_k2cew")

View File

@@ -0,0 +1,8 @@
[gd_resource type="Resource" script_class="RKnockback" format=3 uid="uid://c3ys18t0tkbq8"]
[ext_resource type="Script" uid="uid://b44cse62qru7j" path="res://scenes/components/knockback/RKnockback.cs" id="1_5r2lx"]
[resource]
script = ExtResource("1_5r2lx")
Modifier = 1.0
metadata/_custom_type_script = "uid://b44cse62qru7j"

View File

@@ -0,0 +1,8 @@
[gd_resource type="Resource" script_class="RMovement" format=3 uid="uid://rchgikroifmg"]
[ext_resource type="Script" uid="uid://dtpxijlnb2c5" path="res://scenes/components/movement/RMovement.cs" id="1_vkids"]
[resource]
script = ExtResource("1_vkids")
GravityModifier = 5.0
metadata/_custom_type_script = "uid://dtpxijlnb2c5"

View File

@@ -50,7 +50,8 @@ public partial class Explosion : Area3D, IProvide<CuesManager>
foreach (var body in bodies) foreach (var body in bodies)
{ {
if (body is not IForgeEntity target) continue; if (body is not IForgeEntity target) continue;
foreach (var ability in ForgeEntityNode.Abilities.GrantedAbilities.Where(ability => ability.CanActivate(out _, target))) foreach (var ability in ForgeEntityNode.Abilities.GrantedAbilities.Where(ability =>
ability.CanActivate(out _, target)))
ability.Activate(out _, target, Damage); ability.Activate(out _, target, Damage);
} }
QueueFree(); QueueFree();

View File

@@ -1,6 +1,7 @@
[gd_scene format=3 uid="uid://duju3atqgltkg"] [gd_scene format=3 uid="uid://duju3atqgltkg"]
[ext_resource type="Script" uid="uid://cnlu64l7oxvv3" path="res://scenes/explosion/Explosion.cs" id="1_82hkh"] [ext_resource type="Script" uid="uid://cnlu64l7oxvv3" path="res://scenes/explosion/Explosion.cs" id="1_82hkh"]
[ext_resource type="Script" uid="uid://cw525n4mjqgw0" path="res://addons/forge/resources/ForgeTagContainer.cs" id="3_1ve7p"]
[ext_resource type="Script" uid="uid://rpcbb54q4atx" path="res://forge/ForgeEntityNode.cs" id="3_wikc1"] [ext_resource type="Script" uid="uid://rpcbb54q4atx" path="res://forge/ForgeEntityNode.cs" id="3_wikc1"]
[ext_resource type="Script" uid="uid://dps0oef50noil" path="res://addons/forge/nodes/ForgeEffect.cs" id="4_f5lqq"] [ext_resource type="Script" uid="uid://dps0oef50noil" path="res://addons/forge/nodes/ForgeEffect.cs" id="4_f5lqq"]
[ext_resource type="Resource" uid="uid://nns16d5uhtl8" path="res://forge/resources/ability_datas/explosion_hit.tres" id="5_nphml"] [ext_resource type="Resource" uid="uid://nns16d5uhtl8" path="res://forge/resources/ability_datas/explosion_hit.tres" id="5_nphml"]
@@ -21,6 +22,11 @@ transparency = 1
cull_mode = 2 cull_mode = 2
albedo_color = Color(0.9607843, 0.27058825, 0, 0.7176471) albedo_color = Color(0.9607843, 0.27058825, 0, 0.7176471)
[sub_resource type="Resource" id="Resource_nqbbv"]
script = ExtResource("3_1ve7p")
ContainerTags = []
metadata/_custom_type_script = "uid://cw525n4mjqgw0"
[sub_resource type="Resource" id="Resource_5c2oj"] [sub_resource type="Resource" id="Resource_5c2oj"]
script = ExtResource("5_nqbbv") script = ExtResource("5_nqbbv")
BaseValue = 1 BaseValue = 1
@@ -71,6 +77,7 @@ surface_material_override/0 = SubResource("StandardMaterial3D_hys74")
[node name="ForgeEntityNode" type="Node3D" parent="." unique_id=806020391] [node name="ForgeEntityNode" type="Node3D" parent="." unique_id=806020391]
script = ExtResource("3_wikc1") script = ExtResource("3_wikc1")
BaseTags = SubResource("Resource_nqbbv")
metadata/_custom_type_script = "uid://rpcbb54q4atx" metadata/_custom_type_script = "uid://rpcbb54q4atx"
[node name="ForgeEffect" type="Node" parent="ForgeEntityNode" unique_id=2068515708] [node name="ForgeEffect" type="Node" parent="ForgeEntityNode" unique_id=2068515708]

View File

@@ -14,6 +14,7 @@
[ext_resource type="PackedScene" uid="uid://duju3atqgltkg" path="res://scenes/explosion/explosion.tscn" id="5_ue7xq"] [ext_resource type="PackedScene" uid="uid://duju3atqgltkg" path="res://scenes/explosion/explosion.tscn" id="5_ue7xq"]
[ext_resource type="Resource" uid="uid://t612lts1wi1s" path="res://inputs/base_mode/move_right.tres" id="6_q7bng"] [ext_resource type="Resource" uid="uid://t612lts1wi1s" path="res://inputs/base_mode/move_right.tres" id="6_q7bng"]
[ext_resource type="Resource" uid="uid://cffil4tic3ysg" path="res://forge/resources/effect_datas/inhibit_mana_regen_temporarily.tres" id="6_u8yay"] [ext_resource type="Resource" uid="uid://cffil4tic3ysg" path="res://forge/resources/effect_datas/inhibit_mana_regen_temporarily.tres" id="6_u8yay"]
[ext_resource type="Texture2D" uid="uid://g0u88alm6hcb" path="res://assets/ui/IconGodotNode/node/icon_bullet.png" id="7_2rkt1"]
[ext_resource type="Script" uid="uid://cwbvxlfvmocc1" path="res://scenes/player_controller/scripts/StairsSystem.cs" id="7_bmt5a"] [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://brswsknpgwal2" path="res://inputs/base_mode/move_front.tres" id="7_m8gvy"]
[ext_resource type="PackedScene" uid="uid://bctpe34ddamg5" path="res://scenes/components/knockback/CKnockback.tscn" id="7_x835q"] [ext_resource type="PackedScene" uid="uid://bctpe34ddamg5" path="res://scenes/components/knockback/CKnockback.tscn" id="7_x835q"]
@@ -22,10 +23,13 @@
[ext_resource type="Resource" uid="uid://bs8b0oojixm4q" path="res://scenes/player_controller/resources/player_knockback.tres" id="8_m8gvy"] [ext_resource type="Resource" uid="uid://bs8b0oojixm4q" path="res://scenes/player_controller/resources/player_knockback.tres" id="8_m8gvy"]
[ext_resource type="Resource" uid="uid://c3e0ivgaxrsyb" path="res://inputs/base_mode/aim_down.tres" id="8_obsfv"] [ext_resource type="Resource" uid="uid://c3e0ivgaxrsyb" path="res://inputs/base_mode/aim_down.tres" id="8_obsfv"]
[ext_resource type="PackedScene" uid="uid://wq1okogkhc5l" path="res://scenes/player_controller/components/mantle/mantle_system.tscn" id="8_qu4wy"] [ext_resource type="PackedScene" uid="uid://wq1okogkhc5l" path="res://scenes/player_controller/components/mantle/mantle_system.tscn" id="8_qu4wy"]
[ext_resource type="PackedScene" uid="uid://bhp6qunnwhncf" path="res://scenes/projectile/Projectile.tscn" id="8_u8yay"]
[ext_resource type="AudioStream" uid="uid://clfggn87oeg1s" path="res://scenes/player_controller/audio/InteractiveSFX.tres" id="9_jb43f"] [ext_resource type="AudioStream" uid="uid://clfggn87oeg1s" path="res://scenes/player_controller/audio/InteractiveSFX.tres" id="9_jb43f"]
[ext_resource type="Resource" uid="uid://bebstkm608wxx" path="res://inputs/base_mode/aim_pressed.tres" id="9_nob5r"] [ext_resource type="Resource" uid="uid://bebstkm608wxx" path="res://inputs/base_mode/aim_pressed.tres" id="9_nob5r"]
[ext_resource type="Script" uid="uid://dxtjifb8hv8k4" path="res://forge/abilities/ForgeSpawnProjectileBehavior.cs" id="9_uqalc"]
[ext_resource type="Resource" uid="uid://dccuj66egxfwh" path="res://forge/resources/ability_datas/empowered_action.tres" id="10_2rkt1"] [ext_resource type="Resource" uid="uid://dccuj66egxfwh" path="res://forge/resources/ability_datas/empowered_action.tres" id="10_2rkt1"]
[ext_resource type="Resource" uid="uid://bdit2jy5gbpts" path="res://inputs/base_mode/jump.tres" id="10_4u7i3"] [ext_resource type="Resource" uid="uid://bdit2jy5gbpts" path="res://inputs/base_mode/jump.tres" id="10_4u7i3"]
[ext_resource type="Script" uid="uid://dhxfbxh54pyxp" path="res://addons/forge/resources/abilities/ForgeAbilityData.cs" id="10_b0xmb"]
[ext_resource type="Script" uid="uid://cxihb42t2mfqi" path="res://addons/forge/nodes/ForgeAttributeSet.cs" id="10_pw5r7"] [ext_resource type="Script" uid="uid://cxihb42t2mfqi" path="res://addons/forge/nodes/ForgeAttributeSet.cs" id="10_pw5r7"]
[ext_resource type="Script" uid="uid://ccovd5i0wr3kk" path="res://addons/forge/editor/attributes/AttributeValues.cs" id="11_2rkt1"] [ext_resource type="Script" uid="uid://ccovd5i0wr3kk" path="res://addons/forge/editor/attributes/AttributeValues.cs" id="11_2rkt1"]
[ext_resource type="Resource" uid="uid://b5gx3q8nvu72e" path="res://inputs/base_mode/hit.tres" id="11_cresl"] [ext_resource type="Resource" uid="uid://b5gx3q8nvu72e" path="res://inputs/base_mode/hit.tres" id="11_cresl"]
@@ -70,6 +74,27 @@ script = ExtResource("11_u8yay")
Tag = "immunity.damage" Tag = "immunity.damage"
metadata/_custom_type_script = "uid://dpakv7agvir6y" metadata/_custom_type_script = "uid://dpakv7agvir6y"
[sub_resource type="Resource" id="Resource_xs7wf"]
script = ExtResource("9_uqalc")
Projectile = ExtResource("8_u8yay")
Name = "Spawn projectile on parry"
Icon = ExtResource("7_2rkt1")
metadata/_custom_type_script = "uid://dxtjifb8hv8k4"
[sub_resource type="Resource" id="Resource_cm4e8"]
script = ExtResource("11_u8yay")
Tag = "events.player.parry"
metadata/_custom_type_script = "uid://dpakv7agvir6y"
[sub_resource type="Resource" id="Resource_cmmfb"]
script = ExtResource("10_b0xmb")
Name = "Parry projectile"
CooldownEffects = []
AbilityBehavior = SubResource("Resource_xs7wf")
TriggerSource = 1
TriggerTag = SubResource("Resource_cm4e8")
metadata/_custom_type_script = "uid://dhxfbxh54pyxp"
[sub_resource type="Resource" id="Resource_abfq8"] [sub_resource type="Resource" id="Resource_abfq8"]
script = ExtResource("3_cb2lu") script = ExtResource("3_cb2lu")
Modifier = 5.0 Modifier = 5.0
@@ -106,6 +131,9 @@ radius = 0.45
[sub_resource type="SphereShape3D" id="SphereShape3D_q14ux"] [sub_resource type="SphereShape3D" id="SphereShape3D_q14ux"]
radius = 1.0 radius = 1.0
[sub_resource type="SphereShape3D" id="SphereShape3D_n24vh"]
radius = 2.25
[sub_resource type="SphereShape3D" id="SphereShape3D_u8rdp"] [sub_resource type="SphereShape3D" id="SphereShape3D_u8rdp"]
radius = 1.5 radius = 1.5
@@ -149,7 +177,7 @@ EmpoweredActionUsed = SubResource("Resource_5gbhg")
InvincibleTag = SubResource("Resource_2rkt1") InvincibleTag = SubResource("Resource_2rkt1")
HitAbility = ExtResource("4_u8yay") HitAbility = ExtResource("4_u8yay")
EmpoweredActionAbility = ExtResource("10_2rkt1") EmpoweredActionAbility = ExtResource("10_2rkt1")
DefaultGrantedAbilities = [ExtResource("5_u8yay")] DefaultGrantedAbilities = [ExtResource("5_u8yay"), SubResource("Resource_cmmfb")]
DefaultPermanentEffects = [ExtResource("5_2rkt1")] DefaultPermanentEffects = [ExtResource("5_2rkt1")]
EmpoweredActionEffects = [ExtResource("6_u8yay")] EmpoweredActionEffects = [ExtResource("6_u8yay")]
AimAssistStrength = 0.3 AimAssistStrength = 0.3
@@ -279,7 +307,7 @@ debug_color = Color(0, 0.6, 0.701961, 0.341176)
[node name="HeadSystem" parent="." unique_id=1203743757 instance=ExtResource("11_rxwoh")] [node name="HeadSystem" parent="." unique_id=1203743757 instance=ExtResource("11_rxwoh")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.6, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.6, 0)
LookSensitivity = 0.16 LookSensitivity = 0.5
CameraInclineAcceleration = 20.0 CameraInclineAcceleration = 20.0
GroundedCameraIncline = 3.0 GroundedCameraIncline = 3.0
SlidingJitterAmplitude = 0.2 SlidingJitterAmplitude = 0.2
@@ -289,18 +317,28 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1.6, 0)
MantleEndLocationDistanceFromWall = 0.3 MantleEndLocationDistanceFromWall = 0.3
MantleHeightCastStart = 2.5 MantleHeightCastStart = 2.5
[node name="WeaponHitbox" type="Area3D" parent="HeadSystem" unique_id=616313905] [node name="WeaponHitbox" type="Area3D" parent="." unique_id=616313905]
unique_name_in_owner = true unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1.6, 0)
collision_layer = 0 collision_layer = 0
collision_mask = 16 collision_mask = 16
monitoring = false monitoring = false
monitorable = false monitorable = false
[node name="CollisionShape3D" type="CollisionShape3D" parent="HeadSystem/WeaponHitbox" unique_id=1617373708] [node name="CollisionShape3D" type="CollisionShape3D" parent="WeaponHitbox" unique_id=1617373708]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, -1.5) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, -1.5)
shape = SubResource("SphereShape3D_q14ux") shape = SubResource("SphereShape3D_q14ux")
[node name="Parrybox" type="Area3D" parent="." unique_id=1452001086]
unique_name_in_owner = true
collision_layer = 0
collision_mask = 48
monitoring = false
monitorable = false
[node name="CollisionShape3D" type="CollisionShape3D" parent="Parrybox" unique_id=619469543]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, -2)
shape = SubResource("SphereShape3D_n24vh")
[node name="StairsSystem" type="Node3D" parent="." unique_id=703342681] [node name="StairsSystem" type="Node3D" parent="." unique_id=703342681]
script = ExtResource("7_bmt5a") script = ExtResource("7_bmt5a")

View File

@@ -180,11 +180,11 @@ public partial class HeadSystem : Node3D
public void OnParryboxActivated() public void OnParryboxActivated()
{ {
EmitSignalHitboxActivated(); EmitSignalParryboxActivated();
} }
public void OnParryboxDeactivated() public void OnParryboxDeactivated()
{ {
EmitSignalHitboxDeactivated(); EmitSignalParryboxDeactivated();
} }
internal bool FootstepEmitted; internal bool FootstepEmitted;

View File

@@ -579,12 +579,12 @@ tracks/3/keys = {
} }
tracks/4/type = "method" tracks/4/type = "method"
tracks/4/imported = false tracks/4/imported = false
tracks/4/enabled = false tracks/4/enabled = true
tracks/4/path = NodePath("../..") tracks/4/path = NodePath("../..")
tracks/4/interp = 1 tracks/4/interp = 1
tracks/4/loop_wrap = true tracks/4/loop_wrap = true
tracks/4/keys = { tracks/4/keys = {
"times": PackedFloat32Array(0.06666667, 0.18333334), "times": PackedFloat32Array(0.01666667, 0.16666667),
"transitions": PackedFloat32Array(1, 1), "transitions": PackedFloat32Array(1, 1),
"values": [{ "values": [{
"args": [], "args": [],

View File

@@ -91,9 +91,6 @@ public partial class WeaponSystem : RigidBody3D, IForgeEntity
public Tag WeaponInHandStatusTag; public Tag WeaponInHandStatusTag;
public Tag WeaponFlyingStatusTag; public Tag WeaponFlyingStatusTag;
public Tag WeaponPlantedStatusTag; public Tag WeaponPlantedStatusTag;
public Tag WeaponFlyingAbilityTag;
public Tag WeaponPlantedAbilityTag;
private AbilityHandle? _weaponFlyingAbility; private AbilityHandle? _weaponFlyingAbility;
private AbilityHandle? _weaponPlantedAbility; private AbilityHandle? _weaponPlantedAbility;
@@ -235,13 +232,11 @@ public partial class WeaponSystem : RigidBody3D, IForgeEntity
// Manage weapon tick raising abilities // Manage weapon tick raising abilities
if (FlyingTickAbility != null) if (FlyingTickAbility != null)
{ {
WeaponFlyingAbilityTag = Tag.RequestTag(TagsManager,"abilities.weapon.flying");
_weaponFlyingAbility = Abilities.GrantAbilityPermanently(FlyingTickAbility.GetAbilityData(), 1, LevelComparison.None, this); _weaponFlyingAbility = Abilities.GrantAbilityPermanently(FlyingTickAbility.GetAbilityData(), 1, LevelComparison.None, this);
Events.Subscribe(WeaponStoppedFlyingEventTag, _ => { _weaponFlyingAbility.Cancel(); }); Events.Subscribe(WeaponStoppedFlyingEventTag, _ => { _weaponFlyingAbility.Cancel(); });
} }
if (PlantedTickAbility != null) if (PlantedTickAbility != null)
{ {
WeaponPlantedAbilityTag = Tag.RequestTag(TagsManager,"abilities.weapon.planted");
_weaponPlantedAbility = Abilities.GrantAbilityPermanently(PlantedTickAbility.GetAbilityData(), 1, LevelComparison.None, this); _weaponPlantedAbility = Abilities.GrantAbilityPermanently(PlantedTickAbility.GetAbilityData(), 1, LevelComparison.None, this);
Events.Subscribe(WeaponUnplantedEventTag, _ => { _weaponPlantedAbility.Cancel(); }); Events.Subscribe(WeaponUnplantedEventTag, _ => { _weaponPlantedAbility.Cancel(); });
} }
@@ -460,6 +455,8 @@ public partial class WeaponSystem : RigidBody3D, IForgeEntity
public void PlantInEnemy(Node3D enemy) public void PlantInEnemy(Node3D enemy)
{ {
// GetTree().GetRoot().RemoveChild(this);
// enemy.AddChild(this);
GetTree().GetRoot().CallDeferred(Node.MethodName.RemoveChild, this); GetTree().GetRoot().CallDeferred(Node.MethodName.RemoveChild, this);
enemy.CallDeferred(Node.MethodName.AddChild, this); enemy.CallDeferred(Node.MethodName.AddChild, this);
@@ -489,8 +486,9 @@ public partial class WeaponSystem : RigidBody3D, IForgeEntity
// WeaponLocationIndicatorMaterial.StencilColor = new Color(1f, 0.2f, 0.2f); // WeaponLocationIndicatorMaterial.StencilColor = new Color(1f, 0.2f, 0.2f);
if (PlantObject is Node3D node) if (PlantObject is Node3D node)
PlantInEnemy(node); PlantInEnemy(node);
_weaponState.SendEvent("plant"); _weaponState.CallDeferred(StateChart.MethodName.SendEvent, "plant");
// _weaponState.SendEvent("plant");
CallDeferred(Node3D.MethodName.SetGlobalPosition, PlantLocation); CallDeferred(Node3D.MethodName.SetGlobalPosition, PlantLocation);
CallDeferred(Node3D.MethodName.LookAt, GlobalTransform.Origin + PlantNormal, Vector3.Up, true); CallDeferred(Node3D.MethodName.LookAt, GlobalTransform.Origin + PlantNormal, Vector3.Up, true);

View File

@@ -1,7 +1,6 @@
[gd_scene format=3 uid="uid://ckm3d6k08a72u"] [gd_scene format=3 uid="uid://ckm3d6k08a72u"]
[ext_resource type="Script" uid="uid://iii3wfto4t5b" path="res://scenes/player_controller/components/weapon/WeaponSystem.cs" id="1_csqwk"] [ext_resource type="Script" uid="uid://iii3wfto4t5b" path="res://scenes/player_controller/components/weapon/WeaponSystem.cs" id="1_csqwk"]
[ext_resource type="Resource" uid="uid://dgjsi1my7nlnk" path="res://forge/resources/ability_datas/player_hit.tres" id="2_2wsgo"]
[ext_resource type="Script" uid="uid://cw525n4mjqgw0" path="res://addons/forge/resources/ForgeTagContainer.cs" id="2_l1xlx"] [ext_resource type="Script" uid="uid://cw525n4mjqgw0" path="res://addons/forge/resources/ForgeTagContainer.cs" id="2_l1xlx"]
[ext_resource type="Script" uid="uid://cxihb42t2mfqi" path="res://addons/forge/nodes/ForgeAttributeSet.cs" id="3_3xjpi"] [ext_resource type="Script" uid="uid://cxihb42t2mfqi" path="res://addons/forge/nodes/ForgeAttributeSet.cs" id="3_3xjpi"]
[ext_resource type="Script" uid="uid://couw105c3bde4" path="res://addons/godot_state_charts/state_chart.gd" id="3_5owyf"] [ext_resource type="Script" uid="uid://couw105c3bde4" path="res://addons/godot_state_charts/state_chart.gd" id="3_5owyf"]
@@ -23,9 +22,9 @@
[ext_resource type="Script" uid="uid://72kj3n4lm1em" path="res://addons/forge/resources/components/ForgeGrantAbilityConfig.cs" id="14_i0jsb"] [ext_resource type="Script" uid="uid://72kj3n4lm1em" path="res://addons/forge/resources/components/ForgeGrantAbilityConfig.cs" id="14_i0jsb"]
[ext_resource type="Script" uid="uid://b3wo2uge4ddnj" path="res://addons/forge/resources/components/GrantAbility.cs" id="15_a8u16"] [ext_resource type="Script" uid="uid://b3wo2uge4ddnj" path="res://addons/forge/resources/components/GrantAbility.cs" id="15_a8u16"]
[sub_resource type="Resource" id="Resource_7bruw"] [sub_resource type="Resource" id="Resource_rgbou"]
script = ExtResource("2_l1xlx") script = ExtResource("2_l1xlx")
ContainerTags = Array[String](["weapon"]) ContainerTags = Array[String](["objects.weapon"])
metadata/_custom_type_script = "uid://cw525n4mjqgw0" metadata/_custom_type_script = "uid://cw525n4mjqgw0"
[sub_resource type="Resource" id="Resource_pgbtr"] [sub_resource type="Resource" id="Resource_pgbtr"]
@@ -125,13 +124,12 @@ continuous_cd = true
contact_monitor = true contact_monitor = true
max_contacts_reported = 1 max_contacts_reported = 1
script = ExtResource("1_csqwk") script = ExtResource("1_csqwk")
OnPlantedInEnemy = ExtResource("2_2wsgo")
FlyingTickAbility = ExtResource("4_7bruw") FlyingTickAbility = ExtResource("4_7bruw")
PlantedTickAbility = ExtResource("3_7bruw") PlantedTickAbility = ExtResource("3_7bruw")
[node name="ForgeEntityNode" type="Node3D" parent="." unique_id=1798885192] [node name="ForgeEntityNode" type="Node3D" parent="." unique_id=1798885192]
script = ExtResource("5_7bruw") script = ExtResource("5_7bruw")
BaseTags = SubResource("Resource_7bruw") BaseTags = SubResource("Resource_rgbou")
metadata/_custom_type_script = "uid://rpcbb54q4atx" metadata/_custom_type_script = "uid://rpcbb54q4atx"
[node name="WeaponAttributeSet" type="Node" parent="ForgeEntityNode" unique_id=14845649] [node name="WeaponAttributeSet" type="Node" parent="ForgeEntityNode" unique_id=14845649]

View File

@@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using Chickensoft.AutoInject; using Chickensoft.AutoInject;
using Chickensoft.Introspection; using Chickensoft.Introspection;
using Chickensoft.Sync.Primitives; using Chickensoft.Sync.Primitives;
@@ -22,6 +23,7 @@ using Godot;
using GodotStateCharts; using GodotStateCharts;
using Movementtests.addons.godot_state_charts.csharp; using Movementtests.addons.godot_state_charts.csharp;
using Movementtests.forge.abilities;
using Movementtests.interfaces; using Movementtests.interfaces;
using Movementtests.systems; using Movementtests.systems;
using Movementtests.player_controller.Scripts; using Movementtests.player_controller.Scripts;
@@ -36,9 +38,11 @@ public record struct EmpoweredActionPayload;
[GlobalClass, Icon("res://assets/ui/IconGodotNode/node_3D/icon_character.png"), Meta(typeof(IAutoNode))] [GlobalClass, Icon("res://assets/ui/IconGodotNode/node_3D/icon_character.png"), Meta(typeof(IAutoNode))]
public partial class PlayerController : CharacterBody3D, IForgeEntity, ICueHandler, IDisposable public partial class PlayerController : CharacterBody3D, IForgeEntity, ICueHandler, IDisposable, ITargetable
{ {
public override void _Notification(int what) => this.Notify(what); public override void _Notification(int what) => this.Notify(what);
public record struct OnParryPayload(Vector3 ForwardVector);
#region Dependencies #region Dependencies
[Dependency] [Dependency]
@@ -97,6 +101,7 @@ public partial class PlayerController : CharacterBody3D, IForgeEntity, ICueHandl
[Node("CeilingDetector")] public required ShapeCast3D CeilingDetector { get; set; } [Node("CeilingDetector")] public required ShapeCast3D CeilingDetector { get; set; }
[Node("DirectGroundDetector")] public required RayCast3D DirectGroundDetector { get; set; } [Node("DirectGroundDetector")] public required RayCast3D DirectGroundDetector { get; set; }
[Node("%WeaponHitbox")] public required Area3D WeaponHitbox { get; set; } [Node("%WeaponHitbox")] public required Area3D WeaponHitbox { get; set; }
[Node("%Parrybox")] public required Area3D Parrybox { get; set; }
[Node("SFXPlayer")] public required AudioStreamPlayer3D SfxPlayer { get; set; } [Node("SFXPlayer")] public required AudioStreamPlayer3D SfxPlayer { get; set; }
[Node("DashDamage")] public required ShapeCast3D DashDamageDetector { get; set; } [Node("DashDamage")] public required ShapeCast3D DashDamageDetector { get; set; }
[Node("SlidingEnemyDetector")] public required Area3D SlidingEnemyDetector { get; set; } [Node("SlidingEnemyDetector")] public required Area3D SlidingEnemyDetector { get; set; }
@@ -461,6 +466,7 @@ public partial class PlayerController : CharacterBody3D, IForgeEntity, ICueHandl
// Damage dealing // Damage dealing
private readonly List<IForgeEntity> _hitEnemies = []; private readonly List<IForgeEntity> _hitEnemies = [];
private readonly List<IForgeEntity> _parriedEntities = [];
#endregion #endregion
@@ -506,8 +512,8 @@ public partial class PlayerController : CharacterBody3D, IForgeEntity, ICueHandl
_playerRadius = playerShape.Radius; _playerRadius = playerShape.Radius;
// Combat stuff // Combat stuff
WeaponHitbox.Monitoring = false;
WeaponHitbox.BodyEntered += RegisterHitEnnemy; WeaponHitbox.BodyEntered += RegisterHitEnnemy;
Parrybox.BodyEntered += RegisterParry;
#region StateManagement #region StateManagement
@@ -569,6 +575,8 @@ public partial class PlayerController : CharacterBody3D, IForgeEntity, ICueHandl
HeadSystem.Init(); HeadSystem.Init();
HeadSystem.HitboxActivated += OnHitboxActivated; HeadSystem.HitboxActivated += OnHitboxActivated;
HeadSystem.HitboxDeactivated += OnHitboxDeactivated; HeadSystem.HitboxDeactivated += OnHitboxDeactivated;
HeadSystem.ParryboxActivated += OnParryboxActivated;
HeadSystem.ParryboxDeactivated += OnParryboxDeactivated;
HeadSystem.StepFoot += OnFootStepped; HeadSystem.StepFoot += OnFootStepped;
HeadSystem.DeathAnimationFinished += OnDeathAnimationFinished; HeadSystem.DeathAnimationFinished += OnDeathAnimationFinished;
@@ -670,8 +678,8 @@ public partial class PlayerController : CharacterBody3D, IForgeEntity, ICueHandl
// Forge events // Forge events
HealthAttribute.OnValueChanged += OnHealthChanged; HealthAttribute.OnValueChanged += OnHealthChanged;
var weaponLeftToken = WeaponSystem.Events.Subscribe(WeaponSystem.WeaponStartedFlyingEventTag, OnWeaponLeft); // var weaponLeftToken = WeaponSystem.Events.Subscribe(WeaponSystem.WeaponStartedFlyingEventTag, OnWeaponLeft);
var weaponLandedToken = WeaponSystem.Events.Subscribe(WeaponSystem.WeaponStoppedFlyingEventTag, OnWeaponLanded); // var weaponLandedToken = WeaponSystem.Events.Subscribe(WeaponSystem.WeaponStoppedFlyingEventTag, OnWeaponLanded);
} }
#region LifecycleManagement #region LifecycleManagement
@@ -1150,6 +1158,9 @@ public partial class PlayerController : CharacterBody3D, IForgeEntity, ICueHandl
var wallHugContactPoint = _onWallRunning.Active ? _currentWallContactPoint : Vector3.Zero; var wallHugContactPoint = _onWallRunning.Active ? _currentWallContactPoint : Vector3.Zero;
var moveInput = GetGlobalMoveInput(); var moveInput = GetGlobalMoveInput();
WeaponHitbox.SetRotation(HeadSystem.GetGlobalLookRotation());
Parrybox.SetRotation(HeadSystem.GetGlobalLookRotation());
if (_isUsingGamepad) if (_isUsingGamepad)
inputLookDir += ComputeAimAssist(); inputLookDir += ComputeAimAssist();
@@ -2125,7 +2136,7 @@ public partial class PlayerController : CharacterBody3D, IForgeEntity, ICueHandl
if (!HasParry) return; if (!HasParry) return;
var attackToDo = _isEnemyInDashAttackRange ? "dash_parry" : "standard_parry"; var attackToDo = _isEnemyInDashAttackRange ? "dash_parry" : "standard_parry";
_playerState.SendEvent(attackToDo); _playerState.SendEvent("standard_parry");
} }
/////////////////////////// ///////////////////////////
@@ -2456,7 +2467,7 @@ public partial class PlayerController : CharacterBody3D, IForgeEntity, ICueHandl
// else HeadSystem.OnHit(); // else HeadSystem.OnHit();
// var streamName = isParry ? "parry" : "attacks"; // var streamName = isParry ? "parry" : "attacks";
_audioStream.SwitchToClipByName("dash"); _audioStream.SwitchToClipByName("dash");
IsInvincible = true; OnHitInvincibility();
var plannedDashLocation = _targetLocation + Vector3.Down*_playerHeight/2; var plannedDashLocation = _targetLocation + Vector3.Down*_playerHeight/2;
// var enemySurfaceQuery = PhysicsRayQueryParameters3D.Create(HeadSystem.GlobalPosition, plannedDashLocation, DashSystem.DashCast3D.CollisionMask); // var enemySurfaceQuery = PhysicsRayQueryParameters3D.Create(HeadSystem.GlobalPosition, plannedDashLocation, DashSystem.DashCast3D.CollisionMask);
@@ -2500,7 +2511,7 @@ public partial class PlayerController : CharacterBody3D, IForgeEntity, ICueHandl
{ {
disableable.Disable(); disableable.Disable();
} }
IsInvincible = false; // IsInvincible = false;
_playerState.SendEvent("attack_finished"); _playerState.SendEvent("attack_finished");
} }
@@ -2579,14 +2590,49 @@ public partial class PlayerController : CharacterBody3D, IForgeEntity, ICueHandl
WeaponHitbox.Monitoring = false; WeaponHitbox.Monitoring = false;
TriggerDamage(); TriggerDamage();
} }
public void OnParryboxActivated()
{
Parrybox.Monitoring = true;
}
public void OnParryboxDeactivated()
{
Parrybox.Monitoring = false;
TriggerParry();
}
public void RegisterHitEnnemy(Node3D body) public void RegisterHitEnnemy(Node3D body)
{ {
if (body is not IForgeEntity entity) return; if (body is not IForgeEntity entity) return;
_hitEnemies.Add(entity); _hitEnemies.Add(entity);
// return; }
// if (body is not IDamageable damageable) return; public void RegisterParry(Node3D body)
// _hitEnemies.Add(damageable); {
if (body is not IForgeEntity entity) return;
_parriedEntities.Add(entity);
// TriggerParry();
}
public void TriggerParry()
{
var payload = new OnProjectileSpawned(
Direction: -HeadSystem.GetGlobalForwardVector(),
SpeedMultiplier: 100,
SpawnOffset: -HeadSystem.GetGlobalForwardVector(),
CollisionOverride: WeaponSystem.CollisionMask);
foreach (var entity in _parriedEntities.Where(entity => IsInstanceValid(entity as Node)))
{
Events.Raise(new EventData<OnProjectileSpawned>
{
EventTags = Tag.RequestTag(TagsManager, "events.player.parry").GetSingleTagContainer()!,
Source = this,
Payload = payload
});
if (entity is IKillable killable) killable.Kill();
else if (entity is Node node) node.QueueFree();
}
_parriedEntities.Clear();
} }
public void TriggerDamage() public void TriggerDamage()
@@ -2708,4 +2754,9 @@ public partial class PlayerController : CharacterBody3D, IForgeEntity, ICueHandl
public void OnUpdate(IForgeEntity? target, CueParameters? parameters) public void OnUpdate(IForgeEntity? target, CueParameters? parameters)
{ {
} }
public Vector3 GetTargetGlobalPosition()
{
return HeadSystem.GlobalPosition;
}
} }

View File

@@ -0,0 +1,156 @@
using Godot;
using System;
using Chickensoft.AutoInject;
using Chickensoft.Introspection;
using Gamesmiths.Forge.Abilities;
using Gamesmiths.Forge.Core;
using Gamesmiths.Forge.Cues;
using Gamesmiths.Forge.Effects;
using Gamesmiths.Forge.Events;
using Gamesmiths.Forge.Godot.Resources.Abilities;
using Gamesmiths.Forge.Statescript;
using Gamesmiths.Forge.Tags;
using Movementtests.interfaces;
using Movementtests.managers;
using Movementtests.tools;
using Node = Godot.Node;
[GlobalClass, Icon("res://assets/ui/IconGodotNode/node_3D/icon_bullet.png"), Meta(typeof(IAutoNode))]
public partial class Projectile : RigidBody3D, IForgeEntity, ITargetable, IKillable, ISpawnable
{
public override void _Notification(int what) => this.Notify(what);
#region Dependencies
[Dependency]
public TagsManager TagsManager => this.DependOn<TagsManager>();
[Dependency]
public CuesManager CuesManager => this.DependOn<CuesManager>();
#endregion
#region IForgeEntity
// Perfectly forward the IForgeEntity interface to the ForgeEntity component
public EntityAttributes Attributes
{
get => ForgeEntity.Attributes;
set => ForgeEntity.Attributes = value;
}
public EntityTags Tags
{
get => ForgeEntity.Tags;
set => ForgeEntity.Tags = value;
}
public EffectsManager EffectsManager
{
get => ForgeEntity.EffectsManager;
set => ForgeEntity.EffectsManager = value;
}
public EntityAbilities Abilities
{
get => ForgeEntity.Abilities;
set => ForgeEntity.Abilities = value;
}
public EventManager Events
{
get => ForgeEntity.Events;
set => ForgeEntity.Events = value;
}
public Variables SharedVariables
{
get => ForgeEntity.SharedVariables;
set => ForgeEntity.SharedVariables = value;
}
#endregion
[Node("ForgeEntityNode")] public required ForgeEntityNode ForgeEntity { get; set;}
[Export] public float Damage = 10f;
[Export] public float Speed = 10f;
[Export] public float HomingFactor = 0.2f;
public Node3D? Target { get; set; }
public Vector3? ImpulseDirection { get; set; }
public TokenManager.Token? Token { get; set; }
public void Init()
{
ApplyCentralImpulse(ComputeImpulseToTarget());
}
public Vector3 ComputeImpulseToTarget()
{
if (ImpulseDirection != null) return ImpulseDirection.Value;
if (Target == null) return Vector3.Zero;
return Vector3.Up * Speed;
var targetDir = GlobalPosition.DirectionTo(Target.GlobalPosition);
var hDir = new Vector3(targetDir.X, 0, targetDir.Z).Normalized();
var throwDir = (hDir + 3*Vector3.Up).Normalized();
var distanceTo = GlobalPosition.DistanceTo(Target.GlobalPosition);
return throwDir * distanceTo*0.8f;
}
public override void _IntegrateForces(PhysicsDirectBodyState3D state)
{
base._IntegrateForces(state);
if (Target == null) return;
var targetPos = Target is ITargetable targetable ? targetable.GetTargetGlobalPosition() : Target.GlobalPosition;
var targetVel = state.LinearVelocity + GlobalPosition.DirectionTo(targetPos) * HomingFactor;
if (targetVel.Length() > Speed) targetVel = targetVel.Normalized() * Speed;
state.LinearVelocity = targetVel;
// var targetDir = GlobalPosition.DirectionTo(targetPos);
// var hDir = new Vector3(targetDir.X, 0, targetDir.Z).Normalized();
// var currentVelocityHDir = new Vector3(state.LinearVelocity.X, 0, state.LinearVelocity.Z);
// var finalHDir = hDir*HomingFactor + currentVelocityHDir;
// var combinedVelocity = new Vector3(finalHDir.X, state.LinearVelocity.Y, finalHDir.Z);
// if (combinedVelocity.Length() > Speed) combinedVelocity = combinedVelocity.Normalized() * Speed;
// state.LinearVelocity = combinedVelocity;
// state.LinearVelocity += targetDir/5.0f;
}
public void OnResolved()
{
BodyEntered += OnProjectileHit;
// Events.Subscribe(Tag.RequestTag(TagsManager, "events.weapon.flyingtick"), data => { GD.Print("tick"); });
}
private void OnProjectileHit(Node body)
{
if (body is IForgeEntity entity)
{
Events.Raise(new EventData
{
EventTags = Tag.RequestTag(TagsManager, "events.combat.hit").GetSingleTagContainer()!,
Source = this,
Target = entity,
EventMagnitude = Damage
});
}
Events.Raise(new EventData
{
EventTags = Tag.RequestTag(TagsManager, "events.weapon.planted").GetSingleTagContainer()!,
Source = this,
EventMagnitude = Damage
});
Kill();
}
public Vector3 GetTargetGlobalPosition()
{
return GlobalPosition;
}
public void Kill()
{
Token?.OnUse.Invoke();
QueueFree(); // If thrown offmap
}
}

View File

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

View File

@@ -0,0 +1,238 @@
[gd_scene format=3 uid="uid://bhp6qunnwhncf"]
[ext_resource type="Script" uid="uid://bmpfvyccbou3b" path="res://scenes/projectile/Projectile.cs" id="1_bwggc"]
[ext_resource type="Resource" uid="uid://btnnpqann3ktp" path="res://forge/resources/ability_datas/weapon_flying_tick_ability.tres" id="2_gxghe"]
[ext_resource type="Script" uid="uid://rpcbb54q4atx" path="res://forge/ForgeEntityNode.cs" id="3_0m0gv"]
[ext_resource type="Script" uid="uid://cxihb42t2mfqi" path="res://addons/forge/nodes/ForgeAttributeSet.cs" id="3_8gwhl"]
[ext_resource type="Script" uid="uid://ccovd5i0wr3kk" path="res://addons/forge/editor/attributes/AttributeValues.cs" id="4_bwggc"]
[ext_resource type="Script" uid="uid://dps0oef50noil" path="res://addons/forge/nodes/ForgeEffect.cs" id="6_j80uc"]
[ext_resource type="Script" uid="uid://dhxfbxh54pyxp" path="res://addons/forge/resources/abilities/ForgeAbilityData.cs" id="7_hwhpw"]
[ext_resource type="Resource" uid="uid://bpovqvlqv5bs5" path="res://forge/resources/effect_components/damageable.tres" id="7_ufml1"]
[ext_resource type="Resource" uid="uid://sn6kndc6ukic" path="res://forge/resources/tag_containers/on_damage_dealt.tres" id="8_4opcx"]
[ext_resource type="Script" uid="uid://1hgogislo1l6" path="res://addons/forge/resources/magnitudes/ForgeScalableInt.cs" id="8_eb14h"]
[ext_resource type="Resource" uid="uid://5tr54q0rdpho" path="res://forge/resources/tag_containers/on_damage_taken.tres" id="9_0m0gv"]
[ext_resource type="Script" uid="uid://72kj3n4lm1em" path="res://addons/forge/resources/components/ForgeGrantAbilityConfig.cs" id="9_ah28r"]
[ext_resource type="Script" uid="uid://cfx62w40nd84v" path="res://forge/calculators/ForgeDamageExecution.cs" id="10_gxghe"]
[ext_resource type="Script" uid="uid://b3wo2uge4ddnj" path="res://addons/forge/resources/components/GrantAbility.cs" id="10_mss85"]
[ext_resource type="Script" uid="uid://b83hf13nj37k3" path="res://addons/forge/resources/ForgeEffectData.cs" id="11_aepsp"]
[ext_resource type="Script" uid="uid://cn3b4ya15fg7e" path="res://addons/forge/resources/magnitudes/ForgeScalableFloat.cs" id="12_6slh1"]
[ext_resource type="Script" uid="uid://bdfcavbjyhxxa" path="res://addons/forge/resources/ForgeModifier.cs" id="13_nh3w7"]
[ext_resource type="Script" uid="uid://n6efm5o4uxvr" path="res://forge/abilities/ForgeSimpleHitBehavior.cs" id="15_7ctk5"]
[ext_resource type="Script" uid="uid://dpakv7agvir6y" path="res://addons/forge/resources/ForgeTag.cs" id="16_4opcx"]
[ext_resource type="Script" uid="uid://bnee6amtc2bhj" path="res://forge/abilities/ForgeExplodingSwordBehavior.cs" id="19_0m0gv"]
[ext_resource type="PackedScene" uid="uid://duju3atqgltkg" path="res://scenes/explosion/explosion.tscn" id="19_gxghe"]
[sub_resource type="Resource" id="Resource_n3xfy"]
script = ExtResource("10_gxghe")
DamageType = 1
DamageDealerEventTags = ExtResource("8_4opcx")
DamageReceiverEventTags = ExtResource("9_0m0gv")
metadata/_custom_type_script = "uid://cfx62w40nd84v"
[sub_resource type="Resource" id="Resource_5se5x"]
script = ExtResource("8_eb14h")
BaseValue = 1
[sub_resource type="Resource" id="Resource_tsnac"]
script = ExtResource("12_6slh1")
BaseValue = 1.0
[sub_resource type="Resource" id="Resource_4tmlu"]
script = ExtResource("12_6slh1")
[sub_resource type="Resource" id="Resource_nsq4o"]
script = ExtResource("12_6slh1")
[sub_resource type="Resource" id="Resource_wvq73"]
script = ExtResource("12_6slh1")
BaseValue = 1.0
[sub_resource type="Resource" id="Resource_ocyfe"]
script = ExtResource("12_6slh1")
[sub_resource type="Resource" id="Resource_idlka"]
script = ExtResource("12_6slh1")
[sub_resource type="Resource" id="Resource_uh7hr"]
script = ExtResource("12_6slh1")
BaseValue = 1.0
metadata/_custom_type_script = "uid://cn3b4ya15fg7e"
[sub_resource type="Resource" id="Resource_ckp55"]
script = ExtResource("13_nh3w7")
Attribute = "MetaAttributeSet.IncomingDamage"
Operation = 2
ScalableFloat = SubResource("Resource_uh7hr")
Coefficient = SubResource("Resource_wvq73")
PreMultiplyAdditiveValue = SubResource("Resource_idlka")
PostMultiplyAdditiveValue = SubResource("Resource_ocyfe")
CalculatorCoefficient = SubResource("Resource_tsnac")
CalculatorPreMultiplyAdditiveValue = SubResource("Resource_nsq4o")
CalculatorPostMultiplyAdditiveValue = SubResource("Resource_4tmlu")
metadata/_custom_type_script = "uid://bdfcavbjyhxxa"
[sub_resource type="Resource" id="Resource_yl520"]
script = ExtResource("8_eb14h")
BaseValue = 1
[sub_resource type="Resource" id="Resource_1kwc2"]
script = ExtResource("11_aepsp")
Name = "Projectile damate"
Modifiers = Array[Object]([SubResource("Resource_ckp55")])
Components = Array[Object]([ExtResource("7_ufml1")])
Executions = Array[Object]([SubResource("Resource_n3xfy")])
StackLimit = SubResource("Resource_yl520")
InitialStack = SubResource("Resource_5se5x")
Cues = []
metadata/_custom_type_script = "uid://b83hf13nj37k3"
[sub_resource type="Resource" id="Resource_3icyc"]
script = ExtResource("15_7ctk5")
DamageEffect = SubResource("Resource_1kwc2")
metadata/_custom_type_script = "uid://n6efm5o4uxvr"
[sub_resource type="Resource" id="Resource_7ctk5"]
script = ExtResource("16_4opcx")
Tag = "events.combat.hit"
metadata/_custom_type_script = "uid://dpakv7agvir6y"
[sub_resource type="Resource" id="Resource_iburv"]
script = ExtResource("7_hwhpw")
Name = "On player hit"
CooldownEffects = []
AbilityBehavior = SubResource("Resource_3icyc")
TriggerSource = 1
TriggerTag = SubResource("Resource_7ctk5")
metadata/_custom_type_script = "uid://dhxfbxh54pyxp"
[sub_resource type="Resource" id="Resource_ufml1"]
script = ExtResource("8_eb14h")
BaseValue = 1
[sub_resource type="Resource" id="Resource_4opcx"]
script = ExtResource("9_ah28r")
AbilityData = SubResource("Resource_iburv")
AbilityLevel = SubResource("Resource_ufml1")
metadata/_custom_type_script = "uid://72kj3n4lm1em"
[sub_resource type="Resource" id="Resource_uhv33"]
script = ExtResource("19_0m0gv")
Explosion = ExtResource("19_gxghe")
Radius = 10.0
metadata/_custom_type_script = "uid://bnee6amtc2bhj"
[sub_resource type="Resource" id="Resource_hnbha"]
script = ExtResource("16_4opcx")
Tag = "events.weapon.planted"
metadata/_custom_type_script = "uid://dpakv7agvir6y"
[sub_resource type="Resource" id="Resource_ynqlf"]
script = ExtResource("7_hwhpw")
Name = "Explode on contact"
CooldownEffects = []
AbilityBehavior = SubResource("Resource_uhv33")
TriggerSource = 1
TriggerTag = SubResource("Resource_hnbha")
metadata/_custom_type_script = "uid://dhxfbxh54pyxp"
[sub_resource type="Resource" id="Resource_ltce2"]
script = ExtResource("8_eb14h")
BaseValue = 1
[sub_resource type="Resource" id="Resource_xxtl1"]
script = ExtResource("9_ah28r")
AbilityData = SubResource("Resource_ynqlf")
AbilityLevel = SubResource("Resource_ltce2")
metadata/_custom_type_script = "uid://72kj3n4lm1em"
[sub_resource type="Resource" id="Resource_h6udq"]
script = ExtResource("8_eb14h")
BaseValue = 1
[sub_resource type="Resource" id="Resource_k64oi"]
script = ExtResource("9_ah28r")
AbilityData = ExtResource("2_gxghe")
AbilityLevel = SubResource("Resource_h6udq")
TryActivateOnGrant = true
metadata/_custom_type_script = "uid://72kj3n4lm1em"
[sub_resource type="Resource" id="Resource_0m0gv"]
script = ExtResource("10_mss85")
GrantAbilityConfigs = [SubResource("Resource_4opcx"), SubResource("Resource_xxtl1"), SubResource("Resource_k64oi")]
metadata/_custom_type_script = "uid://b3wo2uge4ddnj"
[sub_resource type="Resource" id="Resource_gxghe"]
script = ExtResource("8_eb14h")
BaseValue = 1
[sub_resource type="Resource" id="Resource_6slh1"]
script = ExtResource("8_eb14h")
BaseValue = 1
[sub_resource type="Resource" id="Resource_nh3w7"]
script = ExtResource("11_aepsp")
Name = "Grant abilities"
Modifiers = []
Components = Array[Object]([SubResource("Resource_0m0gv")])
Executions = []
StackLimit = SubResource("Resource_6slh1")
InitialStack = SubResource("Resource_gxghe")
Cues = []
metadata/_custom_type_script = "uid://b83hf13nj37k3"
[sub_resource type="SphereShape3D" id="SphereShape3D_16rri"]
radius = 0.2
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_bwggc"]
albedo_color = Color(0.9999997, 0.34948558, 0.033228315, 1)
[sub_resource type="SphereMesh" id="SphereMesh_p7dfg"]
material = SubResource("StandardMaterial3D_bwggc")
radius = 0.4
height = 0.8
[sub_resource type="SphereShape3D" id="SphereShape3D_p7dfg"]
radius = 2.0
[node name="Projectile" type="RigidBody3D" unique_id=1536748036]
collision_layer = 32
collision_mask = 289
continuous_cd = true
contact_monitor = true
max_contacts_reported = 1
script = ExtResource("1_bwggc")
Speed = 20.0
HomingFactor = 0.8
[node name="ForgeEntityNode" type="Node3D" parent="." unique_id=1961065393]
script = ExtResource("3_0m0gv")
metadata/_custom_type_script = "uid://rpcbb54q4atx"
[node name="ForgeAttributeSet" type="Node" parent="ForgeEntityNode" unique_id=100377985]
script = ExtResource("3_8gwhl")
AttributeSetClass = "MetaAttributeSet"
InitialAttributeValues = Dictionary[String, ExtResource("4_bwggc")]({
"IncomingDamage": Object(RefCounted,"script":ExtResource("4_bwggc"),"Default":0,"Min":0,"Max":1000)
,
"Level": Object(RefCounted,"script":ExtResource("4_bwggc"),"Default":1,"Min":1,"Max":1000)
})
metadata/_custom_type_script = "uid://cxihb42t2mfqi"
[node name="GrantAbilities" type="Node" parent="ForgeEntityNode" unique_id=699633438]
script = ExtResource("6_j80uc")
EffectData = SubResource("Resource_nh3w7")
metadata/_custom_type_script = "uid://dps0oef50noil"
[node name="CollisionShape3D" type="CollisionShape3D" parent="." unique_id=2109664666]
shape = SubResource("SphereShape3D_16rri")
[node name="MeshInstance3D" type="MeshInstance3D" parent="." unique_id=472918778]
mesh = SubResource("SphereMesh_p7dfg")
[node name="AimAssistTarget" type="Area3D" parent="." unique_id=734689820]
collision_layer = 64
collision_mask = 0
[node name="CollisionShape3D" type="CollisionShape3D" parent="AimAssistTarget" unique_id=1220912429]
shape = SubResource("SphereShape3D_p7dfg")

View File

@@ -1,11 +1,20 @@
using Godot; using Godot;
using System; using System;
using Chickensoft.AutoInject;
using Chickensoft.Introspection;
using Movementtests.managers;
[GlobalClass, Icon("res://assets/ui/IconGodotNode/node_3D/icon_duplicate.png")] [GlobalClass, Icon("res://assets/ui/IconGodotNode/node_3D/icon_duplicate.png"), Meta(typeof(IAutoNode))]
public partial class Spawner : Node3D public partial class Spawner : Node3D
{ {
[Export(PropertyHint.NodeType)] public override void _Notification(int what) => this.Notify(what);
[Dependency] public WaveManager WaveManager => this.DependOn<WaveManager>();
[Export(PropertyHint.NodeType)]
public PackedScene? EnemyToSpawn { get; set; } public PackedScene? EnemyToSpawn { get; set; }
[Export] public Godot.Collections.Array<EnemyDescription.EnemyType> SupportedEnemyTypes { get; set; } = [];
[Export] [Export]
public RMovement? MovementInputs { get; set; } public RMovement? MovementInputs { get; set; }
@@ -18,37 +27,56 @@ public partial class Spawner : Node3D
[Export] [Export]
public bool IsActiveOnStart { get; set; } = true; public bool IsActiveOnStart { get; set; } = true;
private Timer _timer; [Node("Timer")] private Timer SpawnTimer { get; set; }
public override void _Ready() public void OnReady()
{ {
_timer = GetNode<Timer>("Timer"); SpawnTimer.WaitTime = SpawnInterval;
_timer.WaitTime = SpawnInterval; SpawnTimer.Timeout += Spawn;
_timer.Timeout += Spawn;
if (IsActiveOnStart) StartSpawning(); if (IsActiveOnStart) StartSpawning();
} }
public void OnResolved()
{
WaveManager.RegisterSpawner(this);
}
public void Spawn() public void Spawn()
{ {
if (EnemyToSpawn == null || !EnemyToSpawn.CanInstantiate()) return; if (EnemyToSpawn == null || !EnemyToSpawn.CanInstantiate()) return;
if (EnemyToSpawn.Instantiate() is not Enemy spawnedInstance) return; if (EnemyToSpawn.Instantiate() is not Enemy spawnedInstance) return;
spawnedInstance.RequestReady();
GetTree().GetCurrentScene().AddChild(spawnedInstance);
spawnedInstance.GlobalPosition = GlobalPosition;
spawnedInstance.Target = Target; spawnedInstance.Target = Target;
spawnedInstance.RMovement = MovementInputs; if (MovementInputs != null)
spawnedInstance.RMovement = MovementInputs;
spawnedInstance.Init(); spawnedInstance.Init();
GetTree().GetCurrentScene().AddChild(spawnedInstance);
spawnedInstance.GlobalPosition = GlobalPosition;
}
public Enemy? SpawnEnemy(EnemyDescription description)
{
if (description.Scene.Instantiate() is not Enemy spawnedInstance) return null;
spawnedInstance.Target = Target;
if (description.MovementOverride is not null)
spawnedInstance.RMovement = description.MovementOverride;
spawnedInstance.Init();
GetTree().GetCurrentScene().AddChild(spawnedInstance);
spawnedInstance.GlobalPosition = GlobalPosition;
return spawnedInstance;
} }
public void StartSpawning() public void StartSpawning()
{ {
_timer.Start(); SpawnTimer.Start();
} }
public void StopSpawning() public void StopSpawning()
{ {
_timer.Stop(); SpawnTimer.Stop();
} }
} }

View File

@@ -20,9 +20,9 @@ public class MovementSystemUnitTest
var inputs = new MovementInputs( var inputs = new MovementInputs(
Velocity: Vector3.Zero, Velocity: Vector3.Zero,
TargetLocation: new Vector3(10, 0, 0), TargetLocation: new Vector3(10, 0, 0),
isOnFloor: false, IsOnFloor: false,
gravity: Vector3.Down * 9.8f, Gravity: Vector3.Down * 9.8f,
delta: 1.0 Delta: 1.0
); );
var v = move.ComputeVelocity(inputs); var v = move.ComputeVelocity(inputs);

19
tools/IterableUtils.cs Normal file
View File

@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
namespace Movementtests.tools;
public static class IterableUtils
{
private static readonly Random Rng = new Random();
public static void Shuffle<T>(this IList<T> list)
{
var n = list.Count;
while (n > 1) {
n--;
var k = Rng.Next(n + 1);
(list[k], list[n]) = (list[n], list[k]);
}
}
}

View File

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