mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-07-01 06:51:17 +00:00
graphics and ammo counting
This commit is contained in:
parent
7548cf7d84
commit
dfe936461e
11 changed files with 45 additions and 35 deletions
|
|
@ -1,7 +1,8 @@
|
||||||
[gd_scene load_steps=7 format=3 uid="uid://sjxkj5jdndxb"]
|
[gd_scene load_steps=8 format=3 uid="uid://sjxkj5jdndxb"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://b3h7b30kerf60" path="res://Scripts/Interactables/ItemPickup.cs" id="1_o42iv"]
|
[ext_resource type="Script" uid="uid://b3h7b30kerf60" path="res://Scripts/Interactables/ItemPickup.cs" id="1_o42iv"]
|
||||||
[ext_resource type="Resource" uid="uid://diqm2ju0xakkt" path="res://Resources/Items/Yin_Yang_Ammo.tres" id="2_o42iv"]
|
[ext_resource type="Resource" uid="uid://diqm2ju0xakkt" path="res://Resources/Items/Yin_Yang_Ammo.tres" id="2_o42iv"]
|
||||||
|
[ext_resource type="Script" uid="uid://epnwjptvks3t" path="res://Scripts/Resources/LootItem.cs" id="2_q76u6"]
|
||||||
[ext_resource type="Texture2D" uid="uid://b61po207ggn63" path="res://Sprites/Items/Yin_Ammo.png" id="3_o42iv"]
|
[ext_resource type="Texture2D" uid="uid://b61po207ggn63" path="res://Sprites/Items/Yin_Ammo.png" id="3_o42iv"]
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_6vv2s"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_6vv2s"]
|
||||||
|
|
@ -25,7 +26,7 @@ animations = [{
|
||||||
collision_layer = 4
|
collision_layer = 4
|
||||||
collision_mask = 2
|
collision_mask = 2
|
||||||
script = ExtResource("1_o42iv")
|
script = ExtResource("1_o42iv")
|
||||||
LootTable = [ExtResource("2_o42iv")]
|
LootTable = Array[ExtResource("2_q76u6")]([ExtResource("2_o42iv")])
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
shape = SubResource("CircleShape2D_6vv2s")
|
shape = SubResource("CircleShape2D_6vv2s")
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@
|
||||||
[sub_resource type="Resource" id="Resource_6sau4"]
|
[sub_resource type="Resource" id="Resource_6sau4"]
|
||||||
script = ExtResource("7_l32kg")
|
script = ExtResource("7_l32kg")
|
||||||
EggIndex = 0
|
EggIndex = 0
|
||||||
StartingEquipment = [ExtResource("6_khabp")]
|
StartingEquipment = Array[ExtResource("6_8tdlb")]([ExtResource("6_khabp")])
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ksslq"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ksslq"]
|
||||||
size = Vector2(184, 46.5)
|
size = Vector2(184, 46.5)
|
||||||
|
|
@ -987,7 +987,7 @@ position = Vector2(-2000, -736)
|
||||||
[node name="ControlPad8" parent="Factory Tilemaps/LevelProps" node_paths=PackedStringArray("Targets") instance=ExtResource("12_hfkf1")]
|
[node name="ControlPad8" parent="Factory Tilemaps/LevelProps" node_paths=PackedStringArray("Targets") instance=ExtResource("12_hfkf1")]
|
||||||
position = Vector2(-2027, -735)
|
position = Vector2(-2027, -735)
|
||||||
Targets = [NodePath("../HorizontalForceField")]
|
Targets = [NodePath("../HorizontalForceField")]
|
||||||
Requirements = [ExtResource("84_ma1ta")]
|
Requirements = Array[ExtResource("6_8tdlb")]([ExtResource("84_ma1ta")])
|
||||||
|
|
||||||
[node name="Ammo6" parent="Factory Tilemaps/LevelProps" instance=ExtResource("34_17pjh")]
|
[node name="Ammo6" parent="Factory Tilemaps/LevelProps" instance=ExtResource("34_17pjh")]
|
||||||
position = Vector2(-872, -220)
|
position = Vector2(-872, -220)
|
||||||
|
|
|
||||||
|
|
@ -333,7 +333,7 @@ public partial class Hud : CanvasLayer
|
||||||
// Clear all items
|
// Clear all items
|
||||||
foreach (var hudItem in _items)
|
foreach (var hudItem in _items)
|
||||||
{
|
{
|
||||||
hudItem.Value.QueueFree();
|
hudItem.Value.Delete();
|
||||||
}
|
}
|
||||||
_items.Clear();
|
_items.Clear();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,9 +65,10 @@ public partial class InventoryManager : Node2D
|
||||||
|
|
||||||
itm.Count -= amount;
|
itm.Count -= amount;
|
||||||
|
|
||||||
if (itm.Count <= 0)
|
if (itm.Count < 0)
|
||||||
{
|
{
|
||||||
_itemsDict.Remove(itemKey);
|
itm.Count = 0;
|
||||||
|
//_itemsDict.Remove(itemKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
EmitSignal(SignalName.ItemRemoved, itemKey, itm.Count);
|
EmitSignal(SignalName.ItemRemoved, itemKey, itm.Count);
|
||||||
|
|
@ -119,16 +120,6 @@ public partial class InventoryManager : Node2D
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddRedKeycard()
|
|
||||||
{
|
|
||||||
RedKeycard = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void RemoveRedKeycard()
|
|
||||||
{
|
|
||||||
RedKeycard = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool UseItem(string itemKey)
|
public bool UseItem(string itemKey)
|
||||||
{
|
{
|
||||||
if (!_itemsDict.TryGetValue(itemKey, out var itm)) return false;
|
if (!_itemsDict.TryGetValue(itemKey, out var itm)) return false;
|
||||||
|
|
|
||||||
|
|
@ -37,13 +37,31 @@ public partial class WeaponAmmoCounter : Container
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (InventoryManager.Instance.TryGetItem(item.WeaponData.AmmoKey, out var ammoItem))
|
||||||
|
{
|
||||||
|
AmmoIcon.Texture = ammoItem.Item.InventorySprite;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AmmoIcon.Hide();
|
||||||
|
}
|
||||||
|
//AmmoIcon.Texture = InventoryManager.Instance.
|
||||||
|
|
||||||
UpdateCounter();
|
UpdateCounter();
|
||||||
// Register this only if there's ammo
|
// Register this only if there's ammo
|
||||||
InventoryManager.Instance.TotalAmmoChanged += (ammoKey, count) =>
|
InventoryManager.Instance.TotalAmmoChanged += OnInstanceOnTotalAmmoChanged;
|
||||||
{
|
}
|
||||||
if (ammoKey != Item.WeaponData.AmmoKey) return;
|
|
||||||
TotalAmmoLabel.Text = count.ToString();
|
private void OnInstanceOnTotalAmmoChanged(StringName ammoKey, int count)
|
||||||
};
|
{
|
||||||
|
if (ammoKey != Item.WeaponData.AmmoKey) return;
|
||||||
|
TotalAmmoLabel.Text = count.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Delete()
|
||||||
|
{
|
||||||
|
InventoryManager.Instance.TotalAmmoChanged -= OnInstanceOnTotalAmmoChanged;
|
||||||
|
QueueFree();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateCounter()
|
private void UpdateCounter()
|
||||||
|
|
|
||||||
BIN
Sprites/Items/BlueKeycard_Small.aseprite
(Stored with Git LFS)
BIN
Sprites/Items/BlueKeycard_Small.aseprite
(Stored with Git LFS)
Binary file not shown.
BIN
Sprites/Items/BlueKeycard_Small.png
(Stored with Git LFS)
BIN
Sprites/Items/BlueKeycard_Small.png
(Stored with Git LFS)
Binary file not shown.
BIN
Sprites/Items/GreenKeycard_Small.aseprite
(Stored with Git LFS)
BIN
Sprites/Items/GreenKeycard_Small.aseprite
(Stored with Git LFS)
Binary file not shown.
BIN
Sprites/Items/GreenKeycard_Small.png
(Stored with Git LFS)
BIN
Sprites/Items/GreenKeycard_Small.png
(Stored with Git LFS)
Binary file not shown.
BIN
Sprites/Items/RedKeycard_Small.aseprite
(Stored with Git LFS)
BIN
Sprites/Items/RedKeycard_Small.aseprite
(Stored with Git LFS)
Binary file not shown.
BIN
Sprites/Items/RedKeycard_Small.png
(Stored with Git LFS)
BIN
Sprites/Items/RedKeycard_Small.png
(Stored with Git LFS)
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue