add bolts to the debug overlay

This commit is contained in:
Chris Cromer 2022-11-20 17:09:21 -03:00
parent bd673c7872
commit 51ee11b6ce
2 changed files with 41 additions and 3 deletions

21
scenes/debugger/Bolts.cs Normal file
View File

@ -0,0 +1,21 @@
using Godot;
using System;
public class Bolts : Label
{
private Game _game;
private Event _event;
public override void _Ready()
{
_game = GetNode<Game>("/root/Game");
_event = GetNode<Event>("/root/Event");
_event.Connect("BoltCollected", this, "OnBoltCollected");
Text = "0";
}
public void OnBoltCollected(int bolts)
{
Text = _game.Bolts.ToString();
}
}

View File

@ -1,7 +1,8 @@
[gd_scene load_steps=3 format=2] [gd_scene load_steps=4 format=2]
[ext_resource path="res://scenes/debugger/StateDebugger.cs" type="Script" id=1] [ext_resource path="res://scenes/debugger/StateDebugger.cs" type="Script" id=1]
[ext_resource path="res://scenes/debugger/FPS.cs" type="Script" id=2] [ext_resource path="res://scenes/debugger/FPS.cs" type="Script" id=2]
[ext_resource path="res://scenes/debugger/Bolts.cs" type="Script" id=3]
[node name="Debugger" type="CanvasLayer"] [node name="Debugger" type="CanvasLayer"]
@ -12,7 +13,7 @@ anchor_bottom = 1.0
[node name="VBoxContainer" type="VBoxContainer" parent="Control"] [node name="VBoxContainer" type="VBoxContainer" parent="Control"]
[node name="HBoxContainer" type="HBoxContainer" parent="Control/VBoxContainer"] [node name="HBoxContainer" type="HBoxContainer" parent="Control/VBoxContainer"]
margin_right = 40.0 margin_right = 41.0
margin_bottom = 14.0 margin_bottom = 14.0
[node name="Label" type="Label" parent="Control/VBoxContainer/HBoxContainer"] [node name="Label" type="Label" parent="Control/VBoxContainer/HBoxContainer"]
@ -28,7 +29,7 @@ script = ExtResource( 2 )
[node name="HBoxContainer2" type="HBoxContainer" parent="Control/VBoxContainer"] [node name="HBoxContainer2" type="HBoxContainer" parent="Control/VBoxContainer"]
margin_top = 18.0 margin_top = 18.0
margin_right = 40.0 margin_right = 41.0
margin_bottom = 32.0 margin_bottom = 32.0
[node name="Label" type="Label" parent="Control/VBoxContainer/HBoxContainer2"] [node name="Label" type="Label" parent="Control/VBoxContainer/HBoxContainer2"]
@ -41,3 +42,19 @@ margin_left = 40.0
margin_right = 40.0 margin_right = 40.0
margin_bottom = 14.0 margin_bottom = 14.0
script = ExtResource( 1 ) script = ExtResource( 1 )
[node name="HBoxContainer3" type="HBoxContainer" parent="Control/VBoxContainer"]
margin_top = 36.0
margin_right = 41.0
margin_bottom = 50.0
[node name="Label" type="Label" parent="Control/VBoxContainer/HBoxContainer3"]
margin_right = 37.0
margin_bottom = 14.0
text = "Bolts:"
[node name="Label2" type="Label" parent="Control/VBoxContainer/HBoxContainer3"]
margin_left = 41.0
margin_right = 41.0
margin_bottom = 14.0
script = ExtResource( 3 )