!
This commit is contained in:
parent
3b9bcefd3f
commit
11564bb073
@ -5,6 +5,7 @@ public partial class player : Camera3D
|
|||||||
{
|
{
|
||||||
private const string _path = "/root/player/";
|
private const string _path = "/root/player/";
|
||||||
|
|
||||||
|
|
||||||
[Export]
|
[Export]
|
||||||
private Label _con;
|
private Label _con;
|
||||||
[Export]
|
[Export]
|
||||||
@ -30,11 +31,12 @@ public partial class player : Camera3D
|
|||||||
private AudioStreamPlayer _sndChtr, _sndBtn;
|
private AudioStreamPlayer _sndChtr, _sndBtn;
|
||||||
|
|
||||||
[Export]
|
[Export]
|
||||||
private Timer _tmrChtr;
|
private Timer _tmrChtr, _tmrCashGen;
|
||||||
|
|
||||||
private float Nuke { get => (float)_nuke.Value; set => _nuke.Value = value; }
|
private float Nukes { get => (float)_nuke.Value; set => _nuke.Value = value; }
|
||||||
private float PR { get => (float)_pr.Value; set => _pr.Value = value; }
|
private float PR { get => (float)_pr.Value; set => _pr.Value = value; }
|
||||||
private float Kash { get => (float)_kash.Value; set => _kash.Value = value; }
|
private float Kash { get => (float)_kash.Value; set => _kash.Value = value; }
|
||||||
|
private int KashFlow { get; set; } = 1;
|
||||||
|
|
||||||
private string Chatter
|
private string Chatter
|
||||||
{
|
{
|
||||||
@ -62,6 +64,7 @@ public partial class player : Camera3D
|
|||||||
}
|
}
|
||||||
_tmrChtr.Start();
|
_tmrChtr.Start();
|
||||||
_tmrChtr.Timeout += () => Chatter = "";
|
_tmrChtr.Timeout += () => Chatter = "";
|
||||||
|
_tmrCashGen.Timeout += MakeMoney;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void _Process(double delta)
|
public override void _Process(double delta)
|
||||||
@ -148,6 +151,38 @@ public partial class player : Camera3D
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void CheckGame() {
|
||||||
|
bool gameover = false;
|
||||||
|
|
||||||
|
if (PR <= 0)
|
||||||
|
gameover = true;
|
||||||
|
else if (Kash <= 0)
|
||||||
|
gameover = true;
|
||||||
|
else if (Nukes >= 100)
|
||||||
|
gameover = true;
|
||||||
|
|
||||||
|
if (gameover)
|
||||||
|
Chatter = "Game Over.";
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ChangeScore(int price, int pr, int nukes, int isCashCow) {
|
||||||
|
if (isCashCow > 1)
|
||||||
|
isCashCow = 1;
|
||||||
|
else if (isCashCow < -1)
|
||||||
|
isCashCow = -1;
|
||||||
|
|
||||||
|
Nukes += nukes;
|
||||||
|
PR += pr;
|
||||||
|
Kash -= price;
|
||||||
|
KashFlow += isCashCow;
|
||||||
|
CheckGame();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MakeMoney() {
|
||||||
|
Kash += KashFlow * 10;
|
||||||
|
CheckGame();
|
||||||
|
}
|
||||||
|
|
||||||
public void HandleBuilding()
|
public void HandleBuilding()
|
||||||
{
|
{
|
||||||
if (CurrentBuilding != null)
|
if (CurrentBuilding != null)
|
||||||
|
@ -68,7 +68,7 @@ height = 255
|
|||||||
[sub_resource type="LabelSettings" id="LabelSettings_pws5q"]
|
[sub_resource type="LabelSettings" id="LabelSettings_pws5q"]
|
||||||
font_size = 28
|
font_size = 28
|
||||||
|
|
||||||
[node name="player" type="Camera3D" node_paths=PackedStringArray("_con", "_mousePosLabel", "_cursorPosLabel", "_cursor", "_cursorPoint", "_nuke", "_pr", "_kash", "_chatter", "_sndChtr", "_sndBtn", "_tmrChtr")]
|
[node name="player" type="Camera3D" node_paths=PackedStringArray("_con", "_mousePosLabel", "_cursorPosLabel", "_cursor", "_cursorPoint", "_nuke", "_pr", "_kash", "_chatter", "_sndChtr", "_sndBtn", "_tmrChtr", "_tmrCashGen")]
|
||||||
attributes = SubResource("CameraAttributesPhysical_1ejpb")
|
attributes = SubResource("CameraAttributesPhysical_1ejpb")
|
||||||
script = ExtResource("1_of2l4")
|
script = ExtResource("1_of2l4")
|
||||||
_con = NodePath("Debug info/Label")
|
_con = NodePath("Debug info/Label")
|
||||||
@ -83,6 +83,7 @@ _chatter = NodePath("lbl_Chatter")
|
|||||||
_sndChtr = NodePath("snd_Chatter")
|
_sndChtr = NodePath("snd_Chatter")
|
||||||
_sndBtn = NodePath("snd_Button")
|
_sndBtn = NodePath("snd_Button")
|
||||||
_tmrChtr = NodePath("tmr_Chatter")
|
_tmrChtr = NodePath("tmr_Chatter")
|
||||||
|
_tmrCashGen = NodePath("tmr_kash")
|
||||||
|
|
||||||
[node name="Debug info" type="Control" parent="."]
|
[node name="Debug info" type="Control" parent="."]
|
||||||
visible = false
|
visible = false
|
||||||
@ -133,6 +134,8 @@ offset_right = 1841.0
|
|||||||
offset_bottom = 919.0
|
offset_bottom = 919.0
|
||||||
value = 50.0
|
value = 50.0
|
||||||
rounded = true
|
rounded = true
|
||||||
|
allow_greater = true
|
||||||
|
allow_lesser = true
|
||||||
fill_mode = 3
|
fill_mode = 3
|
||||||
texture_under = SubResource("GradientTexture2D_2xkee")
|
texture_under = SubResource("GradientTexture2D_2xkee")
|
||||||
texture_progress = SubResource("GradientTexture2D_d5w6a")
|
texture_progress = SubResource("GradientTexture2D_d5w6a")
|
||||||
@ -144,6 +147,8 @@ offset_right = 1869.0
|
|||||||
offset_bottom = 919.0
|
offset_bottom = 919.0
|
||||||
value = 50.0
|
value = 50.0
|
||||||
rounded = true
|
rounded = true
|
||||||
|
allow_greater = true
|
||||||
|
allow_lesser = true
|
||||||
fill_mode = 3
|
fill_mode = 3
|
||||||
texture_under = SubResource("GradientTexture2D_7myfq")
|
texture_under = SubResource("GradientTexture2D_7myfq")
|
||||||
texture_progress = SubResource("GradientTexture2D_kdame")
|
texture_progress = SubResource("GradientTexture2D_kdame")
|
||||||
@ -153,8 +158,11 @@ offset_left = 1873.0
|
|||||||
offset_top = 664.0
|
offset_top = 664.0
|
||||||
offset_right = 1897.0
|
offset_right = 1897.0
|
||||||
offset_bottom = 919.0
|
offset_bottom = 919.0
|
||||||
value = 50.0
|
max_value = 1000.0
|
||||||
|
value = 5.0
|
||||||
rounded = true
|
rounded = true
|
||||||
|
allow_greater = true
|
||||||
|
allow_lesser = true
|
||||||
fill_mode = 3
|
fill_mode = 3
|
||||||
texture_under = SubResource("GradientTexture2D_18k81")
|
texture_under = SubResource("GradientTexture2D_18k81")
|
||||||
texture_progress = SubResource("GradientTexture2D_nfg3s")
|
texture_progress = SubResource("GradientTexture2D_nfg3s")
|
||||||
@ -214,3 +222,7 @@ stream = ExtResource("3_00x5l")
|
|||||||
|
|
||||||
[node name="tmr_Chatter" type="Timer" parent="."]
|
[node name="tmr_Chatter" type="Timer" parent="."]
|
||||||
wait_time = 3.0
|
wait_time = 3.0
|
||||||
|
one_shot = true
|
||||||
|
|
||||||
|
[node name="tmr_kash" type="Timer" parent="."]
|
||||||
|
autostart = true
|
||||||
|
Loading…
Reference in New Issue
Block a user