add public bolt and energy properties to game

This commit is contained in:
Chris Cromer 2022-11-20 17:08:32 -03:00
parent d517be7b43
commit bd673c7872

View File

@ -3,9 +3,11 @@ using Godot;
public sealed class Game : Node public sealed class Game : Node
{ {
[Export] [Export]
private int _energy { get; set; } = 3; private int _energy = 3;
[Export] [Export]
private int _bolts { get; set; } = 0; private int _bolts = 0;
public int Energy { get { return _energy; } set { _energy = value; } }
public int Bolts { get { return _bolts; } set { _bolts = value; } }
public enum PhysicsLayer : ushort public enum PhysicsLayer : ushort
{ {
@ -26,18 +28,10 @@ public sealed class Game : Node
public void OnEnergyCollected(int energy) public void OnEnergyCollected(int energy)
{ {
_energy += energy; _energy += energy;
if (OS.IsDebugBuild())
{
GD.Print("Energy: " + _energy);
}
} }
public void OnBoltCollected(int bolts) public void OnBoltCollected(int bolts)
{ {
_bolts += bolts; _bolts += bolts;
if (OS.IsDebugBuild())
{
GD.Print("Bolts: " + _bolts);
}
} }
} }