mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 10:15:45 +00:00
Motivation
This commit is contained in:
parent
c9b703a0ae
commit
e73596e464
13 changed files with 100 additions and 34 deletions
|
|
@ -19,7 +19,7 @@ _name = "Intro"
|
|||
[sub_resource type="Resource" id="Resource_cfhv5"]
|
||||
script = ExtResource("1_ov731")
|
||||
EggIndex = 0
|
||||
StartingEquipment = Array[ExtResource("2_bkci5")]([])
|
||||
StartingEquipment = []
|
||||
|
||||
[sub_resource type="Resource" id="Resource_0k62o"]
|
||||
script = ExtResource("2_tnajf")
|
||||
|
|
@ -31,7 +31,7 @@ StartData = SubResource("Resource_cfhv5")
|
|||
[sub_resource type="Resource" id="Resource_tpb7s"]
|
||||
script = ExtResource("1_ov731")
|
||||
EggIndex = 0
|
||||
StartingEquipment = Array[ExtResource("2_bkci5")]([])
|
||||
StartingEquipment = []
|
||||
|
||||
[sub_resource type="Resource" id="Resource_edoov"]
|
||||
script = ExtResource("2_tnajf")
|
||||
|
|
@ -43,7 +43,7 @@ StartData = SubResource("Resource_tpb7s")
|
|||
[sub_resource type="Resource" id="Resource_1sw5g"]
|
||||
script = ExtResource("1_ov731")
|
||||
EggIndex = 255
|
||||
StartingEquipment = Array[ExtResource("2_bkci5")]([])
|
||||
StartingEquipment = []
|
||||
|
||||
[sub_resource type="Resource" id="Resource_47bot"]
|
||||
script = ExtResource("2_tnajf")
|
||||
|
|
@ -73,7 +73,7 @@ _name = "Rebel Base"
|
|||
[sub_resource type="Resource" id="Resource_maxpt"]
|
||||
script = ExtResource("1_ov731")
|
||||
EggIndex = 0
|
||||
StartingEquipment = Array[ExtResource("2_bkci5")]([])
|
||||
StartingEquipment = []
|
||||
|
||||
[sub_resource type="Resource" id="Resource_pein5"]
|
||||
script = ExtResource("2_tnajf")
|
||||
|
|
@ -128,7 +128,7 @@ metadata/_custom_type_script = "uid://dnthdjrx78u6m"
|
|||
[sub_resource type="Resource" id="Resource_7sue8"]
|
||||
script = ExtResource("1_ov731")
|
||||
EggIndex = 255
|
||||
StartingEquipment = Array[ExtResource("2_bkci5")]([])
|
||||
StartingEquipment = []
|
||||
metadata/_custom_type_script = "uid://mja0rk7n2kln"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_ognca"]
|
||||
|
|
@ -142,7 +142,7 @@ metadata/_custom_type_script = "uid://dnthdjrx78u6m"
|
|||
[sub_resource type="Resource" id="Resource_olpjo"]
|
||||
script = ExtResource("1_ov731")
|
||||
EggIndex = 0
|
||||
StartingEquipment = Array[ExtResource("2_bkci5")]([])
|
||||
StartingEquipment = []
|
||||
metadata/_custom_type_script = "uid://mja0rk7n2kln"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_nbnej"]
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
[gd_resource type="Resource" script_class="EnemyResource" load_steps=4 format=3 uid="uid://cfdvg162u65sr"]
|
||||
[gd_resource type="Resource" script_class="EnemyResource" load_steps=3 format=3 uid="uid://cfdvg162u65sr"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cq65aed620ijo" path="res://Scripts/Resources/Loot/LootDrop.cs" id="1_f3huq"]
|
||||
[ext_resource type="Resource" uid="uid://cdfmedtgp2rcn" path="res://Resources/Weapons/EnemyWeapon.tres" id="7_filx8"]
|
||||
[ext_resource type="Script" uid="uid://cd5o0ceb50jki" path="res://Scripts/Resources/EnemyResource.cs" id="8_x8scf"]
|
||||
|
||||
|
|
@ -12,7 +11,7 @@ PrefabPath = &"res://Scenes/Actors/Thermathron.tscn"
|
|||
MaxHealth = 8.0
|
||||
MovementSpeed = 38.0
|
||||
Weapon = ExtResource("7_filx8")
|
||||
LootDrops = Array[ExtResource("1_f3huq")]([])
|
||||
LootDrops = []
|
||||
PlayerDetectionRange = 90.0
|
||||
ViewRange = 120.0
|
||||
AlarmReactRange = 200.0
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
[gd_resource type="Resource" script_class="EnemyResource" load_steps=4 format=3 uid="uid://ysd6wl2gmdhn"]
|
||||
[gd_resource type="Resource" script_class="EnemyResource" load_steps=3 format=3 uid="uid://ysd6wl2gmdhn"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cq65aed620ijo" path="res://Scripts/Resources/Loot/LootDrop.cs" id="1_sma76"]
|
||||
[ext_resource type="Resource" uid="uid://dyaxm3st70sh6" path="res://Resources/Weapons/Enemy/TurretWeapon.tres" id="1_yap8t"]
|
||||
[ext_resource type="Script" uid="uid://cd5o0ceb50jki" path="res://Scripts/Resources/EnemyResource.cs" id="2_sma76"]
|
||||
|
||||
|
|
@ -12,7 +11,7 @@ PrefabPath = &"res://Scenes/Actors/Turret360.tscn"
|
|||
MaxHealth = 14.0
|
||||
MovementSpeed = 0.0
|
||||
Weapon = ExtResource("1_yap8t")
|
||||
LootDrops = Array[ExtResource("1_sma76")]([])
|
||||
LootDrops = []
|
||||
PlayerDetectionRange = 90.0
|
||||
ViewRange = 120.0
|
||||
AlarmReactRange = 200.0
|
||||
|
|
|
|||
|
|
@ -329,8 +329,9 @@ PlayerFSM = NodePath("StateMachine")
|
|||
InteractionController = NodePath("InteractionController")
|
||||
metadata/_edit_group_ = true
|
||||
|
||||
[node name="StateMachine" type="Node2D" parent="."]
|
||||
[node name="StateMachine" type="Node2D" parent="." node_paths=PackedStringArray("MotivationResource")]
|
||||
script = ExtResource("1_mpmil")
|
||||
MotivationResource = NodePath("../DamageReceiver/MotivationProvider")
|
||||
|
||||
[node name="Init" type="Node2D" parent="StateMachine" node_paths=PackedStringArray("_animationProvider", "_storageModule")]
|
||||
script = ExtResource("2_i6wc8")
|
||||
|
|
@ -367,11 +368,12 @@ _animationProvider = NodePath("../../AnimationProvider")
|
|||
script = ExtResource("6_82vrk")
|
||||
_animationProvider = NodePath("../../AnimationProvider")
|
||||
|
||||
[node name="Dead" type="Node2D" parent="StateMachine" node_paths=PackedStringArray("_animationProvider", "_inputProvider", "_healthProvider")]
|
||||
[node name="Dead" type="Node2D" parent="StateMachine" node_paths=PackedStringArray("_animationProvider", "_inputProvider", "_healthProvider", "_motivationProvider")]
|
||||
script = ExtResource("4_0pqs8")
|
||||
_animationProvider = NodePath("../../AnimationProvider")
|
||||
_inputProvider = NodePath("../../InputProvider")
|
||||
_healthProvider = NodePath("../../DamageReceiver/HealthProvider")
|
||||
_motivationProvider = NodePath("../../DamageReceiver/MotivationProvider")
|
||||
|
||||
[node name="Drowning" type="Node2D" parent="StateMachine" node_paths=PackedStringArray("_animationProvider")]
|
||||
script = ExtResource("10_es1gk")
|
||||
|
|
@ -436,12 +438,13 @@ sprite_frames = SubResource("SpriteFrames_g3wua")
|
|||
z_index = 2
|
||||
sprite_frames = SubResource("SpriteFrames_5qlss")
|
||||
|
||||
[node name="DamageReceiver" type="Area2D" parent="." node_paths=PackedStringArray("_healthProvider", "_shieldProvider")]
|
||||
[node name="DamageReceiver" type="Area2D" parent="." node_paths=PackedStringArray("_healthProvider", "_shieldProvider", "_motivationProvider")]
|
||||
collision_layer = 2
|
||||
collision_mask = 392
|
||||
script = ExtResource("14_igu66")
|
||||
_healthProvider = NodePath("HealthProvider")
|
||||
_shieldProvider = NodePath("ShieldProvider")
|
||||
_motivationProvider = NodePath("MotivationProvider")
|
||||
ShieldDamageResistances = Array[ExtResource("25_12erk")]([SubResource("Resource_c4ide"), SubResource("Resource_fjg1v"), SubResource("Resource_hed00"), SubResource("Resource_q2flx"), SubResource("Resource_k7ckg"), SubResource("Resource_qlmfy")])
|
||||
HealthDamageResistances = Array[ExtResource("25_12erk")]([SubResource("Resource_v2m0j"), SubResource("Resource_awrib"), SubResource("Resource_nfrn8"), SubResource("Resource_nfq4p"), SubResource("Resource_m1iep"), SubResource("Resource_ckpe7"), SubResource("Resource_p5rkw")])
|
||||
|
||||
|
|
@ -450,6 +453,11 @@ script = ExtResource("15_5qlss")
|
|||
ResourceName = "Health"
|
||||
_maxResource = 32.0
|
||||
|
||||
[node name="MotivationProvider" type="Node2D" parent="DamageReceiver"]
|
||||
script = ExtResource("15_5qlss")
|
||||
ResourceName = "Motivation"
|
||||
_maxResource = 400.0
|
||||
|
||||
[node name="ShieldProvider" type="Node2D" parent="DamageReceiver"]
|
||||
script = ExtResource("15_5qlss")
|
||||
ResourceName = "Shield"
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ texture_margin_bottom = 3.0
|
|||
[sub_resource type="LabelSettings" id="LabelSettings_bkqle"]
|
||||
font_color = Color(0, 0.737255, 0.113725, 1)
|
||||
|
||||
[node name="HUD" type="CanvasLayer" node_paths=PackedStringArray("_healthLabel", "_healthBar", "_shieldLabel", "_shieldBar", "_itemsContainer", "_gameOverPanel", "PauseMenuContainer", "DebugMenuHolder")]
|
||||
[node name="HUD" type="CanvasLayer" node_paths=PackedStringArray("_healthLabel", "_healthBar", "_shieldLabel", "_shieldBar", "_motivationLabel", "_itemsContainer", "_gameOverPanel", "PauseMenuContainer", "DebugMenuHolder")]
|
||||
process_mode = 3
|
||||
script = ExtResource("1_m0hb0")
|
||||
WeaponContainerTemplate = ExtResource("2_mattb")
|
||||
|
|
@ -94,6 +94,7 @@ _healthLabel = NodePath("VBoxContainer/HealthBarContainer/HealthLabel")
|
|||
_healthBar = NodePath("VBoxContainer/HealthBarContainer/HealthBar")
|
||||
_shieldLabel = NodePath("VBoxContainer/ShieldBarContainer/ShieldLabel")
|
||||
_shieldBar = NodePath("VBoxContainer/ShieldBarContainer/ShieldBar")
|
||||
_motivationLabel = NodePath("VBoxContainer/MotivationContainer/Motivationlabel")
|
||||
_itemsContainer = NodePath("VBoxContainer/ItemsContainer")
|
||||
_labelSettings = ExtResource("2_x7kl7")
|
||||
_gameOverPanel = NodePath("GameOver")
|
||||
|
|
@ -196,6 +197,20 @@ text = "100/100"
|
|||
label_settings = ExtResource("2_x7kl7")
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="MotivationContainer" type="HBoxContainer" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/MotivationContainer"]
|
||||
layout_mode = 2
|
||||
text = "Motivation:"
|
||||
label_settings = ExtResource("2_x7kl7")
|
||||
|
||||
[node name="Motivationlabel" type="Label" parent="VBoxContainer/MotivationContainer"]
|
||||
layout_mode = 2
|
||||
text = "100%"
|
||||
label_settings = ExtResource("2_x7kl7")
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="ItemsContainer" type="VBoxContainer" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
|
|
@ -220,6 +235,7 @@ offset_right = 226.0
|
|||
offset_bottom = 144.0
|
||||
|
||||
[node name="InventoryMenu" type="TabContainer" parent="."]
|
||||
visible = false
|
||||
offset_left = 16.0
|
||||
offset_top = 9.0
|
||||
offset_right = 305.0
|
||||
|
|
|
|||
|
|
@ -304,7 +304,7 @@ SpawnMarkers = Dictionary[int, NodePath]({
|
|||
2: NodePath("Parallax2D/Factory Tilemaps/LevelProps/BossDebugTeleporterDestination"),
|
||||
255: NodePath("Parallax2D/Factory Tilemaps/Debug Room/DebugRoomStartPosition")
|
||||
})
|
||||
StartingEquipment = Array[ExtResource("6_8tdlb")]([ExtResource("4_swym2"), ExtResource("5_nqier")])
|
||||
StartingEquipment = [ExtResource("4_swym2"), ExtResource("5_nqier")]
|
||||
MapStartData = SubResource("Resource_6sau4")
|
||||
NavigationTilemap = NodePath("Parallax2D/Factory Tilemaps/Floor")
|
||||
PlayerParentNode = NodePath("Parallax2D/Factory Tilemaps/PlayerParent")
|
||||
|
|
@ -1125,7 +1125,7 @@ position = Vector2(-2000, -736)
|
|||
[node name="ControlPad8" parent="Parallax2D/Factory Tilemaps/LevelProps" node_paths=PackedStringArray("Targets") instance=ExtResource("12_hfkf1")]
|
||||
position = Vector2(-2027, -735)
|
||||
Targets = [NodePath("../HorizontalForceField")]
|
||||
Requirements = Array[ExtResource("6_8tdlb")]([ExtResource("84_ma1ta")])
|
||||
Requirements = [ExtResource("84_ma1ta")]
|
||||
|
||||
[node name="Ammo6" parent="Parallax2D/Factory Tilemaps/LevelProps" instance=ExtResource("34_17pjh")]
|
||||
position = Vector2(-872, -220)
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ public partial class PlayerDamageReceiver : Area2D
|
|||
|
||||
[Export] public float BaseHealth { get; private set; } = 32f;
|
||||
[Export] public float BaseShield { get; private set; } = 32f;
|
||||
[Export] public float BaseMotivation { get; private set; } = 100f;
|
||||
|
||||
[Export] public float HealthExtendAmount { get; private set; } = 4f;
|
||||
[Export] public float ShieldExtendAmount { get; private set; } = 4f;
|
||||
|
|
@ -31,6 +32,7 @@ public partial class PlayerDamageReceiver : Area2D
|
|||
private ActorResourceProvider _healthProvider;
|
||||
[Export]
|
||||
private ActorResourceProvider _shieldProvider;
|
||||
[Export] private ActorResourceProvider _motivationProvider;
|
||||
|
||||
[ExportCategory("Damage Types")]
|
||||
[Export] public StringName AcidGroupName { get; private set; } = "Acid";
|
||||
|
|
@ -63,6 +65,12 @@ public partial class PlayerDamageReceiver : Area2D
|
|||
set => _shieldProvider.CurrentResource = value;
|
||||
}
|
||||
|
||||
public float CurrentMotivation
|
||||
{
|
||||
get => _motivationProvider.CurrentResource;
|
||||
set => _motivationProvider.CurrentResource = value;
|
||||
}
|
||||
|
||||
private IStateMachine<PlayerState, CharacterBody2D> _stateMachine;
|
||||
|
||||
public void Init(IStateMachine<PlayerState, CharacterBody2D> machine)
|
||||
|
|
@ -110,6 +118,11 @@ public partial class PlayerDamageReceiver : Area2D
|
|||
|
||||
SetMaxResources();
|
||||
};
|
||||
|
||||
_motivationProvider.ResourceChanged += (value, maxValue) =>
|
||||
{
|
||||
Hud.Instance?.UpdateMotivation(value, maxValue);
|
||||
};
|
||||
}
|
||||
|
||||
private void SetMaxResources()
|
||||
|
|
@ -121,6 +134,8 @@ public partial class PlayerDamageReceiver : Area2D
|
|||
_healthProvider.MaxResource = BaseHealth + (healthExtends * HealthExtendAmount);
|
||||
|
||||
_shieldProvider.MaxResource = BaseShield + (shieldExtends * ShieldExtendAmount);
|
||||
|
||||
_motivationProvider.CurrentResource = BaseMotivation;
|
||||
}
|
||||
|
||||
public void RefillHealth()
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@ public partial class Dead : EnemyStateBase
|
|||
|
||||
DropsProvider.DropLoot();
|
||||
|
||||
GameManager.Instance.AddMotivation(StorageModule.EnemyData.MotivationReward);
|
||||
|
||||
StorageModule.Root.QueueFree();
|
||||
}
|
||||
}
|
||||
|
|
@ -16,13 +16,24 @@ public partial class Dead : PlayerStateBase
|
|||
[Export]
|
||||
private ActorResourceProvider _healthProvider;
|
||||
|
||||
[Export]
|
||||
private ActorResourceProvider _motivationProvider;
|
||||
|
||||
public override void EnterState()
|
||||
{
|
||||
_animationProvider.PlayDeathAnimation();
|
||||
// show game over
|
||||
|
||||
if (_motivationProvider.CurrentResource < 100f)
|
||||
{
|
||||
// If motivation is not enough show game over scene
|
||||
GD.Print("Game over");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Else show respawn notification
|
||||
Hud.Instance.ShowGameOver();
|
||||
}
|
||||
}
|
||||
|
||||
public override void ExitState()
|
||||
{
|
||||
|
|
@ -50,6 +61,12 @@ public partial class Dead : PlayerStateBase
|
|||
_healthProvider.FillResource();
|
||||
GameManager.Instance.ClearBullets();
|
||||
|
||||
_motivationProvider.CurrentResource -= 100f;
|
||||
if (_motivationProvider.CurrentResource <= 1f)
|
||||
{
|
||||
_motivationProvider.CurrentResource = 1f;
|
||||
}
|
||||
|
||||
ChangeState(PlayerState.Active);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using Cirno.Scripts.Components.Actors;
|
||||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Components.FSM;
|
||||
|
|
@ -9,6 +10,8 @@ public partial class PlayerStateMachine : StateMachineBase<PlayerState, Characte
|
|||
|
||||
[Export] public Vector2 StartingDirection { get; set; } = Vector2.Down;
|
||||
|
||||
[Export] public ActorResourceProvider MotivationResource { get; private set; }
|
||||
|
||||
public void RefillHealth()
|
||||
{
|
||||
GD.Print("Refilling health");
|
||||
|
|
@ -24,4 +27,9 @@ public partial class PlayerStateMachine : StateMachineBase<PlayerState, Characte
|
|||
GD.Print("NoClip");
|
||||
}
|
||||
|
||||
public void AddMotivation(float motivation)
|
||||
{
|
||||
MotivationResource.CurrentResource += motivation;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,6 +114,11 @@ public partial class GameManager : Node2D
|
|||
StartingEquipment.AddRange(mapStartData.StartingEquipment);
|
||||
}
|
||||
|
||||
public void AddMotivation(float motivation)
|
||||
{
|
||||
Player.AddMotivation(motivation);
|
||||
}
|
||||
|
||||
public void ApplySessionState(SessionSettings settings)
|
||||
{
|
||||
//_inventoryManager.Load(settings.Items);
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ public partial class Hud : CanvasLayer
|
|||
[Export] private Label _shieldLabel;
|
||||
[Export] private ProgressBar _shieldBar;
|
||||
|
||||
[Export] private Label _motivationLabel;
|
||||
|
||||
[Export] private Container _itemsContainer;
|
||||
|
||||
[Export] private LabelSettings _labelSettings;
|
||||
|
|
@ -91,18 +93,6 @@ public partial class Hud : CanvasLayer
|
|||
{
|
||||
_gameOverPanel.Show();
|
||||
_playerDead = true;
|
||||
|
||||
// ShowMessage("Game Over");
|
||||
//
|
||||
// var messageTimer = GetNode<Timer>("MessageTimer");
|
||||
// await ToSignal(messageTimer, Timer.SignalName.Timeout);
|
||||
//
|
||||
// var message = GetNode<Label>("Message");
|
||||
// message.Text = "Dodge the Creeps!";
|
||||
// message.Show();
|
||||
//
|
||||
// await ToSignal(GetTree().CreateTimer(1.0), SceneTreeTimer.SignalName.Timeout);
|
||||
// GetNode<Button>("StartButton").Show();
|
||||
}
|
||||
|
||||
public void HideGameOver()
|
||||
|
|
@ -136,6 +126,11 @@ public partial class Hud : CanvasLayer
|
|||
}
|
||||
}
|
||||
|
||||
public void UpdateMotivation(float newValue, float maxValue)
|
||||
{
|
||||
_motivationLabel.Text = $"{newValue}%";
|
||||
}
|
||||
|
||||
public void UpdateInteractable(Interactable interactable) {
|
||||
GD.Print($"Interactable ${interactable.Name} entered in HUD");
|
||||
//_selector.Position = _selector.tolo
|
||||
|
|
@ -339,4 +334,6 @@ public partial class Hud : CanvasLayer
|
|||
|
||||
AddInventoryItem(item.Item, item.Count);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ public partial class EnemyResource : Resource
|
|||
[Export] public WeaponResource Weapon { get; private set; }
|
||||
|
||||
[Export] public Array<LootDrop> LootDrops { get; private set; } = [];
|
||||
|
||||
[Export] public float MotivationReward { get; private set; } = 4f;
|
||||
[ExportCategory("AI")] [Export] public float PlayerDetectionRange { get; private set; } = 90f;
|
||||
[Export] public float ViewRange { get; private set; } = 120f;
|
||||
[Export] public float AlarmReactRange { get; private set; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue