mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-16 09:03:47 +00:00
Update health on start
This commit is contained in:
parent
4f048f3deb
commit
9b69b7ab17
5 changed files with 20 additions and 10 deletions
|
|
@ -33,7 +33,7 @@
|
||||||
[sub_resource type="Resource" id="Resource_6wo78"]
|
[sub_resource type="Resource" id="Resource_6wo78"]
|
||||||
script = ExtResource("4_u1i8n")
|
script = ExtResource("4_u1i8n")
|
||||||
EggIndex = 0
|
EggIndex = 0
|
||||||
StartingEquipment = Array[ExtResource("5_u1i8n")]([])
|
StartingEquipment = []
|
||||||
|
|
||||||
[node name="GameScene" type="Node2D"]
|
[node name="GameScene" type="Node2D"]
|
||||||
process_mode = 3
|
process_mode = 3
|
||||||
|
|
@ -42,7 +42,7 @@ PlayerTemplate = ExtResource("8_c3v4x")
|
||||||
SpawnMarkers = Dictionary[int, NodePath]({
|
SpawnMarkers = Dictionary[int, NodePath]({
|
||||||
0: NodePath("PlayerStartPosition")
|
0: NodePath("PlayerStartPosition")
|
||||||
})
|
})
|
||||||
StartingEquipment = [ExtResource("3_6314l"), ExtResource("4_yyg8m")]
|
StartingEquipment = Array[ExtResource("5_u1i8n")]([ExtResource("3_6314l"), ExtResource("4_yyg8m")])
|
||||||
MapStartData = SubResource("Resource_6wo78")
|
MapStartData = SubResource("Resource_6wo78")
|
||||||
|
|
||||||
[node name="Tilemaps" type="Node2D" parent="."]
|
[node name="Tilemaps" type="Node2D" parent="."]
|
||||||
|
|
|
||||||
|
|
@ -477,7 +477,7 @@ SpawnMarkers = Dictionary[int, NodePath]({
|
||||||
2: NodePath("Factory Tilemaps/LevelProps/BossDebugTeleporterDestination"),
|
2: NodePath("Factory Tilemaps/LevelProps/BossDebugTeleporterDestination"),
|
||||||
255: NodePath("Factory Tilemaps/Debug Room/DebugRoomStartPosition")
|
255: NodePath("Factory Tilemaps/Debug Room/DebugRoomStartPosition")
|
||||||
})
|
})
|
||||||
StartingEquipment = [ExtResource("4_swym2"), ExtResource("5_nqier")]
|
StartingEquipment = Array[ExtResource("6_8tdlb")]([ExtResource("4_swym2"), ExtResource("5_nqier")])
|
||||||
MapStartData = SubResource("Resource_6sau4")
|
MapStartData = SubResource("Resource_6sau4")
|
||||||
metadata/_edit_lock_ = true
|
metadata/_edit_lock_ = true
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ public partial class ActorResourceProvider : Node2D
|
||||||
{
|
{
|
||||||
_currentResource = value;
|
_currentResource = value;
|
||||||
|
|
||||||
if (_currentResource > MaxResource) {
|
if (_currentResource >= MaxResource) {
|
||||||
_currentResource = MaxResource;
|
_currentResource = MaxResource;
|
||||||
EmitSignal(SignalName.ResourceMaxed, MaxResource);
|
EmitSignal(SignalName.ResourceMaxed, MaxResource);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,27 +39,34 @@ public partial class PlayerDamageReceiver : Area2D
|
||||||
|
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
_healthProvider.FillResource();
|
|
||||||
_shieldProvider.FillResource();
|
|
||||||
|
|
||||||
_healthProvider.ResourceChanged += ((value, maxValue) =>
|
_healthProvider.ResourceChanged += ((value, maxValue) =>
|
||||||
{
|
{
|
||||||
if (!Enabled) return;
|
//if (!Enabled) return;
|
||||||
EmitSignal(SignalName.HealthChanged, value, maxValue);
|
EmitSignal(SignalName.HealthChanged, value, maxValue);
|
||||||
});
|
});
|
||||||
|
|
||||||
_shieldProvider.ResourceChanged += ((value, maxValue) =>
|
_shieldProvider.ResourceChanged += ((value, maxValue) =>
|
||||||
{
|
{
|
||||||
if (!Enabled) return;
|
//if (!Enabled) return;
|
||||||
EmitSignal(SignalName.ShieldChanged, value, maxValue);
|
EmitSignal(SignalName.ShieldChanged, value, maxValue);
|
||||||
});
|
});
|
||||||
|
|
||||||
_healthProvider.ResourceDepleted += () =>
|
_healthProvider.ResourceDepleted += () =>
|
||||||
{
|
{
|
||||||
if (!Enabled) return;
|
//if (!Enabled) return;
|
||||||
EmitSignal(SignalName.Death);
|
EmitSignal(SignalName.Death);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void RefillHealth()
|
||||||
|
{
|
||||||
|
_healthProvider.FillResource();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RefillShield()
|
||||||
|
{
|
||||||
|
_shieldProvider.FillResource();
|
||||||
|
}
|
||||||
|
|
||||||
private void _on_damage_hitbox_area_entered(Area2D area)
|
private void _on_damage_hitbox_area_entered(Area2D area)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,9 @@ public partial class Active : PlayerFSMState
|
||||||
|
|
||||||
_damageReceiver.Init();
|
_damageReceiver.Init();
|
||||||
|
|
||||||
|
_damageReceiver.RefillHealth();
|
||||||
|
_damageReceiver.RefillShield();
|
||||||
|
|
||||||
_activationProvider.Init(stateMachine);
|
_activationProvider.Init(stateMachine);
|
||||||
|
|
||||||
//_weaponProvider = stateMachine.GetNode<PlayerWeaponProvider>("WeaponProvider");
|
//_weaponProvider = stateMachine.GetNode<PlayerWeaponProvider>("WeaponProvider");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue