Compare commits
5 Commits
95616f61fc
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 7bf19868e7 | |||
| d1f83525b1 | |||
| 4bcbda9690 | |||
| e51ef5a517 | |||
| 50de6abb5d |
2
Movement tests.sln.DotSettings
Normal file
2
Movement tests.sln.DotSettings
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||||
|
<s:Boolean x:Key="/Default/CodeEditing/SuppressNullableWarningFix/Enabled/@EntryValue">False</s:Boolean></wpf:ResourceDictionary>
|
||||||
@@ -9,14 +9,43 @@ public partial class ForgeManager : Node
|
|||||||
public CuesManager CuesManager { get; private set; } = new CuesManager();
|
public CuesManager CuesManager { get; private set; } = new CuesManager();
|
||||||
public TagsManager TagsManager { get; private set; } = new TagsManager(
|
public TagsManager TagsManager { get; private set; } = new TagsManager(
|
||||||
[
|
[
|
||||||
|
// entities
|
||||||
"character.player",
|
"character.player",
|
||||||
"class.warrior",
|
"weapon",
|
||||||
|
|
||||||
|
// Statuses
|
||||||
"status.stunned",
|
"status.stunned",
|
||||||
"status.burning",
|
|
||||||
"status.immune.fire",
|
// Abilities
|
||||||
"cues.damage.fire",
|
"abilities.weapon.land",
|
||||||
|
|
||||||
|
// Events
|
||||||
"events.combat.damage",
|
"events.combat.damage",
|
||||||
"events.combat.hit",
|
"events.combat.hit",
|
||||||
|
"events.weapon.land",
|
||||||
|
|
||||||
|
// Cooldowns
|
||||||
"cooldown.empoweredAction",
|
"cooldown.empoweredAction",
|
||||||
|
"cooldown.empoweredSwordThrow",
|
||||||
|
|
||||||
|
// Cues
|
||||||
|
"cues.resources.mana",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
public static ForgeManager GetForgeManager(Node node)
|
||||||
|
{
|
||||||
|
return node.GetTree().Root.GetNode<ForgeManager>("ForgeManager");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static TagsManager GetTagsManager(Node node)
|
||||||
|
{
|
||||||
|
return GetForgeManager(node).TagsManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static CuesManager GetCuesManager(Node node)
|
||||||
|
{
|
||||||
|
return GetForgeManager(node).CuesManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
41
forge/abilities/RAbilityBase.cs
Normal file
41
forge/abilities/RAbilityBase.cs
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
using System;
|
||||||
|
using Gamesmiths.Forge.Abilities;
|
||||||
|
using Gamesmiths.Forge.Cues;
|
||||||
|
using Gamesmiths.Forge.Effects;
|
||||||
|
using Gamesmiths.Forge.Effects.Components;
|
||||||
|
using Gamesmiths.Forge.Effects.Duration;
|
||||||
|
using Gamesmiths.Forge.Effects.Magnitudes;
|
||||||
|
using Gamesmiths.Forge.Effects.Modifiers;
|
||||||
|
using Gamesmiths.Forge.Tags;
|
||||||
|
using Godot;
|
||||||
|
using Movementtests.interfaces;
|
||||||
|
|
||||||
|
namespace Movementtests.forge.abilities;
|
||||||
|
|
||||||
|
[GlobalClass]
|
||||||
|
public partial class RAbilityBase(float cost, float cooldown) : Resource, IAbilityBase
|
||||||
|
{
|
||||||
|
[Export(PropertyHint.Range, "0,100,1,or_greater")]
|
||||||
|
public float Cost { get; set; } = cost;
|
||||||
|
[Export(PropertyHint.Range, "0,10,0.1,or_greater")]
|
||||||
|
public float Cooldown { get; set; } = cooldown;
|
||||||
|
|
||||||
|
public RAbilityBase() : this(20.0f, 0.0f)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual AbilityData Ability(TagsManager tagsManager, Node3D owner)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual EffectData CostEffect(TagsManager tagsManager)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual EffectData CooldownEffect(TagsManager tagsManager)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
1
forge/abilities/RAbilityBase.cs.uid
Normal file
1
forge/abilities/RAbilityBase.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://4eosgwb3h528
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using Gamesmiths.Forge.Abilities;
|
using Gamesmiths.Forge.Abilities;
|
||||||
|
using Gamesmiths.Forge.Cues;
|
||||||
using Gamesmiths.Forge.Effects;
|
using Gamesmiths.Forge.Effects;
|
||||||
using Gamesmiths.Forge.Effects.Components;
|
using Gamesmiths.Forge.Effects.Components;
|
||||||
using Gamesmiths.Forge.Effects.Duration;
|
using Gamesmiths.Forge.Effects.Duration;
|
||||||
@@ -25,7 +26,17 @@ public partial class REmpoweredAction(float cost, float cooldown, float manaRege
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public EffectData CostEffect()
|
public AbilityData Ability(TagsManager tagsManager)
|
||||||
|
{
|
||||||
|
return new AbilityData(
|
||||||
|
name: "Empowered Action",
|
||||||
|
costEffect: CostEffect(tagsManager),
|
||||||
|
cooldownEffects: [CooldownEffect(tagsManager)],
|
||||||
|
instancingPolicy: AbilityInstancingPolicy.PerEntity,
|
||||||
|
behaviorFactory: () => new EmpoweredActionBehavior());
|
||||||
|
}
|
||||||
|
|
||||||
|
public EffectData CostEffect(TagsManager tagsManager)
|
||||||
{
|
{
|
||||||
return new(
|
return new(
|
||||||
"Empowered Action Mana Cost",
|
"Empowered Action Mana Cost",
|
||||||
@@ -40,6 +51,16 @@ public partial class REmpoweredAction(float cost, float cooldown, float manaRege
|
|||||||
new ScalableFloat(-Cost)
|
new ScalableFloat(-Cost)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
},
|
||||||
|
cues: new []
|
||||||
|
{
|
||||||
|
new CueData(
|
||||||
|
CueTags: Tag.RequestTag(tagsManager, "cues.resources.mana").GetSingleTagContainer(),
|
||||||
|
MinValue: 0,
|
||||||
|
MaxValue: 100,
|
||||||
|
MagnitudeType: CueMagnitudeType.AttributeValueChange,
|
||||||
|
MagnitudeAttribute: "PlayerAttributeSet.Mana"
|
||||||
|
)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
104
forge/abilities/RExplodingSwordThrow.cs
Normal file
104
forge/abilities/RExplodingSwordThrow.cs
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
using Gamesmiths.Forge.Abilities;
|
||||||
|
using Gamesmiths.Forge.Cues;
|
||||||
|
using Gamesmiths.Forge.Effects;
|
||||||
|
using Gamesmiths.Forge.Effects.Components;
|
||||||
|
using Gamesmiths.Forge.Effects.Duration;
|
||||||
|
using Gamesmiths.Forge.Effects.Magnitudes;
|
||||||
|
using Gamesmiths.Forge.Effects.Modifiers;
|
||||||
|
using Gamesmiths.Forge.Tags;
|
||||||
|
using Godot;
|
||||||
|
|
||||||
|
namespace Movementtests.forge.abilities;
|
||||||
|
|
||||||
|
[GlobalClass, Icon("res://assets/ui/IconGodotNode/white/icon_projectile.png")]
|
||||||
|
public partial class RExplodingSwordThrow(PackedScene? explosion, float cost, float cooldown) : RAbilityBase(cost, cooldown)
|
||||||
|
{
|
||||||
|
[Export] public PackedScene? Explosion { get; set; } = explosion;
|
||||||
|
|
||||||
|
public RExplodingSwordThrow() : this(null, 20.0f, 0.0f)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override AbilityData Ability(TagsManager tagsManager, Node3D owner)
|
||||||
|
{
|
||||||
|
return new AbilityData(
|
||||||
|
name: "Exploding Sword Throw",
|
||||||
|
costEffect: CostEffect(tagsManager),
|
||||||
|
cooldownEffects: [CooldownEffect(tagsManager)],
|
||||||
|
abilityTags: Tag.RequestTag(tagsManager, "abilities.weapon.land").GetSingleTagContainer(),
|
||||||
|
instancingPolicy: AbilityInstancingPolicy.PerEntity,
|
||||||
|
behaviorFactory: () => new ExplodingSwordThrowBehavior(owner, Explosion));
|
||||||
|
}
|
||||||
|
|
||||||
|
public override EffectData CostEffect(TagsManager tagsManager)
|
||||||
|
{
|
||||||
|
return new(
|
||||||
|
"Exploding Sword Throw Mana Cost",
|
||||||
|
new DurationData(DurationType.Instant),
|
||||||
|
new[]
|
||||||
|
{
|
||||||
|
new Modifier(
|
||||||
|
"PlayerAttributeSet.Mana",
|
||||||
|
ModifierOperation.FlatBonus,
|
||||||
|
new ModifierMagnitude(
|
||||||
|
MagnitudeCalculationType.ScalableFloat,
|
||||||
|
new ScalableFloat(-Cost)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
},
|
||||||
|
cues: new []
|
||||||
|
{
|
||||||
|
new CueData(
|
||||||
|
CueTags: Tag.RequestTag(tagsManager, "cues.resources.mana").GetSingleTagContainer(),
|
||||||
|
MinValue: 0,
|
||||||
|
MaxValue: 100,
|
||||||
|
MagnitudeType: CueMagnitudeType.AttributeValueChange,
|
||||||
|
MagnitudeAttribute: "PlayerAttributeSet.Mana"
|
||||||
|
)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public override EffectData CooldownEffect(TagsManager tagsManager)
|
||||||
|
{
|
||||||
|
return new(
|
||||||
|
"Exploding Sword Throw Cooldown",
|
||||||
|
new DurationData(
|
||||||
|
DurationType.HasDuration,
|
||||||
|
new ModifierMagnitude(
|
||||||
|
MagnitudeCalculationType.ScalableFloat,
|
||||||
|
new ScalableFloat(Cooldown))),
|
||||||
|
effectComponents: new[]
|
||||||
|
{
|
||||||
|
new ModifierTagsEffectComponent(
|
||||||
|
tagsManager.RequestTagContainer(new[] { "cooldown.empoweredSwordThrow" })
|
||||||
|
)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ExplodingSwordThrowBehavior(Node3D owner, PackedScene? explosion) : IAbilityBehavior
|
||||||
|
{
|
||||||
|
private Node3D _owner = owner;
|
||||||
|
private PackedScene? _explosion = explosion;
|
||||||
|
public void OnStarted(AbilityBehaviorContext context)
|
||||||
|
{
|
||||||
|
if (_explosion?.Instantiate() is not Explosion explosion)
|
||||||
|
{
|
||||||
|
context.InstanceHandle.End();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
explosion.Radius = 10f;
|
||||||
|
_owner.GetTree().GetRoot().AddChild(explosion);
|
||||||
|
explosion.GlobalPosition = _owner.GlobalPosition;
|
||||||
|
|
||||||
|
context.AbilityHandle.CommitAbility();
|
||||||
|
context.InstanceHandle.End();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnEnded(AbilityBehaviorContext context)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
1
forge/abilities/RExplodingSwordThrow.cs.uid
Normal file
1
forge/abilities/RExplodingSwordThrow.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://rux15j7q78e8
|
||||||
@@ -1,8 +1,10 @@
|
|||||||
|
using Gamesmiths.Forge.Cues;
|
||||||
using Gamesmiths.Forge.Effects;
|
using Gamesmiths.Forge.Effects;
|
||||||
using Gamesmiths.Forge.Effects.Duration;
|
using Gamesmiths.Forge.Effects.Duration;
|
||||||
using Gamesmiths.Forge.Effects.Magnitudes;
|
using Gamesmiths.Forge.Effects.Magnitudes;
|
||||||
using Gamesmiths.Forge.Effects.Modifiers;
|
using Gamesmiths.Forge.Effects.Modifiers;
|
||||||
using Gamesmiths.Forge.Effects.Periodic;
|
using Gamesmiths.Forge.Effects.Periodic;
|
||||||
|
using Gamesmiths.Forge.Tags;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
|
||||||
namespace Movementtests.tools.effects;
|
namespace Movementtests.tools.effects;
|
||||||
@@ -13,14 +15,14 @@ public partial class RManaRegen(float manaRegenRate, float frequency) : Resource
|
|||||||
[Export(PropertyHint.Range, "0,100,0.1,or_greater")]
|
[Export(PropertyHint.Range, "0,100,0.1,or_greater")]
|
||||||
public float ManaRegenRate { get; set; } = manaRegenRate;
|
public float ManaRegenRate { get; set; } = manaRegenRate;
|
||||||
|
|
||||||
[Export(PropertyHint.Range, "0.01,1,0.1,or_greater")]
|
[Export(PropertyHint.Range, "0.01,1,0.01,or_greater")]
|
||||||
public float Frequency { get; set; } = frequency;
|
public float Frequency { get; set; } = frequency;
|
||||||
|
|
||||||
public RManaRegen() : this(1.0f, 0.1f)
|
public RManaRegen() : this(1.0f, 0.1f)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public EffectData ManaRegen()
|
public EffectData ManaRegen(TagsManager tagsManager)
|
||||||
{
|
{
|
||||||
return new EffectData(
|
return new EffectData(
|
||||||
"Mana Regen",
|
"Mana Regen",
|
||||||
@@ -36,6 +38,16 @@ public partial class RManaRegen(float manaRegenRate, float frequency) : Resource
|
|||||||
new ScalableFloat(ManaRegenRate * Frequency))
|
new ScalableFloat(ManaRegenRate * Frequency))
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
cues: new []
|
||||||
|
{
|
||||||
|
new CueData(
|
||||||
|
CueTags: Tag.RequestTag(tagsManager, "cues.resources.mana").GetSingleTagContainer(),
|
||||||
|
MinValue: 0,
|
||||||
|
MaxValue: 100,
|
||||||
|
MagnitudeType: CueMagnitudeType.AttributeValueChange,
|
||||||
|
MagnitudeAttribute: "PlayerAttributeSet.Mana"
|
||||||
|
)
|
||||||
|
},
|
||||||
periodicData: new PeriodicData(
|
periodicData: new PeriodicData(
|
||||||
Period: new ScalableFloat(Frequency),
|
Period: new ScalableFloat(Frequency),
|
||||||
ExecuteOnApplication: true,
|
ExecuteOnApplication: true,
|
||||||
|
|||||||
13
interfaces/IAbilityBase.cs
Normal file
13
interfaces/IAbilityBase.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using Gamesmiths.Forge.Abilities;
|
||||||
|
using Gamesmiths.Forge.Effects;
|
||||||
|
using Gamesmiths.Forge.Tags;
|
||||||
|
using Godot;
|
||||||
|
|
||||||
|
namespace Movementtests.interfaces;
|
||||||
|
|
||||||
|
public interface IAbilityBase
|
||||||
|
{
|
||||||
|
AbilityData Ability(TagsManager tagsManager, Node3D owner);
|
||||||
|
EffectData CostEffect(TagsManager tagsManager);
|
||||||
|
EffectData CooldownEffect(TagsManager tagsManager);
|
||||||
|
}
|
||||||
1
interfaces/IAbilityBase.cs.uid
Normal file
1
interfaces/IAbilityBase.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://de881c2xsbutk
|
||||||
@@ -15,8 +15,8 @@
|
|||||||
[ext_resource type="PackedScene" uid="uid://qup00a7x2sji" path="res://scenes/fixed_dash_target/fixed_dashthrough_target.tscn" id="13_iq67o"]
|
[ext_resource type="PackedScene" uid="uid://qup00a7x2sji" path="res://scenes/fixed_dash_target/fixed_dashthrough_target.tscn" id="13_iq67o"]
|
||||||
[ext_resource type="PackedScene" uid="uid://b8aet6m4m2i83" path="res://scenes/tuto_trigger/TutoTrigger.tscn" id="14_lthgu"]
|
[ext_resource type="PackedScene" uid="uid://b8aet6m4m2i83" path="res://scenes/tuto_trigger/TutoTrigger.tscn" id="14_lthgu"]
|
||||||
|
|
||||||
[sub_resource type="BoxShape3D" id="BoxShape3D_jk7w8"]
|
[sub_resource type="BoxShape3D" id="BoxShape3D_lthgu"]
|
||||||
size = Vector3(6.75, 8.25, 7.25)
|
size = Vector3(7.5, 3.75, 10.25)
|
||||||
|
|
||||||
[node name="Main" unique_id=955321579 instance=ExtResource("1_k7f42")]
|
[node name="Main" unique_id=955321579 instance=ExtResource("1_k7f42")]
|
||||||
|
|
||||||
@@ -105,13 +105,12 @@ transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 27, 13.5, -9)
|
|||||||
[node name="FixedDashthroughTarget3" parent="Targets" index="9" unique_id=1106453232 instance=ExtResource("13_iq67o")]
|
[node name="FixedDashthroughTarget3" parent="Targets" index="9" unique_id=1106453232 instance=ExtResource("13_iq67o")]
|
||||||
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 43, 6, -8.5)
|
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 43, 6, -8.5)
|
||||||
|
|
||||||
[node name="Player" parent="." index="14" unique_id=1309399929]
|
[node name="TutoTrigger5" parent="." index="14" unique_id=840713937 instance=ExtResource("14_lthgu")]
|
||||||
transform = Transform3D(0.99999994, 0, 0, 0, 1, 0, 0, 0, 0.99999994, 3, 0, 0)
|
|
||||||
|
|
||||||
[node name="TutoTrigger10" parent="." index="18" unique_id=840713937 instance=ExtResource("14_lthgu")]
|
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.75, 0, 3)
|
|
||||||
tuto_text = "Try to survive!"
|
tuto_text = "Try to survive!"
|
||||||
|
|
||||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="TutoTrigger10" index="1" unique_id=2145030859]
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="TutoTrigger5" index="1" unique_id=1820790391]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.875, 1.125, -4.625)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4, 0.625, -1.875)
|
||||||
shape = SubResource("BoxShape3D_jk7w8")
|
shape = SubResource("BoxShape3D_lthgu")
|
||||||
|
|
||||||
|
[node name="Player" parent="." index="15" unique_id=1309399929]
|
||||||
|
transform = Transform3D(0.99999994, 0, 0, 0, 1, 0, 0, 0, 0.99999994, 3, 0, 0)
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
[ext_resource type="Resource" uid="uid://bl5crtu1gkrtr" path="res://inputs/base_mode/base_mode.tres" id="3_cresl"]
|
[ext_resource type="Resource" uid="uid://bl5crtu1gkrtr" path="res://inputs/base_mode/base_mode.tres" id="3_cresl"]
|
||||||
[ext_resource type="Resource" uid="uid://dtmhtlix2amme" path="res://scenes/player_controller/resources/player_mana_regen.tres" id="3_n24vh"]
|
[ext_resource type="Resource" uid="uid://dtmhtlix2amme" path="res://scenes/player_controller/resources/player_mana_regen.tres" id="3_n24vh"]
|
||||||
[ext_resource type="PackedScene" uid="uid://c4ikbhojckpnc" path="res://scenes/components/health/CHealth.tscn" id="3_q7bng"]
|
[ext_resource type="PackedScene" uid="uid://c4ikbhojckpnc" path="res://scenes/components/health/CHealth.tscn" id="3_q7bng"]
|
||||||
|
[ext_resource type="Script" uid="uid://rux15j7q78e8" path="res://forge/abilities/RExplodingSwordThrow.cs" id="4_11013"]
|
||||||
[ext_resource type="Script" uid="uid://baiapod3csndf" path="res://scenes/components/health/RHealth.cs" id="4_abfq8"]
|
[ext_resource type="Script" uid="uid://baiapod3csndf" path="res://scenes/components/health/RHealth.cs" id="4_abfq8"]
|
||||||
[ext_resource type="Resource" uid="uid://bjyd801wvverk" path="res://scenes/player_controller/resources/player_health.tres" id="4_m8gvy"]
|
[ext_resource type="Resource" uid="uid://bjyd801wvverk" path="res://scenes/player_controller/resources/player_health.tres" id="4_m8gvy"]
|
||||||
[ext_resource type="Resource" uid="uid://cpdaw41ah5gic" path="res://inputs/base_mode/rotate_y.tres" id="4_rxwoh"]
|
[ext_resource type="Resource" uid="uid://cpdaw41ah5gic" path="res://inputs/base_mode/rotate_y.tres" id="4_rxwoh"]
|
||||||
@@ -18,7 +19,7 @@
|
|||||||
[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="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="Resource" uid="uid://7dpkk5rk3di5" path="res://scenes/player_controller/resources/forge_empowered_action.tres" id="7_qheee"]
|
[ext_resource type="Resource" uid="uid://7dpkk5rk3di5" path="res://scenes/player_controller/resources/forge/empowered_action.tres" id="7_qheee"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bctpe34ddamg5" path="res://scenes/components/knockback/CKnockback.tscn" id="7_x835q"]
|
[ext_resource type="PackedScene" uid="uid://bctpe34ddamg5" path="res://scenes/components/knockback/CKnockback.tscn" id="7_x835q"]
|
||||||
[ext_resource type="Resource" uid="uid://s1l0n1iitc6m" path="res://inputs/base_mode/move_back.tres" id="8_jb43f"]
|
[ext_resource type="Resource" uid="uid://s1l0n1iitc6m" path="res://inputs/base_mode/move_back.tres" id="8_jb43f"]
|
||||||
[ext_resource type="Resource" uid="uid://j1o5ud0plk4" path="res://inputs/base_mode/aim_release.tres" id="8_lhb11"]
|
[ext_resource type="Resource" uid="uid://j1o5ud0plk4" path="res://inputs/base_mode/aim_release.tres" id="8_lhb11"]
|
||||||
@@ -55,6 +56,12 @@
|
|||||||
[ext_resource type="Texture2D" uid="uid://c40orhfdgsim" path="res://assets/ui/IconGodotNode/white/icon_circle.png" id="45_u8rdp"]
|
[ext_resource type="Texture2D" uid="uid://c40orhfdgsim" path="res://assets/ui/IconGodotNode/white/icon_circle.png" id="45_u8rdp"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cyw8p0p6a78tl" path="res://scenes/ui/healthbar/healthbar.tscn" id="47_76kmc"]
|
[ext_resource type="PackedScene" uid="uid://cyw8p0p6a78tl" path="res://scenes/ui/healthbar/healthbar.tscn" id="47_76kmc"]
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id="Resource_5b7hb"]
|
||||||
|
script = ExtResource("4_11013")
|
||||||
|
Explosion = ExtResource("5_ue7xq")
|
||||||
|
Cost = 10.0
|
||||||
|
metadata/_custom_type_script = "uid://rux15j7q78e8"
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_cb2lu"]
|
[sub_resource type="Resource" id="Resource_cb2lu"]
|
||||||
script = ExtResource("2_x835q")
|
script = ExtResource("2_x835q")
|
||||||
DamageDealt = 10.0
|
DamageDealt = 10.0
|
||||||
@@ -111,11 +118,15 @@ radius = 1.5
|
|||||||
[sub_resource type="CanvasItemMaterial" id="CanvasItemMaterial_2q0ik"]
|
[sub_resource type="CanvasItemMaterial" id="CanvasItemMaterial_2q0ik"]
|
||||||
blend_mode = 1
|
blend_mode = 1
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_n24vh"]
|
||||||
|
bg_color = Color(0.15869555, 0.64034444, 0.906125, 1)
|
||||||
|
|
||||||
[node name="Player" type="CharacterBody3D" unique_id=709076448]
|
[node name="Player" type="CharacterBody3D" unique_id=709076448]
|
||||||
collision_mask = 272
|
collision_mask = 272
|
||||||
script = ExtResource("1_poq2x")
|
script = ExtResource("1_poq2x")
|
||||||
EmpoweredAction = ExtResource("7_qheee")
|
EmpoweredAction = ExtResource("7_qheee")
|
||||||
ManaRegen = ExtResource("3_n24vh")
|
ManaRegen = ExtResource("3_n24vh")
|
||||||
|
AbilityLoadout = [SubResource("Resource_5b7hb")]
|
||||||
AimAssistStrength = 0.3
|
AimAssistStrength = 0.3
|
||||||
AimAssistReductionWhenCloseToTarget = 0.1
|
AimAssistReductionWhenCloseToTarget = 0.1
|
||||||
AimAssistReductionStartDistance = 8.0
|
AimAssistReductionStartDistance = 8.0
|
||||||
@@ -227,12 +238,10 @@ 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
|
||||||
CameraInclineAcceleration = 20.0
|
CameraInclineAcceleration = 20.0
|
||||||
GroundedCameraIncline = 3.0
|
GroundedCameraIncline = 3.0
|
||||||
SlidingJitterAmplitude = 0.2
|
SlidingJitterAmplitude = 0.2
|
||||||
WeaponSway = 8.0
|
|
||||||
WeaponLookRotation = 10.0
|
|
||||||
WeaponAdjustmentSpeed = 1.0
|
|
||||||
|
|
||||||
[node name="MantleSystem" parent="HeadSystem" unique_id=98905505 instance=ExtResource("8_qu4wy")]
|
[node name="MantleSystem" parent="HeadSystem" unique_id=98905505 instance=ExtResource("8_qu4wy")]
|
||||||
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)
|
||||||
@@ -555,6 +564,22 @@ offset_bottom = -71.99939
|
|||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 0
|
grow_vertical = 0
|
||||||
|
|
||||||
|
[node name="Manabar" parent="UI" unique_id=1713862004 instance=ExtResource("47_76kmc")]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 7
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 1.0
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
offset_left = -859.0
|
||||||
|
offset_top = -84.0
|
||||||
|
offset_right = -347.0
|
||||||
|
offset_bottom = -72.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 0
|
||||||
|
BarStyle = SubResource("StyleBoxFlat_n24vh")
|
||||||
|
|
||||||
[node name="StateChart" type="Node" parent="." unique_id=1675830632]
|
[node name="StateChart" type="Node" parent="." unique_id=1675830632]
|
||||||
script = ExtResource("25_wv70j")
|
script = ExtResource("25_wv70j")
|
||||||
metadata/_custom_type_script = "uid://couw105c3bde4"
|
metadata/_custom_type_script = "uid://couw105c3bde4"
|
||||||
|
|||||||
@@ -1,13 +1,18 @@
|
|||||||
using Godot;
|
using Godot;
|
||||||
using System;
|
using System;
|
||||||
|
using Gamesmiths.Forge.Core;
|
||||||
|
using Gamesmiths.Forge.Cues;
|
||||||
|
using Gamesmiths.Forge.Tags;
|
||||||
using Movementtests.interfaces;
|
using Movementtests.interfaces;
|
||||||
|
using Movementtests.tools;
|
||||||
|
|
||||||
[GlobalClass, Icon("res://assets/ui/IconGodotNode/control/icon_text_panel.png")]
|
[GlobalClass, Icon("res://assets/ui/IconGodotNode/control/icon_text_panel.png")]
|
||||||
public partial class PlayerUi : Control
|
public partial class PlayerUi : Control, ICueHandler
|
||||||
{
|
{
|
||||||
internal TextureRect[] _dashIcons = new TextureRect[3];
|
internal TextureRect[] DashIcons = new TextureRect[3];
|
||||||
private TextureRect _enemyTarget;
|
private TextureRect _enemyTarget = null!;
|
||||||
private Healthbar _healthbar;
|
private Healthbar _healthbar = null!;
|
||||||
|
private Healthbar _manabar = null!;
|
||||||
|
|
||||||
public enum TargetState
|
public enum TargetState
|
||||||
{
|
{
|
||||||
@@ -25,17 +30,24 @@ public partial class PlayerUi : Control
|
|||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
_dashIcons[0] = GetNode<TextureRect>("%Dash1");
|
DashIcons[0] = GetNode<TextureRect>("%Dash1");
|
||||||
_dashIcons[1] = GetNode<TextureRect>("%Dash2");
|
DashIcons[1] = GetNode<TextureRect>("%Dash2");
|
||||||
_dashIcons[2] = GetNode<TextureRect>("%Dash3");
|
DashIcons[2] = GetNode<TextureRect>("%Dash3");
|
||||||
|
|
||||||
_enemyTarget = GetNode<TextureRect>("%EnemyTarget");
|
_enemyTarget = GetNode<TextureRect>("%EnemyTarget");
|
||||||
_healthbar = GetNode<Healthbar>("%Healthbar");
|
_healthbar = GetNode<Healthbar>("%Healthbar");
|
||||||
|
_manabar = GetNode<Healthbar>("%Manabar");
|
||||||
|
|
||||||
|
var forgeManager = GetTree().Root.GetNode<ForgeManager>("ForgeManager")!;
|
||||||
|
var tagsManager = forgeManager.TagsManager;
|
||||||
|
var cuesManager = forgeManager.CuesManager;
|
||||||
|
cuesManager.RegisterCue(Tag.RequestTag(tagsManager, "cues.resources.mana"), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Initialize(float initialHealth)
|
public void Initialize(float initialHealth, float initialMana)
|
||||||
{
|
{
|
||||||
_healthbar.Initialize(initialHealth);
|
_healthbar.Initialize(initialHealth);
|
||||||
|
_manabar.Initialize(initialMana);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetEnemyTargetProperties(TargetProperties targetProperties)
|
public void SetEnemyTargetProperties(TargetProperties targetProperties)
|
||||||
@@ -59,7 +71,7 @@ public partial class PlayerUi : Control
|
|||||||
public void SetNumberOfDashesLeft(int numberOfDashes)
|
public void SetNumberOfDashesLeft(int numberOfDashes)
|
||||||
{
|
{
|
||||||
int index = 1;
|
int index = 1;
|
||||||
foreach (var dashIcon in _dashIcons)
|
foreach (var dashIcon in DashIcons)
|
||||||
{
|
{
|
||||||
dashIcon.SetVisible(index <= numberOfDashes);
|
dashIcon.SetVisible(index <= numberOfDashes);
|
||||||
index++;
|
index++;
|
||||||
@@ -70,4 +82,36 @@ public partial class PlayerUi : Control
|
|||||||
{
|
{
|
||||||
_healthbar.CurrentHealth = healthChanged.CurrentHealth;
|
_healthbar.CurrentHealth = healthChanged.CurrentHealth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnManaChanged(float newValue)
|
||||||
|
{
|
||||||
|
_manabar.CurrentHealth = newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnExecute(IForgeEntity? target, CueParameters? parameters)
|
||||||
|
{
|
||||||
|
// One-shot effect (like impact)
|
||||||
|
// Called when an instant effect with this cue is applied
|
||||||
|
// Also called when a periodic effect with this cue executes its period
|
||||||
|
if (target == null || !parameters.HasValue) return;
|
||||||
|
|
||||||
|
// Extract parameters
|
||||||
|
float magnitude = parameters.Value.Magnitude;
|
||||||
|
// Play effects scaled by magnitude
|
||||||
|
// PlayFireImpactSound(normalizedMagnitude);
|
||||||
|
// SpawnFireImpactParticles(target, magnitude);
|
||||||
|
_manabar.CurrentHealth += magnitude;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnApply(IForgeEntity? target, CueParameters? parameters)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnRemove(IForgeEntity? target, bool interrupted)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnUpdate(IForgeEntity? target, CueParameters? parameters)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,12 +39,12 @@ public partial class HeadSystem : Node3D
|
|||||||
float BobbingMultiplier,
|
float BobbingMultiplier,
|
||||||
float FovMultiplier);
|
float FovMultiplier);
|
||||||
|
|
||||||
internal Camera3D _camera;
|
internal Camera3D Camera = null!;
|
||||||
internal Marker3D _cameraAnchor;
|
internal Node3D CameraAnchor = null!;
|
||||||
internal AnimationPlayer _animationPlayer;
|
internal AnimationPlayer AnimationPlayer = null!;
|
||||||
internal AnimationTree _animationTree;
|
internal AnimationTree AnimationTree = null!;
|
||||||
|
|
||||||
[Export(PropertyHint.Range, "0,10,0.1,or_greater")]
|
[Export(PropertyHint.Range, "0,1,0.01,or_greater")]
|
||||||
public float LookSensitivity { get; set; } = 1f;
|
public float LookSensitivity { get; set; } = 1f;
|
||||||
|
|
||||||
[ExportGroup("Camera incline")]
|
[ExportGroup("Camera incline")]
|
||||||
@@ -84,43 +84,40 @@ public partial class HeadSystem : Node3D
|
|||||||
public float FovMaxedOutSpeed { get; set; } = 20f;
|
public float FovMaxedOutSpeed { get; set; } = 20f;
|
||||||
|
|
||||||
[ExportGroup("First Person rig")]
|
[ExportGroup("First Person rig")]
|
||||||
internal Node3D _fpRig;
|
internal Node3D FpRig = null!;
|
||||||
internal Node3D _rightHandedWeapon;
|
internal Node3D RightHandedWeapon = null!;
|
||||||
internal Node3D _leftHandedWeapon;
|
internal Vector3 RightHandedWeaponInitialRotation = Vector3.Zero;
|
||||||
internal Node3D _fpDisplacedRig;
|
internal Node3D LeftHandedWeapon = null!;
|
||||||
internal Vector3 _fpDisplacedRigInitialRotation;
|
internal Vector3 LeftHandedWeaponInitialRotation = Vector3.Zero;
|
||||||
[Export(PropertyHint.Range, "0,10,0.1,or_greater")]
|
[Export(PropertyHint.Range, "0,20,1,or_greater")]
|
||||||
public float WeaponSway { get; set; } = 5f;
|
public float WeaponSway { get; set; } = 15f;
|
||||||
[Export(PropertyHint.Range, "0,10,0.1,or_greater")]
|
|
||||||
public float WeaponLookRotation { get; set; } = 1f;
|
|
||||||
[Export(PropertyHint.Range, "0,200,1,or_greater")]
|
[Export(PropertyHint.Range, "0,200,1,or_greater")]
|
||||||
public float WeaponMoveRotation { get; set; } = 80f;
|
public float WeaponMoveRotation { get; set; } = 80f;
|
||||||
[Export(PropertyHint.Range, "0,20,0.1,or_greater")]
|
[Export(PropertyHint.Range, "0,20,1,or_greater")]
|
||||||
public float WeaponAdjustmentSpeed { get; set; } = 10f;
|
public float WeaponAdjustmentSpeed { get; set; } = 1f;
|
||||||
[Export(PropertyHint.Range, "0,10,0.1,or_greater")]
|
[Export(PropertyHint.Range, "0,2,0.01,or_greater")]
|
||||||
public float DisplacedWeaponSway { get; set; } = 5f;
|
public float DisplacedWeaponSway { get; set; } = 0.8f;
|
||||||
[Export(PropertyHint.Range, "0,10,0.1,or_greater")]
|
[Export(PropertyHint.Range, "0,0.5,0.01,or_greater")]
|
||||||
public float DisplacedWeaponLookRotation { get; set; } = 1f;
|
|
||||||
[Export(PropertyHint.Range, "0,1,0.01,or_greater")]
|
|
||||||
public float DisplacedWeaponMoveRotation { get; set; } = 0.1f;
|
public float DisplacedWeaponMoveRotation { get; set; } = 0.1f;
|
||||||
[Export(PropertyHint.Range, "0,20,0.1,or_greater")]
|
[Export(PropertyHint.Range, "0,20,1,or_greater")]
|
||||||
public float DisplacedWeaponAdjustmentSpeed { get; set; } = 10f;
|
public float DisplacedWeaponAdjustmentSpeed { get; set; } = 12f;
|
||||||
|
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
_isPlayingForcingAnim = false;
|
IsPlayingForcingAnim = false;
|
||||||
|
|
||||||
Input.SetMouseMode(Input.MouseModeEnum.Captured);
|
Input.SetMouseMode(Input.MouseModeEnum.Captured);
|
||||||
_camera = GetNode<Camera3D>("CameraSmooth/Camera3D");
|
Camera = GetNode<Camera3D>("CameraSmooth/Camera3D");
|
||||||
_cameraAnchor = GetNode<Marker3D>("CameraAnchor");
|
CameraAnchor = GetNode<Node3D>("CameraSmooth/CameraAnchor");
|
||||||
_animationPlayer = GetNode<AnimationPlayer>("AnimationPlayer");
|
//_cameraAnchor = GetNode<Camera3D>("CameraSmooth/Camera3D");
|
||||||
_animationTree = GetNode<AnimationTree>("AnimationTree");
|
AnimationPlayer = GetNode<AnimationPlayer>("AnimationPlayer");
|
||||||
|
AnimationTree = GetNode<AnimationTree>("AnimationTree");
|
||||||
|
|
||||||
_fpRig = GetNode<Node3D>("FPRig");
|
FpRig = GetNode<Node3D>("FPRig");
|
||||||
_rightHandedWeapon = GetNode<Node3D>("FPRig/Sword");
|
RightHandedWeapon = GetNode<Node3D>("FPRig/Sword/SwordMesh");
|
||||||
_leftHandedWeapon = GetNode<Node3D>("FPRig/Parry");
|
RightHandedWeaponInitialRotation = RightHandedWeapon.Rotation;
|
||||||
_fpDisplacedRig = GetNode<Node3D>("FPRig/Sword");
|
LeftHandedWeapon = GetNode<Node3D>("FPRig/Parry/ParryMesh");
|
||||||
_fpDisplacedRigInitialRotation = _fpDisplacedRig.Rotation;
|
LeftHandedWeaponInitialRotation = LeftHandedWeapon.Rotation;
|
||||||
|
|
||||||
_slidingNoise.NoiseType = FastNoiseLite.NoiseTypeEnum.Perlin;
|
_slidingNoise.NoiseType = FastNoiseLite.NoiseTypeEnum.Perlin;
|
||||||
_slidingNoise.SetFrequency(SlidingJitterFrequency);
|
_slidingNoise.SetFrequency(SlidingJitterFrequency);
|
||||||
@@ -128,34 +125,34 @@ public partial class HeadSystem : Node3D
|
|||||||
|
|
||||||
public void SetWeaponsVisible(bool swordVisible, bool parryVisible)
|
public void SetWeaponsVisible(bool swordVisible, bool parryVisible)
|
||||||
{
|
{
|
||||||
_rightHandedWeapon.Visible = swordVisible;
|
RightHandedWeapon.Visible = swordVisible;
|
||||||
_leftHandedWeapon.Visible = parryVisible;
|
LeftHandedWeapon.Visible = parryVisible;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnMantle()
|
public void OnMantle()
|
||||||
{
|
{
|
||||||
_animationTree.Set("parameters/OnMantle/request", (int) AnimationNodeOneShot.OneShotRequest.Fire);
|
AnimationTree.Set("parameters/OnMantle/request", (int) AnimationNodeOneShot.OneShotRequest.Fire);
|
||||||
}
|
}
|
||||||
public void OnJumpStarted()
|
public void OnJumpStarted()
|
||||||
{
|
{
|
||||||
_animationTree.Set("parameters/OnJumpStart/request", (int) AnimationNodeOneShot.OneShotRequest.Fire);
|
AnimationTree.Set("parameters/OnJumpStart/request", (int) AnimationNodeOneShot.OneShotRequest.Fire);
|
||||||
}
|
}
|
||||||
public void OnJumpEnded()
|
public void OnJumpEnded()
|
||||||
{
|
{
|
||||||
_animationTree.Set("parameters/OnJumpEnd/request", (int) AnimationNodeOneShot.OneShotRequest.Fire);
|
AnimationTree.Set("parameters/OnJumpEnd/request", (int) AnimationNodeOneShot.OneShotRequest.Fire);
|
||||||
}
|
}
|
||||||
public void OnHit()
|
public void OnHit()
|
||||||
{
|
{
|
||||||
_animationTree.Set("parameters/OnHit/request", (int) AnimationNodeOneShot.OneShotRequest.Fire);
|
AnimationTree.Set("parameters/OnHit/request", (int) AnimationNodeOneShot.OneShotRequest.Fire);
|
||||||
}
|
}
|
||||||
public void OnParry()
|
public void OnParry()
|
||||||
{
|
{
|
||||||
_animationTree.Set("parameters/OnParry/request", (int) AnimationNodeOneShot.OneShotRequest.Fire);
|
AnimationTree.Set("parameters/OnParry/request", (int) AnimationNodeOneShot.OneShotRequest.Fire);
|
||||||
}
|
}
|
||||||
public void OnStartDeathAnimation()
|
public void OnStartDeathAnimation()
|
||||||
{
|
{
|
||||||
_isPlayingForcingAnim = true;
|
IsPlayingForcingAnim = true;
|
||||||
_animationTree.Set("parameters/OnDie/request", (int) AnimationNodeOneShot.OneShotRequest.Fire);
|
AnimationTree.Set("parameters/OnDie/request", (int) AnimationNodeOneShot.OneShotRequest.Fire);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnDeathAnimationFinished()
|
public void OnDeathAnimationFinished()
|
||||||
@@ -190,8 +187,8 @@ public partial class HeadSystem : Node3D
|
|||||||
EmitSignalHitboxDeactivated();
|
EmitSignalHitboxDeactivated();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal bool _footstepEmitted;
|
internal bool FootstepEmitted;
|
||||||
internal bool _isPlayingForcingAnim;
|
internal bool IsPlayingForcingAnim;
|
||||||
|
|
||||||
public void ResetHeadBobbing()
|
public void ResetHeadBobbing()
|
||||||
{
|
{
|
||||||
@@ -200,10 +197,10 @@ public partial class HeadSystem : Node3D
|
|||||||
|
|
||||||
public void LookAround(CameraParameters inputs)
|
public void LookAround(CameraParameters inputs)
|
||||||
{
|
{
|
||||||
if (_isPlayingForcingAnim)
|
if (IsPlayingForcingAnim)
|
||||||
{
|
{
|
||||||
_camera.Position = Vector3.Zero;
|
Camera.Position = Vector3.Zero;
|
||||||
_camera.Rotation = Vector3.Zero;
|
Camera.Rotation = Vector3.Zero;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -223,7 +220,7 @@ public partial class HeadSystem : Node3D
|
|||||||
RotateY(angleForHorizontalRotation);
|
RotateY(angleForHorizontalRotation);
|
||||||
|
|
||||||
// Vertical movement of head
|
// Vertical movement of head
|
||||||
Vector3 currentCameraRotation = _cameraAnchor.Rotation;
|
Vector3 currentCameraRotation = CameraAnchor.Rotation;
|
||||||
currentCameraRotation.X += Convert.ToSingle(lookDir.Y * LookSensitivity * sensitivitMultiplier);
|
currentCameraRotation.X += Convert.ToSingle(lookDir.Y * LookSensitivity * sensitivitMultiplier);
|
||||||
currentCameraRotation.X = Mathf.Clamp(currentCameraRotation.X, Mathf.DegToRad(-90f), Mathf.DegToRad(90f));
|
currentCameraRotation.X = Mathf.Clamp(currentCameraRotation.X, Mathf.DegToRad(-90f), Mathf.DegToRad(90f));
|
||||||
|
|
||||||
@@ -242,18 +239,18 @@ public partial class HeadSystem : Node3D
|
|||||||
cameraIncline = Mathf.DegToRad(GroundedCameraIncline * cameraInclineFactor * -1.0f);
|
cameraIncline = Mathf.DegToRad(GroundedCameraIncline * cameraInclineFactor * -1.0f);
|
||||||
}
|
}
|
||||||
currentCameraRotation.Z = (float) Mathf.Lerp(currentCameraRotation.Z, cameraIncline, delta * CameraInclineAcceleration);
|
currentCameraRotation.Z = (float) Mathf.Lerp(currentCameraRotation.Z, cameraIncline, delta * CameraInclineAcceleration);
|
||||||
_cameraAnchor.Rotation = currentCameraRotation;
|
CameraAnchor.Rotation = currentCameraRotation;
|
||||||
|
|
||||||
if (withCameraJitter)
|
if (withCameraJitter)
|
||||||
{
|
{
|
||||||
_cameraAnchor.Position = Vector3.Down*SlidingCameraHeightOffset;
|
CameraAnchor.Position = Vector3.Down*SlidingCameraHeightOffset;
|
||||||
float noise1D = _slidingNoise.GetNoise1D(Time.GetTicksMsec());
|
float noise1D = _slidingNoise.GetNoise1D(Time.GetTicksMsec());
|
||||||
float noiseAmplitude = SlidingJitterAmplitude*Mathf.Clamp(playerVelocity.Length(), 0f, 1f);
|
float noiseAmplitude = SlidingJitterAmplitude*Mathf.Clamp(playerVelocity.Length(), 0f, 1f);
|
||||||
_cameraAnchor.Position += Vector3.Up*noise1D*noiseAmplitude;
|
CameraAnchor.Position += Vector3.Up*noise1D*noiseAmplitude;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_cameraAnchor.Position = Vector3.Zero;
|
CameraAnchor.Position = Vector3.Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector3 newPositionForCamera = Vector3.Zero;
|
Vector3 newPositionForCamera = Vector3.Zero;
|
||||||
@@ -268,25 +265,24 @@ public partial class HeadSystem : Node3D
|
|||||||
newPositionForCamera.Y = Mathf.Sin(_bobbingAccumulator * BobbingFrequency) * BobbingAmplitude * bobbingMultiplier;
|
newPositionForCamera.Y = Mathf.Sin(_bobbingAccumulator * BobbingFrequency) * BobbingAmplitude * bobbingMultiplier;
|
||||||
newPositionForCamera.X = Mathf.Cos(_bobbingAccumulator * BobbingFrequency / 2.0f) * BobbingAmplitude * bobbingMultiplier;
|
newPositionForCamera.X = Mathf.Cos(_bobbingAccumulator * BobbingFrequency / 2.0f) * BobbingAmplitude * bobbingMultiplier;
|
||||||
|
|
||||||
if (newPositionForCamera.Y < -0.07 && !_footstepEmitted) Footstep();
|
if (newPositionForCamera.Y < -0.07 * bobbingMultiplier && !FootstepEmitted) Footstep();
|
||||||
if (newPositionForCamera.Y > 0) _footstepEmitted = false;
|
if (newPositionForCamera.Y > 0) FootstepEmitted = false;
|
||||||
|
|
||||||
// Offset bobbing for weapon rig
|
// Offset bobbing for weapon rig
|
||||||
newPositionForRig.Y = Mathf.Cos(_bobbingAccumulator * BobbingFrequency) * BobbingAmplitude * bobbingMultiplier * 0.2f;
|
newPositionForRig.Y = Mathf.Cos(_bobbingAccumulator * BobbingFrequency) * BobbingAmplitude * bobbingMultiplier * 0.2f;
|
||||||
newPositionForRig.X = Mathf.Sin(_bobbingAccumulator * BobbingFrequency / 2.0f) * BobbingAmplitude * bobbingMultiplier * 0.2f;
|
newPositionForRig.X = Mathf.Sin(_bobbingAccumulator * BobbingFrequency / 2.0f) * BobbingAmplitude * bobbingMultiplier * 0.2f;
|
||||||
}
|
}
|
||||||
_cameraAnchor.Position += newPositionForCamera;
|
CameraAnchor.Position += newPositionForCamera;
|
||||||
|
Camera.GlobalTransform = CameraAnchor.GetGlobalTransformInterpolated();
|
||||||
_camera.GlobalTransform = _cameraAnchor.GetGlobalTransformInterpolated();
|
|
||||||
|
|
||||||
// First person rig adjustments
|
// First person rig adjustments
|
||||||
_fpRig.GlobalTransform = _cameraAnchor.GetGlobalTransformInterpolated();
|
FpRig.GlobalTransform = Camera.GlobalTransform;
|
||||||
// Apply bobbing
|
// Apply bobbing
|
||||||
_fpRig.Position += newPositionForRig;
|
FpRig.Position += newPositionForRig;
|
||||||
|
|
||||||
// Rotate the whole rig based on movement input
|
// Rotate the whole rig based on movement input
|
||||||
var newRigRotation = _fpRig.Rotation;
|
var newRigRotation = FpRig.Rotation;
|
||||||
var camTilt = Mathf.Lerp(_fpRig.Rotation.Z, cameraIncline*WeaponMoveRotation, delta*WeaponAdjustmentSpeed);
|
var camTilt = Mathf.Lerp(FpRig.Rotation.Z, CameraAnchor.Rotation.Z*WeaponMoveRotation, delta * WeaponAdjustmentSpeed);
|
||||||
newRigRotation.Z = (float) camTilt;
|
newRigRotation.Z = (float) camTilt;
|
||||||
|
|
||||||
// Rotate the whole rig based on camera rotation input
|
// Rotate the whole rig based on camera rotation input
|
||||||
@@ -294,50 +290,54 @@ public partial class HeadSystem : Node3D
|
|||||||
newRigRotation.Y = Mathf.Lerp(newRigRotation.Y, -lookDir.X*WeaponSway, (float) delta * WeaponAdjustmentSpeed);
|
newRigRotation.Y = Mathf.Lerp(newRigRotation.Y, -lookDir.X*WeaponSway, (float) delta * WeaponAdjustmentSpeed);
|
||||||
|
|
||||||
// Apply
|
// Apply
|
||||||
_fpRig.Rotation = newRigRotation;
|
FpRig.Rotation = newRigRotation;
|
||||||
|
|
||||||
// Compute displaced rig adjustments, starting with movement input
|
// Compute sword meshes procedural adjustments
|
||||||
var newDisplacedRigRotation = _fpDisplacedRig.Rotation;
|
RightHandedWeapon.Rotation = ComputeRotationForFpMesh(RightHandedWeapon, RightHandedWeaponInitialRotation, playerInput, lookDir, (float) delta);
|
||||||
|
LeftHandedWeapon.Rotation = ComputeRotationForFpMesh(LeftHandedWeapon, LeftHandedWeaponInitialRotation, playerInput, lookDir, (float) delta);
|
||||||
var howMuchForward = ComputeHowMuchInputForward(playerInput);
|
|
||||||
var howMuchSideways = ComputeHowMuchInputSideways(playerInput);
|
|
||||||
var displacedCamTiltForward = Mathf.Lerp(newDisplacedRigRotation.Z,
|
|
||||||
_fpDisplacedRigInitialRotation.Z + howMuchForward*DisplacedWeaponMoveRotation,
|
|
||||||
delta*DisplacedWeaponAdjustmentSpeed);
|
|
||||||
var displacedCamTiltSide = Mathf.Lerp(newDisplacedRigRotation.X,
|
|
||||||
_fpDisplacedRigInitialRotation.X - howMuchSideways*DisplacedWeaponMoveRotation,
|
|
||||||
delta*DisplacedWeaponAdjustmentSpeed);
|
|
||||||
|
|
||||||
newDisplacedRigRotation.X = (float) displacedCamTiltSide;
|
|
||||||
newDisplacedRigRotation.Z = (float) displacedCamTiltForward;
|
|
||||||
|
|
||||||
var displacedSwayY = Mathf.Lerp(newDisplacedRigRotation.Y,
|
|
||||||
_fpDisplacedRigInitialRotation.Y - lookDir.X*DisplacedWeaponSway,
|
|
||||||
delta*DisplacedWeaponAdjustmentSpeed);
|
|
||||||
newDisplacedRigRotation.Y = (float) displacedSwayY;
|
|
||||||
|
|
||||||
// Apply
|
|
||||||
_fpDisplacedRig.Rotation = newDisplacedRigRotation;
|
|
||||||
|
|
||||||
// Camera adjustments
|
// Camera adjustments
|
||||||
float velocityClamped = Mathf.Clamp(playerVelocity.Length(), 0.5f, FovMaxedOutSpeed);
|
float velocityClamped = Mathf.Clamp(playerVelocity.Length(), 0.5f, FovMaxedOutSpeed);
|
||||||
float targetFov = BaseFov + FovChangeFactor * velocityClamped * fovMultiplier;
|
float targetFov = BaseFov + FovChangeFactor * velocityClamped * fovMultiplier;
|
||||||
_camera.Fov = Mathf.Lerp(_camera.Fov, targetFov, (float) delta * FovChangeSpeed);
|
Camera.Fov = Mathf.Lerp(Camera.Fov, targetFov, (float) delta * FovChangeSpeed);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector3 ComputeRotationForFpMesh(Node3D mesh, Vector3 initialRotation, Vector3 playerInput, Vector2 lookDir, float delta)
|
||||||
|
{
|
||||||
|
var newMeshRotation = mesh.Rotation;
|
||||||
|
var howMuchForward = ComputeHowMuchInputForward(playerInput);
|
||||||
|
var howMuchSideways = ComputeHowMuchInputSideways(playerInput);
|
||||||
|
var displacedCamTiltForward = Mathf.Lerp(newMeshRotation.Z,
|
||||||
|
initialRotation.Z + howMuchForward*DisplacedWeaponMoveRotation,
|
||||||
|
delta * DisplacedWeaponAdjustmentSpeed);
|
||||||
|
var displacedCamTiltSide = Mathf.Lerp(newMeshRotation.X,
|
||||||
|
initialRotation.X - howMuchSideways*DisplacedWeaponMoveRotation,
|
||||||
|
delta * DisplacedWeaponAdjustmentSpeed);
|
||||||
|
|
||||||
|
newMeshRotation.X = displacedCamTiltSide;
|
||||||
|
newMeshRotation.Z = displacedCamTiltForward;
|
||||||
|
|
||||||
|
var displacedSwayY = Mathf.Lerp(newMeshRotation.Y,
|
||||||
|
initialRotation.Y - lookDir.X*DisplacedWeaponSway,
|
||||||
|
delta * DisplacedWeaponAdjustmentSpeed);
|
||||||
|
newMeshRotation.Y = displacedSwayY;
|
||||||
|
|
||||||
|
return newMeshRotation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Footstep()
|
public void Footstep()
|
||||||
{
|
{
|
||||||
_footstepEmitted = true;
|
FootstepEmitted = true;
|
||||||
EmitSignalStepFoot();
|
EmitSignalStepFoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void HideWeapon()
|
public void HideWeapon()
|
||||||
{
|
{
|
||||||
_rightHandedWeapon.Visible = false;
|
RightHandedWeapon.Visible = false;
|
||||||
}
|
}
|
||||||
public void ShowWeapon()
|
public void ShowWeapon()
|
||||||
{
|
{
|
||||||
_rightHandedWeapon.Visible = true;
|
RightHandedWeapon.Visible = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float ComputeCameraInclineFactor(Vector3 direction)
|
public float ComputeCameraInclineFactor(Vector3 direction)
|
||||||
@@ -368,15 +368,15 @@ public partial class HeadSystem : Node3D
|
|||||||
|
|
||||||
public Vector3 GetGlobalForwardVector()
|
public Vector3 GetGlobalForwardVector()
|
||||||
{
|
{
|
||||||
return _camera.GlobalBasis.Z;
|
return Camera.GlobalBasis.Z;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector3 GetGlobalLookRotation()
|
public Vector3 GetGlobalLookRotation()
|
||||||
{
|
{
|
||||||
return new Vector3(
|
return new Vector3(
|
||||||
_camera.Rotation.X,
|
Camera.Rotation.X,
|
||||||
Rotation.Y,
|
Rotation.Y,
|
||||||
_camera.Rotation.Z);
|
Camera.Rotation.Z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetHeight(float height)
|
public void SetHeight(float height)
|
||||||
|
|||||||
@@ -654,9 +654,6 @@ _data = {
|
|||||||
|
|
||||||
[node name="HeadSystem" type="Node3D" unique_id=2067407038]
|
[node name="HeadSystem" type="Node3D" unique_id=2067407038]
|
||||||
script = ExtResource("1_8abgy")
|
script = ExtResource("1_8abgy")
|
||||||
WeaponMoveRotation = 20.0
|
|
||||||
DisplacedWeaponSway = 1.0
|
|
||||||
DisplacedWeaponAdjustmentSpeed = 8.0
|
|
||||||
|
|
||||||
[node name="FPRig" type="Node3D" parent="." unique_id=922968399]
|
[node name="FPRig" type="Node3D" parent="." unique_id=922968399]
|
||||||
transform = Transform3D(0.9999998, 0, 0, 0, 1.0000002, 0, 0, 0, 1.0000002, 0, 0, 0)
|
transform = Transform3D(0.9999998, 0, 0, 0, 1.0000002, 0, 0, 0, 1.0000002, 0, 0, 0)
|
||||||
@@ -678,6 +675,9 @@ mesh = ExtResource("3_1ay6d")
|
|||||||
[node name="CameraSmooth" type="Node3D" parent="." unique_id=2072010960]
|
[node name="CameraSmooth" type="Node3D" parent="." unique_id=2072010960]
|
||||||
transform = Transform3D(0.9999998, -0.00011616429, 0, 0.00011616431, 0.99999964, 0, 0, 0, 0.99999976, 0, 0, 0)
|
transform = Transform3D(0.9999998, -0.00011616429, 0, 0.00011616431, 0.99999964, 0, 0, 0, 0.99999976, 0, 0, 0)
|
||||||
|
|
||||||
|
[node name="CameraAnchor" type="Marker3D" parent="CameraSmooth" unique_id=1554357312]
|
||||||
|
transform = Transform3D(1.0000002, 0.00011616435, 0, -0.000116164374, 1.0000004, 0, 0, 0, 1.0000002, 0, 0, 0)
|
||||||
|
|
||||||
[node name="Camera3D" type="Camera3D" parent="CameraSmooth" unique_id=544372058]
|
[node name="Camera3D" type="Camera3D" parent="CameraSmooth" unique_id=544372058]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1.0000002, 0, 0, 0, 1.0000001, 0, 0, 0)
|
transform = Transform3D(1, 0, 0, 0, 1.0000002, 0, 0, 0, 1.0000001, 0, 0, 0)
|
||||||
current = true
|
current = true
|
||||||
@@ -702,8 +702,6 @@ fade_out = 0.5547845
|
|||||||
shakerPreset = SubResource("Resource_se3kf")
|
shakerPreset = SubResource("Resource_se3kf")
|
||||||
metadata/_custom_type_script = "uid://dnlxsrumw6ygp"
|
metadata/_custom_type_script = "uid://dnlxsrumw6ygp"
|
||||||
|
|
||||||
[node name="CameraAnchor" type="Marker3D" parent="." unique_id=1554357312]
|
|
||||||
|
|
||||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="." unique_id=1831491746]
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="." unique_id=1831491746]
|
||||||
root_node = NodePath("../CameraSmooth/Camera3D")
|
root_node = NodePath("../CameraSmooth/Camera3D")
|
||||||
libraries/ = SubResource("AnimationLibrary_0hyrq")
|
libraries/ = SubResource("AnimationLibrary_0hyrq")
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
using Gamesmiths.Forge.Attributes;
|
||||||
|
|
||||||
|
namespace Movementtests.scenes.player_controller.components.weapon;
|
||||||
|
|
||||||
|
public class WeaponAttributeSet : AttributeSet
|
||||||
|
{
|
||||||
|
public EntityAttribute Level { get; }
|
||||||
|
|
||||||
|
public WeaponAttributeSet()
|
||||||
|
{
|
||||||
|
Level = InitializeAttribute(nameof(Level), 1, 1, 10);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://mvc3bv0p021
|
||||||
@@ -1,13 +1,21 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using Gamesmiths.Forge.Core;
|
||||||
|
using Gamesmiths.Forge.Effects;
|
||||||
|
using Gamesmiths.Forge.Events;
|
||||||
|
using Gamesmiths.Forge.Tags;
|
||||||
using Godot;
|
using Godot;
|
||||||
using GodotStateCharts;
|
using GodotStateCharts;
|
||||||
using Movementtests.interfaces;
|
using Movementtests.interfaces;
|
||||||
|
using Movementtests.scenes.player_controller.components.weapon;
|
||||||
using Movementtests.systems.damage;
|
using Movementtests.systems.damage;
|
||||||
|
using Movementtests.tools;
|
||||||
|
|
||||||
namespace Movementtests.systems;
|
namespace Movementtests.systems;
|
||||||
|
|
||||||
|
public record struct WeaponLandPayload(int Damage, bool IsCritical);
|
||||||
|
|
||||||
[GlobalClass, Icon("res://assets/ui/IconGodotNode/node_3D/icon_sword.png")]
|
[GlobalClass, Icon("res://assets/ui/IconGodotNode/node_3D/icon_sword.png")]
|
||||||
public partial class WeaponSystem : RigidBody3D, IDamageDealer
|
public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
|
||||||
{
|
{
|
||||||
[Signal]
|
[Signal]
|
||||||
public delegate void WeaponThrownEventHandler();
|
public delegate void WeaponThrownEventHandler();
|
||||||
@@ -22,6 +30,12 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer
|
|||||||
[Export(PropertyHint.Range, "0,0.2,0.01,or_greater")]
|
[Export(PropertyHint.Range, "0,0.2,0.01,or_greater")]
|
||||||
public float StraightThrowDuration { get; set; } = 0.1f;
|
public float StraightThrowDuration { get; set; } = 0.1f;
|
||||||
|
|
||||||
|
public EntityAttributes Attributes { get; set; } = null!;
|
||||||
|
public EntityTags Tags { get; set; } = null!;
|
||||||
|
public EffectsManager EffectsManager { get; set; } = null!;
|
||||||
|
public EntityAbilities Abilities { get; set; } = null!;
|
||||||
|
public EventManager Events { get; set; } = null!;
|
||||||
|
|
||||||
private StateChart _weaponState = null!;
|
private StateChart _weaponState = null!;
|
||||||
public StateChartState InHandState = null!;
|
public StateChartState InHandState = null!;
|
||||||
public StateChartState FlyingState = null!;
|
public StateChartState FlyingState = null!;
|
||||||
@@ -40,6 +54,8 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer
|
|||||||
public StandardMaterial3D WeaponLocationIndicatorMaterial { get; set; } = null!;
|
public StandardMaterial3D WeaponLocationIndicatorMaterial { get; set; } = null!;
|
||||||
public MeshInstance3D WeaponMesh { get; set; } = null!;
|
public MeshInstance3D WeaponMesh { get; set; } = null!;
|
||||||
|
|
||||||
|
public Tag WeaponLandTag;
|
||||||
|
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
_weaponState = StateChart.Of(GetNode("StateChart"));
|
_weaponState = StateChart.Of(GetNode("StateChart"));
|
||||||
@@ -58,6 +74,22 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer
|
|||||||
Freeze = true;
|
Freeze = true;
|
||||||
Visible = false;
|
Visible = false;
|
||||||
|
|
||||||
|
var tagsManager = ForgeManager.GetTagsManager(this);
|
||||||
|
var cuesManager = ForgeManager.GetCuesManager(this);
|
||||||
|
var baseTags = new TagContainer(
|
||||||
|
tagsManager,
|
||||||
|
[
|
||||||
|
Tag.RequestTag(tagsManager, "weapon")
|
||||||
|
]);
|
||||||
|
|
||||||
|
Attributes = new EntityAttributes(new WeaponAttributeSet());
|
||||||
|
Tags = new EntityTags(baseTags);
|
||||||
|
EffectsManager = new EffectsManager(this, cuesManager);
|
||||||
|
Abilities = new(this);
|
||||||
|
Events = new();
|
||||||
|
|
||||||
|
WeaponLandTag = Tag.RequestTag(tagsManager, "events.weapon.land");
|
||||||
|
|
||||||
BodyEntered += OnThrownWeaponReachesGround;
|
BodyEntered += OnThrownWeaponReachesGround;
|
||||||
|
|
||||||
InHandState.StateExited += WeaponLeft;
|
InHandState.StateExited += WeaponLeft;
|
||||||
@@ -109,11 +141,26 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer
|
|||||||
tween.Finished += ThrowWeaponOnCurve;
|
tween.Finished += ThrowWeaponOnCurve;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void RaiseWeaponLandEvent(IForgeEntity? victim = null)
|
||||||
|
{
|
||||||
|
Events.Raise(new EventData<WeaponLandPayload>
|
||||||
|
{
|
||||||
|
EventTags = WeaponLandTag.GetSingleTagContainer(),
|
||||||
|
Source = this,
|
||||||
|
Target = victim,
|
||||||
|
EventMagnitude = 25f,
|
||||||
|
Payload = new WeaponLandPayload(Damage: 25, IsCritical: true)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public void PlantInEnemy(Node3D enemy)
|
public void PlantInEnemy(Node3D enemy)
|
||||||
{
|
{
|
||||||
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);
|
||||||
|
|
||||||
|
if (enemy is IForgeEntity victim) RaiseWeaponLandEvent(victim);
|
||||||
|
else RaiseWeaponLandEvent();
|
||||||
|
|
||||||
if (enemy is IDamageable damageable)
|
if (enemy is IDamageable damageable)
|
||||||
{
|
{
|
||||||
damageable.TakeDamage(new DamageRecord(GlobalPosition, RDamage));
|
damageable.TakeDamage(new DamageRecord(GlobalPosition, RDamage));
|
||||||
@@ -145,6 +192,8 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer
|
|||||||
{
|
{
|
||||||
PlantInEnemy(node);
|
PlantInEnemy(node);
|
||||||
}
|
}
|
||||||
|
else RaiseWeaponLandEvent();
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
script = ExtResource("1_1rxoq")
|
script = ExtResource("1_1rxoq")
|
||||||
Cost = 50.0
|
Cost = 30.0
|
||||||
Cooldown = 1.0
|
Cooldown = 0.5
|
||||||
ManaRegenPause = 3.0
|
ManaRegenPause = 2.0
|
||||||
metadata/_custom_type_script = "uid://d0l07gcx1ef18"
|
metadata/_custom_type_script = "uid://d0l07gcx1ef18"
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
[gd_resource type="Resource" script_class="RExplodingSwordThrow" format=3 uid="uid://cdxbwirfiaipi"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://rux15j7q78e8" path="res://forge/abilities/RExplodingSwordThrow.cs" id="1_5iq8v"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
script = ExtResource("1_5iq8v")
|
||||||
|
Cost = 20.0
|
||||||
|
metadata/_custom_type_script = "uid://rux15j7q78e8"
|
||||||
@@ -5,5 +5,5 @@
|
|||||||
[resource]
|
[resource]
|
||||||
script = ExtResource("1_ecb1p")
|
script = ExtResource("1_ecb1p")
|
||||||
ManaRegenRate = 20.0
|
ManaRegenRate = 20.0
|
||||||
Frequency = 0.1
|
Frequency = 0.05
|
||||||
metadata/_custom_type_script = "uid://di04jvuqp0h7m"
|
metadata/_custom_type_script = "uid://di04jvuqp0h7m"
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ using System.Collections.Generic;
|
|||||||
using Gamesmiths.Forge.Abilities;
|
using Gamesmiths.Forge.Abilities;
|
||||||
using Gamesmiths.Forge.Core;
|
using Gamesmiths.Forge.Core;
|
||||||
using Gamesmiths.Forge.Effects;
|
using Gamesmiths.Forge.Effects;
|
||||||
|
using Gamesmiths.Forge.Effects.Components;
|
||||||
|
using Gamesmiths.Forge.Effects.Duration;
|
||||||
|
using Gamesmiths.Forge.Effects.Magnitudes;
|
||||||
using Gamesmiths.Forge.Events;
|
using Gamesmiths.Forge.Events;
|
||||||
using Gamesmiths.Forge.Tags;
|
using Gamesmiths.Forge.Tags;
|
||||||
|
|
||||||
@@ -103,6 +106,10 @@ public partial class PlayerController : CharacterBody3D,
|
|||||||
[Export] public REmpoweredAction EmpoweredAction = null!;
|
[Export] public REmpoweredAction EmpoweredAction = null!;
|
||||||
[Export] public RManaRegen ManaRegen = null!;
|
[Export] public RManaRegen ManaRegen = null!;
|
||||||
|
|
||||||
|
[ExportGroup("Abilities")]
|
||||||
|
[ExportSubgroup("WeaponThrow")]
|
||||||
|
[Export] public RAbilityBase[] AbilityLoadout = [];
|
||||||
|
|
||||||
// Combat stuff
|
// Combat stuff
|
||||||
[ExportCategory("Combat")]
|
[ExportCategory("Combat")]
|
||||||
[ExportGroup("General")]
|
[ExportGroup("General")]
|
||||||
@@ -429,27 +436,21 @@ public partial class PlayerController : CharacterBody3D,
|
|||||||
_aimAssisRayCast.TargetPosition = _aimAssisRayCast.TargetPosition.Normalized() * (TargetingDistance*1.5f);
|
_aimAssisRayCast.TargetPosition = _aimAssisRayCast.TargetPosition.Normalized() * (TargetingDistance*1.5f);
|
||||||
|
|
||||||
// Forge stuff
|
// Forge stuff
|
||||||
var forgeManager = GetTree().Root.GetNode<ForgeManager>("ForgeManager")!;
|
var tagsManager = ForgeManager.GetTagsManager(this);
|
||||||
|
var cuesManager = ForgeManager.GetCuesManager(this);
|
||||||
var baseTags = new TagContainer(
|
var baseTags = new TagContainer(
|
||||||
forgeManager.TagsManager,
|
tagsManager,
|
||||||
[
|
[
|
||||||
Tag.RequestTag(forgeManager.TagsManager, "character.player"),
|
Tag.RequestTag(tagsManager, "character.player")
|
||||||
Tag.RequestTag(forgeManager.TagsManager, "class.warrior")
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
Attributes = new EntityAttributes(new PlayerAttributeSet());
|
Attributes = new EntityAttributes(new PlayerAttributeSet());
|
||||||
Tags = new EntityTags(baseTags);
|
Tags = new EntityTags(baseTags);
|
||||||
EffectsManager = new EffectsManager(this, forgeManager.CuesManager);
|
EffectsManager = new EffectsManager(this, cuesManager);
|
||||||
Abilities = new(this);
|
Abilities = new(this);
|
||||||
Events = new();
|
Events = new();
|
||||||
|
|
||||||
var empoweredActionData = new AbilityData(
|
var empoweredActionData = EmpoweredAction.Ability(tagsManager);
|
||||||
name: "Empowered Action",
|
|
||||||
costEffect: EmpoweredAction.CostEffect(),
|
|
||||||
cooldownEffects: [EmpoweredAction.CooldownEffect(forgeManager.TagsManager)],
|
|
||||||
instancingPolicy: AbilityInstancingPolicy.PerEntity,
|
|
||||||
behaviorFactory: () => new EmpoweredActionBehavior());
|
|
||||||
|
|
||||||
// Grant permanently
|
// Grant permanently
|
||||||
_empoweredActionHandle = Abilities.GrantAbilityPermanently(
|
_empoweredActionHandle = Abilities.GrantAbilityPermanently(
|
||||||
empoweredActionData,
|
empoweredActionData,
|
||||||
@@ -457,7 +458,7 @@ public partial class PlayerController : CharacterBody3D,
|
|||||||
levelOverridePolicy: LevelComparison.None,
|
levelOverridePolicy: LevelComparison.None,
|
||||||
sourceEntity: this);
|
sourceEntity: this);
|
||||||
|
|
||||||
var manaRegenEffect = new Effect(ManaRegen.ManaRegen(), new EffectOwnership(this, this));
|
var manaRegenEffect = new Effect(ManaRegen.ManaRegen(tagsManager), new EffectOwnership(this, this));
|
||||||
_manaRegenEffectHandle = EffectsManager.ApplyEffect(manaRegenEffect);
|
_manaRegenEffectHandle = EffectsManager.ApplyEffect(manaRegenEffect);
|
||||||
|
|
||||||
var health = Attributes["PlayerAttributeSet.Health"].CurrentValue; // 100
|
var health = Attributes["PlayerAttributeSet.Health"].CurrentValue; // 100
|
||||||
@@ -529,7 +530,7 @@ public partial class PlayerController : CharacterBody3D,
|
|||||||
}
|
}
|
||||||
if (RKnockback != null) CKnockback!.RKnockback = RKnockback;
|
if (RKnockback != null) CKnockback!.RKnockback = RKnockback;
|
||||||
|
|
||||||
PlayerUi.Initialize(CHealth.CurrentHealth);
|
PlayerUi.Initialize(CHealth.CurrentHealth, Attributes["PlayerAttributeSet.Mana"].BaseValue);
|
||||||
CDamageable.DamageTaken += (damageable, record) => ReduceHealth(damageable, record);
|
CDamageable.DamageTaken += (damageable, record) => ReduceHealth(damageable, record);
|
||||||
CDamageable.DamageTaken += (_, record) => RegisterKnockback(new KnockbackRecord(record));
|
CDamageable.DamageTaken += (_, record) => RegisterKnockback(new KnockbackRecord(record));
|
||||||
CHealth.HealthChanged += PlayerUi.OnHealthChanged;
|
CHealth.HealthChanged += PlayerUi.OnHealthChanged;
|
||||||
@@ -704,8 +705,46 @@ public partial class PlayerController : CharacterBody3D,
|
|||||||
_parryStandard.StateEntered += OnStandardParryStarted;
|
_parryStandard.StateEntered += OnStandardParryStarted;
|
||||||
_parryDash.StateEntered += OnDashParryStarted;
|
_parryDash.StateEntered += OnDashParryStarted;
|
||||||
|
|
||||||
// Testing out kill
|
foreach (var weaponLandAbility in AbilityLoadout)
|
||||||
// GetTree().CreateTimer(2).Timeout += () => Kill(this);
|
{
|
||||||
|
var grantAbilityConfig = new GrantAbilityConfig(
|
||||||
|
weaponLandAbility.Ability(tagsManager, WeaponSystem),
|
||||||
|
ScalableLevel: new ScalableInt(1),
|
||||||
|
RemovalPolicy: AbilityDeactivationPolicy.CancelImmediately,
|
||||||
|
InhibitionPolicy: AbilityDeactivationPolicy.CancelImmediately,
|
||||||
|
TryActivateOnGrant: false,
|
||||||
|
TryActivateOnEnable: false,
|
||||||
|
LevelOverridePolicy: LevelComparison.Higher);
|
||||||
|
|
||||||
|
var grantComponent = new GrantAbilityEffectComponent([grantAbilityConfig]);
|
||||||
|
var grantEffect = new EffectData(
|
||||||
|
"Grant Weapon Land Ability",
|
||||||
|
new DurationData(DurationType.Infinite),
|
||||||
|
effectComponents: [grantComponent]);
|
||||||
|
EffectsManager.ApplyEffect(new Effect(grantEffect, new EffectOwnership(this, this)));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Forge events
|
||||||
|
EventSubscriptionToken token = WeaponSystem.Events.Subscribe<WeaponLandPayload>(WeaponSystem.WeaponLandTag, OnWeaponLanded);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnWeaponLanded(EventData<WeaponLandPayload> data)
|
||||||
|
{
|
||||||
|
var source = data.Source;
|
||||||
|
var target = data.Target;
|
||||||
|
var magnitude = data.EventMagnitude;
|
||||||
|
var weaponLandPayload = data.Payload;
|
||||||
|
|
||||||
|
var tagsManager = ForgeManager.GetTagsManager(this);
|
||||||
|
var weaponLandTag = Tag.RequestTag(tagsManager, "abilities.weapon.land").GetSingleTagContainer();
|
||||||
|
if (weaponLandTag == null) return;
|
||||||
|
var anyActivated = Abilities.TryActivateAbilitiesByTag(
|
||||||
|
weaponLandTag,
|
||||||
|
target,
|
||||||
|
out var failures);
|
||||||
|
if (anyActivated)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////
|
///////////////////////////
|
||||||
@@ -765,7 +804,7 @@ public partial class PlayerController : CharacterBody3D,
|
|||||||
{
|
{
|
||||||
RHealth.StartingHealth = newHealthValue;
|
RHealth.StartingHealth = newHealthValue;
|
||||||
CHealth!.CurrentHealth = newHealthValue;
|
CHealth!.CurrentHealth = newHealthValue;
|
||||||
PlayerUi.Initialize(CHealth.CurrentHealth);
|
PlayerUi.Initialize(CHealth.CurrentHealth, Attributes["PlayerAttributeSet.Mana"].BaseValue);
|
||||||
}
|
}
|
||||||
public void SetPlayerDamageOverride(float newDamageValue)
|
public void SetPlayerDamageOverride(float newDamageValue)
|
||||||
{
|
{
|
||||||
@@ -2309,13 +2348,18 @@ public partial class PlayerController : CharacterBody3D,
|
|||||||
HandleEnemyTargeting();
|
HandleEnemyTargeting();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// private float _oldMana = 100;
|
||||||
public override void _Process(double delta)
|
public override void _Process(double delta)
|
||||||
{
|
{
|
||||||
// Manage head and camera movement
|
// Manage head and camera movement
|
||||||
LookAround(delta);
|
LookAround(delta);
|
||||||
|
|
||||||
EffectsManager.UpdateEffects(delta);
|
EffectsManager.UpdateEffects(delta);
|
||||||
GD.Print(Attributes["PlayerAttributeSet.Mana"].CurrentValue);
|
// TODO: change for actual Cue
|
||||||
|
// var currentMana = Attributes["PlayerAttributeSet.Mana"].CurrentValue;
|
||||||
|
// if (Mathf.Abs(currentMana - _oldMana) > Mathf.Epsilon)
|
||||||
|
// PlayerUi.OnManaChanged(currentMana);
|
||||||
|
// _oldMana = currentMana;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////
|
///////////////////////////
|
||||||
|
|||||||
@@ -4,8 +4,10 @@ using System;
|
|||||||
[GlobalClass, Icon("res://assets/ui/IconGodotNode/control/icon_heart.png")]
|
[GlobalClass, Icon("res://assets/ui/IconGodotNode/control/icon_heart.png")]
|
||||||
public partial class Healthbar : ProgressBar
|
public partial class Healthbar : ProgressBar
|
||||||
{
|
{
|
||||||
private Timer _damageCatchUpTimer;
|
private Timer _damageCatchUpTimer = null!;
|
||||||
private ProgressBar _damagedHealth;
|
private ProgressBar _damagedHealth = null!;
|
||||||
|
|
||||||
|
[Export] public StyleBox? BarStyle;
|
||||||
|
|
||||||
private float _currentHealth;
|
private float _currentHealth;
|
||||||
public float CurrentHealth
|
public float CurrentHealth
|
||||||
@@ -21,6 +23,9 @@ public partial class Healthbar : ProgressBar
|
|||||||
|
|
||||||
_damageCatchUpTimer.Timeout += OnDamageCatchUp;
|
_damageCatchUpTimer.Timeout += OnDamageCatchUp;
|
||||||
Visible = false;
|
Visible = false;
|
||||||
|
|
||||||
|
if (BarStyle != null)
|
||||||
|
AddThemeStyleboxOverride("fill", BarStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Initialize(float initialHealth)
|
public void Initialize(float initialHealth)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_0sgot"]
|
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_0sgot"]
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_0k5hr"]
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_0k5hr"]
|
||||||
bg_color = Color(0.698864, 0.047356047, 0, 1)
|
bg_color = Color(0.69803923, 0.047058824, 0, 1)
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_0sgot"]
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_0sgot"]
|
||||||
bg_color = Color(0.14767182, 0.14767182, 0.14767176, 1)
|
bg_color = Color(0.14767182, 0.14767182, 0.14767176, 1)
|
||||||
|
|||||||
@@ -14,17 +14,20 @@ public class HeadSystemUnitTest
|
|||||||
public void SetupTest()
|
public void SetupTest()
|
||||||
{
|
{
|
||||||
_head = new HeadSystem();
|
_head = new HeadSystem();
|
||||||
_head._camera = new Camera3D();
|
_head.Camera = new Camera3D();
|
||||||
_head.AddChild(_head._camera);
|
_head.AddChild(_head.Camera);
|
||||||
|
|
||||||
_head._cameraAnchor = new Marker3D();
|
// _head._cameraAnchor = new Marker3D();
|
||||||
_head.AddChild(_head._cameraAnchor);
|
_head.AddChild(_head.CameraAnchor);
|
||||||
|
|
||||||
_head._fpRig = new Node3D();
|
_head.FpRig = new Node3D();
|
||||||
_head.AddChild(_head._fpRig);
|
_head.AddChild(_head.FpRig);
|
||||||
|
_head.CameraAnchor = new Node3D();
|
||||||
_head._fpDisplacedRig = new Node3D();
|
_head.AddChild(_head.CameraAnchor);
|
||||||
_head.AddChild(_head._fpDisplacedRig);
|
_head.RightHandedWeapon = new Node3D();
|
||||||
|
_head.AddChild(_head.RightHandedWeapon);
|
||||||
|
_head.LeftHandedWeapon = new Node3D();
|
||||||
|
_head.AddChild(_head.LeftHandedWeapon);
|
||||||
}
|
}
|
||||||
|
|
||||||
[AfterTest]
|
[AfterTest]
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ public class PlayerControllerUnitTest
|
|||||||
{
|
{
|
||||||
var mockUi = new PlayerUi();
|
var mockUi = new PlayerUi();
|
||||||
var dashIcons = new TextureRect[3] { new TextureRect(), new TextureRect(), new TextureRect() };
|
var dashIcons = new TextureRect[3] { new TextureRect(), new TextureRect(), new TextureRect() };
|
||||||
mockUi._dashIcons = dashIcons;
|
mockUi.DashIcons = dashIcons;
|
||||||
|
|
||||||
_player.PlayerUi = mockUi;
|
_player.PlayerUi = mockUi;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user