Stat bar and timer
This commit is contained in:
@@ -5,9 +5,7 @@ using Chickensoft.GodotNodeInterfaces;
|
|||||||
using Chickensoft.Introspection;
|
using Chickensoft.Introspection;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
|
||||||
public interface IGame : IProvide<IGameRepo>, INode3D
|
public interface IGame : IProvide<IGameRepo>, INode3D;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
[Meta(typeof(IAutoNode))]
|
[Meta(typeof(IAutoNode))]
|
||||||
public partial class Game : Node3D, IGame
|
public partial class Game : Node3D, IGame
|
||||||
@@ -38,6 +36,7 @@ public partial class Game : Node3D, IGame
|
|||||||
GameLogic.Set(AppRepo);
|
GameLogic.Set(AppRepo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void OnResolved()
|
public void OnResolved()
|
||||||
{
|
{
|
||||||
GameBinding = GameLogic.Bind();
|
GameBinding = GameLogic.Bind();
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=14 format=3 uid="uid://33ek675mfb5n"]
|
[gd_scene load_steps=13 format=3 uid="uid://33ek675mfb5n"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://src/game/Game.cs" id="1_ytcii"]
|
[ext_resource type="Script" path="res://src/game/Game.cs" id="1_ytcii"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cfecvvav8kkp6" path="res://src/player/Player.tscn" id="3_kk6ly"]
|
[ext_resource type="PackedScene" uid="uid://cfecvvav8kkp6" path="res://src/player/Player.tscn" id="3_kk6ly"]
|
||||||
@@ -8,7 +8,6 @@
|
|||||||
[ext_resource type="PackedScene" uid="uid://bwbofurcvf3yh" path="res://src/minimap/Minimap.tscn" id="6_owlf4"]
|
[ext_resource type="PackedScene" uid="uid://bwbofurcvf3yh" path="res://src/minimap/Minimap.tscn" id="6_owlf4"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bn4gslp2gk8ds" path="res://src/map/dungeon/corridor/Corridor.tscn" id="6_swtay"]
|
[ext_resource type="PackedScene" uid="uid://bn4gslp2gk8ds" path="res://src/map/dungeon/corridor/Corridor.tscn" id="6_swtay"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bbwgmqy3evhh2" path="res://src/map/dungeon/rooms/Room2.tscn" id="7_1ynbc"]
|
[ext_resource type="PackedScene" uid="uid://bbwgmqy3evhh2" path="res://src/map/dungeon/rooms/Room2.tscn" id="7_1ynbc"]
|
||||||
[ext_resource type="Script" path="res://addons/SimpleDungeons/DungeonRoom3D.gd" id="9_p0lbc"]
|
|
||||||
|
|
||||||
[sub_resource type="Environment" id="Environment_fke5g"]
|
[sub_resource type="Environment" id="Environment_fke5g"]
|
||||||
|
|
||||||
@@ -67,92 +66,68 @@ dungeon_size = Vector3i(10, 1, 10)
|
|||||||
|
|
||||||
[node name="RoomsContainer" type="Node3D" parent="DungeonGenerator3D"]
|
[node name="RoomsContainer" type="Node3D" parent="DungeonGenerator3D"]
|
||||||
|
|
||||||
[node name="DungeonRoom3D_0" type="Node3D" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("7_1ynbc")]
|
[node name="DungeonRoom3D_0" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("7_1ynbc")]
|
||||||
transform = Transform3D(1.19249e-08, 0, -1, 0, 1, 0, 1, 0, 1.19249e-08, -15, 0, 15)
|
transform = Transform3D(1.19249e-08, 0, -1, 0, 1, 0, 1, 0, 1.19249e-08, -15, 0, 15)
|
||||||
script = ExtResource("9_p0lbc")
|
|
||||||
size_in_voxels = Vector3i(5, 1, 1)
|
|
||||||
|
|
||||||
[node name="DungeonRoom3D_1" type="Node3D" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_04w8n")]
|
[node name="DungeonRoom3D_1" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_04w8n")]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -15, 0, -35)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -15, 0, -35)
|
||||||
script = ExtResource("9_p0lbc")
|
|
||||||
|
|
||||||
[node name="DungeonRoom3D_2" type="Node3D" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_04w8n")]
|
[node name="DungeonRoom3D_2" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_04w8n")]
|
||||||
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 25, 0, -45)
|
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 25, 0, -45)
|
||||||
script = ExtResource("9_p0lbc")
|
|
||||||
|
|
||||||
[node name="DungeonRoom3D_3" type="Node3D" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("7_1ynbc")]
|
[node name="DungeonRoom3D_3" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("7_1ynbc")]
|
||||||
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 15, 0, -25)
|
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 15, 0, -25)
|
||||||
script = ExtResource("9_p0lbc")
|
|
||||||
size_in_voxels = Vector3i(5, 1, 1)
|
|
||||||
|
|
||||||
[node name="Corridor_4" type="Node3D" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
[node name="Corridor_4" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -15, 0, -15)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -15, 0, -15)
|
||||||
script = ExtResource("9_p0lbc")
|
|
||||||
|
|
||||||
[node name="Corridor_5" type="Node3D" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
[node name="Corridor_5" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -15, 0, -25)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -15, 0, -25)
|
||||||
script = ExtResource("9_p0lbc")
|
|
||||||
|
|
||||||
[node name="Corridor_6" type="Node3D" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
[node name="Corridor_6" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -15, 0, -45)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -15, 0, -45)
|
||||||
script = ExtResource("9_p0lbc")
|
|
||||||
|
|
||||||
[node name="Corridor_7" type="Node3D" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
[node name="Corridor_7" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5, 0, -45)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5, 0, -45)
|
||||||
script = ExtResource("9_p0lbc")
|
|
||||||
|
|
||||||
[node name="Corridor_8" type="Node3D" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
[node name="Corridor_8" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5, 0, -45)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5, 0, -45)
|
||||||
script = ExtResource("9_p0lbc")
|
|
||||||
|
|
||||||
[node name="Corridor_9" type="Node3D" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
[node name="Corridor_9" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 15, 0, -45)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 15, 0, -45)
|
||||||
script = ExtResource("9_p0lbc")
|
|
||||||
|
|
||||||
[node name="Corridor_10" type="Node3D" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
[node name="Corridor_10" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -15, 0, 45)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -15, 0, 45)
|
||||||
script = ExtResource("9_p0lbc")
|
|
||||||
|
|
||||||
[node name="Corridor_11" type="Node3D" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
[node name="Corridor_11" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -25, 0, 45)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -25, 0, 45)
|
||||||
script = ExtResource("9_p0lbc")
|
|
||||||
|
|
||||||
[node name="Corridor_12" type="Node3D" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
[node name="Corridor_12" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -25, 0, 35)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -25, 0, 35)
|
||||||
script = ExtResource("9_p0lbc")
|
|
||||||
|
|
||||||
[node name="Corridor_13" type="Node3D" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
[node name="Corridor_13" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -25, 0, 25)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -25, 0, 25)
|
||||||
script = ExtResource("9_p0lbc")
|
|
||||||
|
|
||||||
[node name="Corridor_14" type="Node3D" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
[node name="Corridor_14" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -25, 0, 15)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -25, 0, 15)
|
||||||
script = ExtResource("9_p0lbc")
|
|
||||||
|
|
||||||
[node name="Corridor_15" type="Node3D" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
[node name="Corridor_15" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -25, 0, 5)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -25, 0, 5)
|
||||||
script = ExtResource("9_p0lbc")
|
|
||||||
|
|
||||||
[node name="Corridor_16" type="Node3D" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
[node name="Corridor_16" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -25, 0, -5)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -25, 0, -5)
|
||||||
script = ExtResource("9_p0lbc")
|
|
||||||
|
|
||||||
[node name="Corridor_17" type="Node3D" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
[node name="Corridor_17" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -25, 0, -15)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -25, 0, -15)
|
||||||
script = ExtResource("9_p0lbc")
|
|
||||||
|
|
||||||
[node name="Corridor_18" type="Node3D" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
[node name="Corridor_18" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 35, 0, -45)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 35, 0, -45)
|
||||||
script = ExtResource("9_p0lbc")
|
|
||||||
|
|
||||||
[node name="Corridor_19" type="Node3D" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
[node name="Corridor_19" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 35, 0, -35)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 35, 0, -35)
|
||||||
script = ExtResource("9_p0lbc")
|
|
||||||
|
|
||||||
[node name="Corridor_20" type="Node3D" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
[node name="Corridor_20" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 45, 0, -35)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 45, 0, -35)
|
||||||
script = ExtResource("9_p0lbc")
|
|
||||||
|
|
||||||
[node name="Corridor_21" type="Node3D" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
[node name="Corridor_21" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 45, 0, -25)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 45, 0, -25)
|
||||||
script = ExtResource("9_p0lbc")
|
|
||||||
|
|||||||
@@ -24,6 +24,10 @@ public interface IGameRepo : IDisposable
|
|||||||
void SetPlayerGlobalPosition(Vector3 playerGlobalPosition);
|
void SetPlayerGlobalPosition(Vector3 playerGlobalPosition);
|
||||||
|
|
||||||
public Weapon EquippedWeapon { get; }
|
public Weapon EquippedWeapon { get; }
|
||||||
|
|
||||||
|
public AutoProp<int> HPBarValue { get; }
|
||||||
|
|
||||||
|
public AutoProp<int> VTBarValue { get; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class GameRepo : IGameRepo
|
public class GameRepo : IGameRepo
|
||||||
@@ -46,6 +50,10 @@ public class GameRepo : IGameRepo
|
|||||||
private Weapon _equippedWeapon;
|
private Weapon _equippedWeapon;
|
||||||
public Weapon EquippedWeapon => _equippedWeapon;
|
public Weapon EquippedWeapon => _equippedWeapon;
|
||||||
|
|
||||||
|
public AutoProp<int> HPBarValue { get; }
|
||||||
|
|
||||||
|
public AutoProp<int> VTBarValue { get; }
|
||||||
|
|
||||||
private bool _disposedValue;
|
private bool _disposedValue;
|
||||||
|
|
||||||
public GameRepo()
|
public GameRepo()
|
||||||
@@ -55,6 +63,8 @@ public class GameRepo : IGameRepo
|
|||||||
_isPaused = new AutoProp<bool>(false);
|
_isPaused = new AutoProp<bool>(false);
|
||||||
_playerGlobalPosition = new AutoProp<Vector3>(Vector3.Zero);
|
_playerGlobalPosition = new AutoProp<Vector3>(Vector3.Zero);
|
||||||
_equippedWeapon = new Weapon();
|
_equippedWeapon = new Weapon();
|
||||||
|
HPBarValue = new AutoProp<int>(0);
|
||||||
|
VTBarValue = new AutoProp<int>(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Pause()
|
public void Pause()
|
||||||
|
|||||||
@@ -3,9 +3,7 @@ using Chickensoft.Collections;
|
|||||||
using Chickensoft.GodotNodeInterfaces;
|
using Chickensoft.GodotNodeInterfaces;
|
||||||
using Chickensoft.Introspection;
|
using Chickensoft.Introspection;
|
||||||
using Chickensoft.SaveFileBuilder;
|
using Chickensoft.SaveFileBuilder;
|
||||||
using GameJamDungeon;
|
|
||||||
using Godot;
|
using Godot;
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace GameJamDungeon
|
namespace GameJamDungeon
|
||||||
{
|
{
|
||||||
@@ -65,11 +63,21 @@ namespace GameJamDungeon
|
|||||||
|
|
||||||
[Node] public IHitbox Hitbox { get; set; } = default!;
|
[Node] public IHitbox Hitbox { get; set; } = default!;
|
||||||
|
|
||||||
|
[Node] public Timer HealthTimer { get; set; } = default!;
|
||||||
|
|
||||||
|
[Node] public Label HPNumber { get; set; } = default!;
|
||||||
|
|
||||||
|
[Node] public Label VTNumber { get; set; } = default!;
|
||||||
|
|
||||||
|
[Node] public ProgressBar HPBar { get; set; } = default!;
|
||||||
|
|
||||||
|
[Node] public ProgressBar VTBar { get; set; } = default!;
|
||||||
|
|
||||||
private IAutoProp<WeaponInfo> EquippedWeapon { get; set; } = default!;
|
private IAutoProp<WeaponInfo> EquippedWeapon { get; set; } = default!;
|
||||||
|
|
||||||
private AutoProp<double> _currentHP { get; set; } = default!;
|
private AutoProp<double> _currentHP { get; set; } = default!;
|
||||||
|
|
||||||
private IAutoProp<int> _currentVT { get; set; } = default!;
|
private AutoProp<int> _currentVT { get; set; } = default!;
|
||||||
|
|
||||||
public void Initialize()
|
public void Initialize()
|
||||||
{
|
{
|
||||||
@@ -88,10 +96,22 @@ namespace GameJamDungeon
|
|||||||
PlayerLogic.Set(PlayerData);
|
PlayerLogic.Set(PlayerData);
|
||||||
|
|
||||||
GameRepo.SetPlayerGlobalPosition(GlobalPosition);
|
GameRepo.SetPlayerGlobalPosition(GlobalPosition);
|
||||||
|
GameRepo.PlayerGlobalPosition.Sync += OnPlayerPositionUpdated;
|
||||||
|
|
||||||
EquippedWeapon = new AutoProp<WeaponInfo>(WeaponInfo.Default);
|
EquippedWeapon = new AutoProp<WeaponInfo>(WeaponInfo.Default);
|
||||||
|
EquippedWeapon.Sync += OnEquippedWeaponChanged;
|
||||||
|
|
||||||
_currentHP = new AutoProp<double>(PlayerStatInfo.MaximumHP);
|
_currentHP = new AutoProp<double>(PlayerStatInfo.MaximumHP);
|
||||||
_currentVT = new AutoProp<int>(PlayerStatInfo.MaximumVT);
|
_currentVT = new AutoProp<int>(PlayerStatInfo.MaximumVT);
|
||||||
GameRepo.PlayerGlobalPosition.Sync += OnPlayerPositionUpdated;
|
_currentHP.Sync += OnHPChanged;
|
||||||
|
_currentVT.Sync += OnVTChanged;
|
||||||
|
|
||||||
|
HPBar.MaxValue = PlayerStatInfo.MaximumHP;
|
||||||
|
HPBar.Value = _currentHP.Value;
|
||||||
|
VTBar.MaxValue = PlayerStatInfo.MaximumVT;
|
||||||
|
VTBar.Value = _currentVT.Value;
|
||||||
|
|
||||||
|
HealthTimer.Timeout += OnHealthTimerTimeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnResolved()
|
public void OnResolved()
|
||||||
@@ -116,8 +136,6 @@ namespace GameJamDungeon
|
|||||||
this.Provide();
|
this.Provide();
|
||||||
PlayerLogic.Start();
|
PlayerLogic.Start();
|
||||||
|
|
||||||
EquippedWeapon.Sync += OnEquippedWeaponChanged;
|
|
||||||
_currentHP.Sync += OnHPChanged;
|
|
||||||
SwordSlashAnimation.Position = GetViewport().GetVisibleRect().Size / 2;
|
SwordSlashAnimation.Position = GetViewport().GetVisibleRect().Size / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -178,10 +196,27 @@ namespace GameJamDungeon
|
|||||||
|
|
||||||
private void OnHPChanged(double newHP)
|
private void OnHPChanged(double newHP)
|
||||||
{
|
{
|
||||||
|
HPNumber.Text = Mathf.RoundToInt(newHP).ToString();
|
||||||
|
HPBar.Value = newHP;
|
||||||
|
|
||||||
if (newHP <= 0.0)
|
if (newHP <= 0.0)
|
||||||
PlayerLogic.Input(new PlayerLogic.Input.Killed());
|
PlayerLogic.Input(new PlayerLogic.Input.Killed());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnVTChanged(int newVT)
|
||||||
|
{
|
||||||
|
VTNumber.Text = newVT.ToString();
|
||||||
|
VTBar.Value = newVT;
|
||||||
|
}
|
||||||
|
|
||||||
private void OnPlayerPositionUpdated(Vector3 globalPosition) => GlobalPosition = globalPosition;
|
private void OnPlayerPositionUpdated(Vector3 globalPosition) => GlobalPosition = globalPosition;
|
||||||
|
|
||||||
|
private void OnHealthTimerTimeout()
|
||||||
|
{
|
||||||
|
if (_currentVT.Value > 0)
|
||||||
|
_currentVT.OnNext(_currentVT.Value - 1);
|
||||||
|
else
|
||||||
|
_currentHP.OnNext(_currentHP.Value - 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -156,3 +156,47 @@ unique_name_in_owner = true
|
|||||||
scale = Vector2(9.03192, 6.39623)
|
scale = Vector2(9.03192, 6.39623)
|
||||||
sprite_frames = SubResource("SpriteFrames_ywvvo")
|
sprite_frames = SubResource("SpriteFrames_ywvvo")
|
||||||
animation = &"attack"
|
animation = &"attack"
|
||||||
|
|
||||||
|
[node name="HealthTimer" type="Timer" parent="."]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
wait_time = 3.0
|
||||||
|
autostart = true
|
||||||
|
|
||||||
|
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
theme_override_constants/margin_left = 20
|
||||||
|
theme_override_constants/margin_top = 20
|
||||||
|
theme_override_constants/margin_right = 20
|
||||||
|
theme_override_constants/margin_bottom = 20
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]
|
||||||
|
custom_minimum_size = Vector2(400, 0)
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 0
|
||||||
|
size_flags_vertical = 0
|
||||||
|
|
||||||
|
[node name="HPNumber" type="Label" parent="MarginContainer/VBoxContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
text = "HP: inf/inf"
|
||||||
|
|
||||||
|
[node name="HPBar" type="ProgressBar" parent="MarginContainer/VBoxContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
custom_minimum_size = Vector2(0, 25)
|
||||||
|
layout_mode = 2
|
||||||
|
show_percentage = false
|
||||||
|
|
||||||
|
[node name="VTNumber" type="Label" parent="MarginContainer/VBoxContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
text = "VT: inf/inf"
|
||||||
|
|
||||||
|
[node name="VTBar" type="ProgressBar" parent="MarginContainer/VBoxContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
custom_minimum_size = Vector2(0, 25)
|
||||||
|
layout_mode = 2
|
||||||
|
show_percentage = false
|
||||||
|
|||||||
Reference in New Issue
Block a user