Merge branch 'main' of https://github.com/MarcEricMartel/MAD
This commit is contained in:
commit
d0bee7e84e
121
endings/coldwar.tscn
Normal file
121
endings/coldwar.tscn
Normal file
@ -0,0 +1,121 @@
|
||||
[gd_scene load_steps=6 format=3 uid="uid://fnb1sopytvxv"]
|
||||
|
||||
[ext_resource type="Script" path="res://endings/mad.cs" id="1_jpwpx"]
|
||||
[ext_resource type="AudioStream" uid="uid://dye3nhm41yk6r" path="res://audio/chatter.wav" id="2_7k3ie"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_idu4g"]
|
||||
offsets = PackedFloat32Array(0, 0.995455)
|
||||
colors = PackedColorArray(0, 0, 0, 1, 0, 0, 0, 1)
|
||||
|
||||
[sub_resource type="GradientTexture1D" id="GradientTexture1D_4xda4"]
|
||||
gradient = SubResource("Gradient_idu4g")
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_mpvba"]
|
||||
font_size = 30
|
||||
font_color = Color(0.0431373, 0.352941, 0.286275, 1)
|
||||
outline_size = 5
|
||||
|
||||
[node name="Node2D" type="Control" node_paths=PackedStringArray("_lb1", "_lb2", "_lb3", "_lb4", "_lb0", "_tmr")]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_jpwpx")
|
||||
_lb1 = NodePath("Label")
|
||||
_lb2 = NodePath("Label2")
|
||||
_lb3 = NodePath("Label3")
|
||||
_lb4 = NodePath("Label4")
|
||||
_lb0 = NodePath("Why")
|
||||
_tmr = NodePath("Timer")
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_vertical = 0
|
||||
texture = SubResource("GradientTexture1D_4xda4")
|
||||
expand_mode = 1
|
||||
|
||||
[node name="Why" type="Label" parent="."]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -20.0
|
||||
offset_top = -11.5
|
||||
offset_right = 20.0
|
||||
offset_bottom = 11.5
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
text = "... and it kept on going and going ..."
|
||||
label_settings = SubResource("LabelSettings_mpvba")
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
offset_left = 40.0
|
||||
offset_top = 31.0
|
||||
offset_right = 342.0
|
||||
offset_bottom = 57.0
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="Label2" type="Label" parent="."]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchors_preset = 1
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
offset_left = -342.0
|
||||
offset_top = 28.0
|
||||
offset_right = -40.0
|
||||
offset_bottom = 54.0
|
||||
grow_horizontal = 0
|
||||
text = " "
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="Label3" type="Label" parent="."]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchors_preset = 2
|
||||
anchor_top = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = 39.0
|
||||
offset_top = -141.0
|
||||
offset_right = 336.0
|
||||
offset_bottom = -115.0
|
||||
grow_vertical = 0
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="Label4" type="Label" parent="."]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchors_preset = 3
|
||||
anchor_left = 1.0
|
||||
anchor_top = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -258.0
|
||||
offset_top = -150.0
|
||||
offset_right = -144.0
|
||||
offset_bottom = -124.0
|
||||
grow_horizontal = 0
|
||||
grow_vertical = 0
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="Timer" type="Timer" parent="."]
|
||||
wait_time = 2.0
|
||||
autostart = true
|
||||
|
||||
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("2_7k3ie")
|
||||
volume_db = -21.256
|
||||
pitch_scale = 0.48
|
||||
autoplay = true
|
117
endings/gotnuked.tscn
Normal file
117
endings/gotnuked.tscn
Normal file
@ -0,0 +1,117 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://c6xxtr3il1hik"]
|
||||
|
||||
[ext_resource type="Script" path="res://endings/mad.cs" id="1_0rnjn"]
|
||||
[ext_resource type="Texture2D" uid="uid://b44vs2lwgnh37" path="res://images/mushroom_cloud001.webp" id="2_kut5n"]
|
||||
[ext_resource type="AudioStream" uid="uid://crx8mwvfcdpmg" path="res://audio/gameover.wav" id="3_v54xl"]
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_mpvba"]
|
||||
font_size = 30
|
||||
font_color = Color(0.580392, 0, 0.00784314, 1)
|
||||
outline_size = 5
|
||||
|
||||
[node name="Node2D" type="Control" node_paths=PackedStringArray("_lb1", "_lb2", "_lb3", "_lb4", "_lb0", "_tmr")]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_0rnjn")
|
||||
_lb1 = NodePath("Label")
|
||||
_lb2 = NodePath("Label2")
|
||||
_lb3 = NodePath("Label3")
|
||||
_lb4 = NodePath("Label4")
|
||||
_lb0 = NodePath("Why")
|
||||
_tmr = NodePath("Timer")
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_vertical = 0
|
||||
texture = ExtResource("2_kut5n")
|
||||
expand_mode = 1
|
||||
|
||||
[node name="Why" type="Label" parent="."]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -20.0
|
||||
offset_top = -11.5
|
||||
offset_right = 20.0
|
||||
offset_bottom = 11.5
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
text = "You were not enough of a threat to your enemy."
|
||||
label_settings = SubResource("LabelSettings_mpvba")
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
offset_left = 40.0
|
||||
offset_top = 31.0
|
||||
offset_right = 342.0
|
||||
offset_bottom = 57.0
|
||||
text = "It's the end of the world as we know it, "
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="Label2" type="Label" parent="."]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchors_preset = 1
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
offset_left = -342.0
|
||||
offset_top = 28.0
|
||||
offset_right = -40.0
|
||||
offset_bottom = 54.0
|
||||
grow_horizontal = 0
|
||||
text = "it's the end of the world as we know it, "
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="Label3" type="Label" parent="."]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchors_preset = 2
|
||||
anchor_top = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = 39.0
|
||||
offset_top = -141.0
|
||||
offset_right = 336.0
|
||||
offset_bottom = -115.0
|
||||
grow_vertical = 0
|
||||
text = "it's the end of the world as we know it,"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="Label4" type="Label" parent="."]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchors_preset = 3
|
||||
anchor_left = 1.0
|
||||
anchor_top = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -258.0
|
||||
offset_top = -150.0
|
||||
offset_right = -144.0
|
||||
offset_bottom = -124.0
|
||||
grow_horizontal = 0
|
||||
grow_vertical = 0
|
||||
text = "and I feel fine. "
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="Timer" type="Timer" parent="."]
|
||||
wait_time = 2.0
|
||||
autostart = true
|
||||
|
||||
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("3_v54xl")
|
||||
pitch_scale = 0.48
|
||||
autoplay = true
|
@ -7,7 +7,7 @@ public partial class mad : Control
|
||||
private List<Label> _lbls;
|
||||
|
||||
[Export]
|
||||
private Label _lb1, _lb2, _lb3, _lb4;
|
||||
private Label _lb1, _lb2, _lb3, _lb4, _lb0;
|
||||
|
||||
[Export]
|
||||
private Timer _tmr;
|
||||
@ -16,6 +16,7 @@ public partial class mad : Control
|
||||
public override void _Ready()
|
||||
{
|
||||
_lbls = new();
|
||||
_lbls.Add(_lb0);
|
||||
_lbls.Add(_lb1);
|
||||
_lbls.Add(_lb2);
|
||||
_lbls.Add(_lb3);
|
||||
|
@ -1,10 +1,15 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://bad1nbou8xmb3"]
|
||||
[gd_scene load_steps=5 format=3 uid="uid://bad1nbou8xmb3"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://b44vs2lwgnh37" path="res://images/mushroom_cloud001.webp" id="1_gaysb"]
|
||||
[ext_resource type="Script" path="res://endings/mad.cs" id="1_tmwdq"]
|
||||
[ext_resource type="AudioStream" uid="uid://crx8mwvfcdpmg" path="res://audio/gameover.wav" id="3_umlek"]
|
||||
|
||||
[node name="Node2D" type="Control" node_paths=PackedStringArray("_lb1", "_lb2", "_lb3", "_lb4", "_tmr")]
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_mpvba"]
|
||||
font_size = 30
|
||||
font_color = Color(0.580392, 0, 0.00784314, 1)
|
||||
outline_size = 5
|
||||
|
||||
[node name="Node2D" type="Control" node_paths=PackedStringArray("_lb1", "_lb2", "_lb3", "_lb4", "_lb0", "_tmr")]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
@ -16,6 +21,7 @@ _lb1 = NodePath("Label")
|
||||
_lb2 = NodePath("Label2")
|
||||
_lb3 = NodePath("Label3")
|
||||
_lb4 = NodePath("Label4")
|
||||
_lb0 = NodePath("Why")
|
||||
_tmr = NodePath("Timer")
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="."]
|
||||
@ -29,6 +35,23 @@ size_flags_vertical = 0
|
||||
texture = ExtResource("1_gaysb")
|
||||
expand_mode = 1
|
||||
|
||||
[node name="Why" type="Label" parent="."]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -20.0
|
||||
offset_top = -11.5
|
||||
offset_right = 20.0
|
||||
offset_bottom = 11.5
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
text = "You sent yourself and your opponent to oblivion."
|
||||
label_settings = SubResource("LabelSettings_mpvba")
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
|
121
endings/peace.tscn
Normal file
121
endings/peace.tscn
Normal file
@ -0,0 +1,121 @@
|
||||
[gd_scene load_steps=6 format=3 uid="uid://fbgmlglffuoh"]
|
||||
|
||||
[ext_resource type="Script" path="res://endings/mad.cs" id="1_q3quu"]
|
||||
[ext_resource type="AudioStream" uid="uid://dye3nhm41yk6r" path="res://audio/chatter.wav" id="2_brbft"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_idu4g"]
|
||||
offsets = PackedFloat32Array(0, 0.995455)
|
||||
colors = PackedColorArray(0, 0, 0, 1, 0, 0, 0, 1)
|
||||
|
||||
[sub_resource type="GradientTexture1D" id="GradientTexture1D_4xda4"]
|
||||
gradient = SubResource("Gradient_idu4g")
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_mpvba"]
|
||||
font_size = 30
|
||||
font_color = Color(0.0431373, 0.352941, 0.286275, 1)
|
||||
outline_size = 5
|
||||
|
||||
[node name="Node2D" type="Control" node_paths=PackedStringArray("_lb1", "_lb2", "_lb3", "_lb4", "_lb0", "_tmr")]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_q3quu")
|
||||
_lb1 = NodePath("Label")
|
||||
_lb2 = NodePath("Label2")
|
||||
_lb3 = NodePath("Label3")
|
||||
_lb4 = NodePath("Label4")
|
||||
_lb0 = NodePath("Why")
|
||||
_tmr = NodePath("Timer")
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_vertical = 0
|
||||
texture = SubResource("GradientTexture1D_4xda4")
|
||||
expand_mode = 1
|
||||
|
||||
[node name="Why" type="Label" parent="."]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -20.0
|
||||
offset_top = -11.5
|
||||
offset_right = 20.0
|
||||
offset_bottom = 11.5
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
text = "You didn't even try, but maybe it was for the best."
|
||||
label_settings = SubResource("LabelSettings_mpvba")
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
offset_left = 40.0
|
||||
offset_top = 31.0
|
||||
offset_right = 342.0
|
||||
offset_bottom = 57.0
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="Label2" type="Label" parent="."]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchors_preset = 1
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
offset_left = -342.0
|
||||
offset_top = 28.0
|
||||
offset_right = -40.0
|
||||
offset_bottom = 54.0
|
||||
grow_horizontal = 0
|
||||
text = " "
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="Label3" type="Label" parent="."]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchors_preset = 2
|
||||
anchor_top = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = 39.0
|
||||
offset_top = -141.0
|
||||
offset_right = 336.0
|
||||
offset_bottom = -115.0
|
||||
grow_vertical = 0
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="Label4" type="Label" parent="."]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchors_preset = 3
|
||||
anchor_left = 1.0
|
||||
anchor_top = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -258.0
|
||||
offset_top = -150.0
|
||||
offset_right = -144.0
|
||||
offset_bottom = -124.0
|
||||
grow_horizontal = 0
|
||||
grow_vertical = 0
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="Timer" type="Timer" parent="."]
|
||||
wait_time = 2.0
|
||||
autostart = true
|
||||
|
||||
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("2_brbft")
|
||||
volume_db = -21.256
|
||||
pitch_scale = 0.48
|
||||
autoplay = true
|
@ -1,10 +1,10 @@
|
||||
[gd_scene load_steps=10 format=3 uid="uid://4tym1auav4yv"]
|
||||
|
||||
[ext_resource type="Script" path="res://menu/start_game_menu.cs" id="1_0k2xm"]
|
||||
[ext_resource type="Texture2D" uid="uid://bd7j1ug5gs26w" path="res://images/mushroom_cloud001.webp" id="2_aky60"]
|
||||
[ext_resource type="AudioStream" uid="uid://co52ygvp3wcra" path="res://music/I Feel Grunge (Slow).wav" id="2_yw57x"]
|
||||
[ext_resource type="AudioStream" uid="uid://ds7ec1n3pytnr" path="res://audio/btn.wav" id="4_fx2mk"]
|
||||
[ext_resource type="AudioStream" uid="uid://cg78xtngxrjlg" path="res://audio/dot.wav" id="5_y8gc7"]
|
||||
[ext_resource type="Texture2D" uid="uid://b44vs2lwgnh37" path="res://images/mushroom_cloud001.webp" id="2_aky60"]
|
||||
[ext_resource type="AudioStream" uid="uid://ckg5eypyrhidg" path="res://music/I Feel Grunge (Slow).wav" id="2_yw57x"]
|
||||
[ext_resource type="AudioStream" uid="uid://c8dcqkmytnyay" path="res://audio/btn.wav" id="4_fx2mk"]
|
||||
[ext_resource type="AudioStream" uid="uid://dja6tipmq1m8l" path="res://audio/dot.wav" id="5_y8gc7"]
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_n38oc"]
|
||||
font_size = 290
|
||||
|
539
player/player.cs
539
player/player.cs
@ -3,318 +3,323 @@ using System;
|
||||
|
||||
public partial class player : Camera3D
|
||||
{
|
||||
private const string _path = "/root/player/";
|
||||
private const string _path = "/root/player/";
|
||||
|
||||
[Export]
|
||||
private Label _con;
|
||||
[Export]
|
||||
private Label _mousePosLabel;
|
||||
[Export]
|
||||
private Label _cursorPosLabel;
|
||||
[Export]
|
||||
private RayCast3D _cursor;
|
||||
[Export]
|
||||
private Node3D _cursorPoint;
|
||||
private bool _mUp, _mDown, _mLeft, _mRight, _wIn, _wOut;
|
||||
[Export]
|
||||
private Label _con;
|
||||
[Export]
|
||||
private Label _mousePosLabel;
|
||||
[Export]
|
||||
private Label _cursorPosLabel;
|
||||
[Export]
|
||||
private RayCast3D _cursor;
|
||||
[Export]
|
||||
private Node3D _cursorPoint;
|
||||
private bool _mUp, _mDown, _mLeft, _mRight, _wIn, _wOut;
|
||||
|
||||
|
||||
private enum buildingType
|
||||
{
|
||||
kash,
|
||||
pr,
|
||||
nuke
|
||||
}
|
||||
private enum buildingType
|
||||
{
|
||||
kash,
|
||||
pr,
|
||||
nuke
|
||||
}
|
||||
|
||||
[Export]
|
||||
private PackedScene _kash_building;
|
||||
[Export]
|
||||
private PackedScene _pr_building;
|
||||
[Export]
|
||||
private PackedScene _nuke_building;
|
||||
[Export]
|
||||
private PackedScene _kash_building;
|
||||
[Export]
|
||||
private PackedScene _pr_building;
|
||||
[Export]
|
||||
private PackedScene _nuke_building;
|
||||
|
||||
[Export]
|
||||
private TextureProgressBar _nuke, _pr, _kash;
|
||||
[Export]
|
||||
private TextureProgressBar _nuke, _pr, _kash;
|
||||
|
||||
[Export]
|
||||
private Label _chatter, _timer, _pr_count, _nuke_count, _kash_count;
|
||||
[Export]
|
||||
private Label _chatter, _timer, _pr_count, _nuke_count, _kash_count;
|
||||
|
||||
[Export]
|
||||
private AudioStreamPlayer _sndChtr, _sndBtn;
|
||||
[Export]
|
||||
private AudioStreamPlayer _sndChtr, _sndBtn;
|
||||
|
||||
[Export]
|
||||
private Timer _tmrChtr, _tmrCashGen;
|
||||
[Export]
|
||||
private Timer _tmrChtr, _tmrCashGen;
|
||||
|
||||
[Export]
|
||||
private Button _btnEnd, _btnNukes, _btnPR, _btnKashCow;
|
||||
[Export]
|
||||
private Button _btnEnd, _btnNukes, _btnPR, _btnKashCow;
|
||||
|
||||
private float Nukes { get => (float)_nuke.Value; set => _nuke.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 int KashFlow { get; set; } = 1;
|
||||
private int GameTime { get; set; } = 60;
|
||||
private float Nukes { get => (float)_nuke.Value; set => _nuke.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 int KashFlow { get; set; } = 1;
|
||||
private int GameTime { get; set; } = 60;
|
||||
|
||||
private string Chatter
|
||||
{
|
||||
get => _chatter.Get("text").ToString(); set
|
||||
{
|
||||
if (value != "")
|
||||
_sndChtr.Play();
|
||||
_chatter.Set("text", value);
|
||||
_tmrChtr.Start();
|
||||
}
|
||||
}
|
||||
private string Chatter
|
||||
{
|
||||
get => _chatter.Get("text").ToString(); set
|
||||
{
|
||||
if (value != "")
|
||||
_sndChtr.Play();
|
||||
_chatter.Set("text", value);
|
||||
_tmrChtr.Start();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public base_building CurrentBuilding { get; set; }
|
||||
public base_building CurrentBuilding { get; set; }
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_tmrChtr.Start();
|
||||
_tmrChtr.Timeout += () => Chatter = "";
|
||||
_tmrCashGen.Timeout += MakeMoney;
|
||||
_btnEnd.Pressed += () => _sndBtn.Play();
|
||||
_btnNukes.Pressed += () => HandleBtnNuke();
|
||||
_btnPR.Pressed += () => HandleBtnPR();
|
||||
_btnKashCow.Pressed += () => HandleBtnKash();
|
||||
Chatter = "The enemy is stockpiling weapons of mass destruction.";
|
||||
public override void _Ready()
|
||||
{
|
||||
_tmrChtr.Start();
|
||||
_tmrChtr.Timeout += () => Chatter = "";
|
||||
_tmrCashGen.Timeout += MakeMoney;
|
||||
_btnEnd.Pressed += () => _sndBtn.Play();
|
||||
_btnNukes.Pressed += () => HandleBtnNuke();
|
||||
_btnPR.Pressed += () => HandleBtnPR();
|
||||
_btnKashCow.Pressed += () => HandleBtnKash();
|
||||
Chatter = "The enemy is stockpiling weapons of mass destruction.";
|
||||
|
||||
SetBarLabels();
|
||||
}
|
||||
SetBarLabels();
|
||||
}
|
||||
|
||||
private void UnHandBuilding()
|
||||
{
|
||||
if (CurrentBuilding != null)
|
||||
{
|
||||
GetTree().Root.RemoveChild(CurrentBuilding);
|
||||
CurrentBuilding.QueueFree();
|
||||
CurrentBuilding = null;
|
||||
game_manager.CurrentState = game_manager.State.Play;
|
||||
}
|
||||
}
|
||||
private void UnHandBuilding()
|
||||
{
|
||||
if (CurrentBuilding != null)
|
||||
{
|
||||
GetTree().Root.RemoveChild(CurrentBuilding);
|
||||
CurrentBuilding.QueueFree();
|
||||
CurrentBuilding = null;
|
||||
game_manager.CurrentState = game_manager.State.Play;
|
||||
}
|
||||
}
|
||||
|
||||
private void InstantiateBuilding(buildingType type)
|
||||
{
|
||||
PackedScene toInstantiate = null;
|
||||
UnHandBuilding();
|
||||
switch (type)
|
||||
{
|
||||
case buildingType.kash:
|
||||
toInstantiate = _kash_building;
|
||||
break;
|
||||
case buildingType.pr:
|
||||
toInstantiate = _pr_building;
|
||||
break;
|
||||
case buildingType.nuke:
|
||||
toInstantiate = _nuke_building;
|
||||
break;
|
||||
default:
|
||||
toInstantiate = _kash_building;
|
||||
break;
|
||||
}
|
||||
private void InstantiateBuilding(buildingType type)
|
||||
{
|
||||
PackedScene toInstantiate = null;
|
||||
UnHandBuilding();
|
||||
switch (type)
|
||||
{
|
||||
case buildingType.kash:
|
||||
toInstantiate = _kash_building;
|
||||
break;
|
||||
case buildingType.pr:
|
||||
toInstantiate = _pr_building;
|
||||
break;
|
||||
case buildingType.nuke:
|
||||
toInstantiate = _nuke_building;
|
||||
break;
|
||||
default:
|
||||
toInstantiate = _kash_building;
|
||||
break;
|
||||
}
|
||||
|
||||
CurrentBuilding = toInstantiate.Instantiate<base_building>();
|
||||
GetTree().Root.CallDeferred("add_child", CurrentBuilding);
|
||||
game_manager.CurrentState = game_manager.State.Building;
|
||||
}
|
||||
CurrentBuilding = toInstantiate.Instantiate<base_building>();
|
||||
GetTree().Root.CallDeferred("add_child", CurrentBuilding);
|
||||
game_manager.CurrentState = game_manager.State.Building;
|
||||
}
|
||||
|
||||
private void HandleBtnNuke()
|
||||
{
|
||||
_sndBtn.Play();
|
||||
InstantiateBuilding(buildingType.nuke);
|
||||
}
|
||||
private void HandleBtnPR()
|
||||
{
|
||||
_sndBtn.Play();
|
||||
InstantiateBuilding(buildingType.pr);
|
||||
}
|
||||
private void HandleBtnKash()
|
||||
{
|
||||
_sndBtn.Play();
|
||||
InstantiateBuilding(buildingType.kash);
|
||||
}
|
||||
private void HandleBtnNuke()
|
||||
{
|
||||
_sndBtn.Play();
|
||||
InstantiateBuilding(buildingType.nuke);
|
||||
}
|
||||
private void HandleBtnPR()
|
||||
{
|
||||
_sndBtn.Play();
|
||||
InstantiateBuilding(buildingType.pr);
|
||||
}
|
||||
private void HandleBtnKash()
|
||||
{
|
||||
_sndBtn.Play();
|
||||
InstantiateBuilding(buildingType.kash);
|
||||
}
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
Vector3 rot = this.Rotation;
|
||||
bool zin = true, zout = true;
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
Vector3 rot = this.Rotation;
|
||||
bool zin = true, zout = true;
|
||||
|
||||
if (Input.IsActionPressed("CamNorth"))
|
||||
_mUp = true;
|
||||
if (Input.IsActionPressed("CamSouth"))
|
||||
_mDown = true;
|
||||
if (Input.IsActionPressed("CamEast"))
|
||||
_mRight = true;
|
||||
if (Input.IsActionPressed("CamWest"))
|
||||
_mLeft = true;
|
||||
if (Input.IsActionPressed("CamNorth"))
|
||||
_mUp = true;
|
||||
if (Input.IsActionPressed("CamSouth"))
|
||||
_mDown = true;
|
||||
if (Input.IsActionPressed("CamEast"))
|
||||
_mRight = true;
|
||||
if (Input.IsActionPressed("CamWest"))
|
||||
_mLeft = true;
|
||||
|
||||
this.Rotation -= rot;
|
||||
if (this.Position.Y < 5)
|
||||
zin = false;
|
||||
else if (this.Position.Y > 45)
|
||||
zout = false;
|
||||
if (_mLeft && this.Position.X > -30)
|
||||
this.Translate(new Vector3((float)-delta * 10, 0, 0));
|
||||
if (_mRight && this.Position.X < 30)
|
||||
this.Translate(new Vector3((float)delta * 10, 0, 0));
|
||||
if (_mUp && this.Position.Z > -25)
|
||||
this.Translate(new Vector3(0, 0, (float)-delta * 10));
|
||||
if (_mDown && this.Position.Z < 25)
|
||||
this.Translate(new Vector3(0, 0, (float)delta * 10));
|
||||
this.Rotation += rot;
|
||||
this.Rotation -= rot;
|
||||
if (this.Position.Y < 5)
|
||||
zin = false;
|
||||
else if (this.Position.Y > 45)
|
||||
zout = false;
|
||||
if (_mLeft && this.Position.X > -30)
|
||||
this.Translate(new Vector3((float)-delta * 10, 0, 0));
|
||||
if (_mRight && this.Position.X < 30)
|
||||
this.Translate(new Vector3((float)delta * 10, 0, 0));
|
||||
if (_mUp && this.Position.Z > -25)
|
||||
this.Translate(new Vector3(0, 0, (float)-delta * 10));
|
||||
if (_mDown && this.Position.Z < 25)
|
||||
this.Translate(new Vector3(0, 0, (float)delta * 10));
|
||||
this.Rotation += rot;
|
||||
|
||||
if (_wIn && zin)
|
||||
this.Translate(new Vector3(0, 0, (float)-delta * 10));
|
||||
if (_wOut && zout)
|
||||
this.Translate(new Vector3(0, 0, (float)delta * 10));
|
||||
if (_wIn && zin)
|
||||
this.Translate(new Vector3(0, 0, (float)-delta * 10));
|
||||
if (_wOut && zout)
|
||||
this.Translate(new Vector3(0, 0, (float)delta * 10));
|
||||
|
||||
_con.Set("text", this.Position);
|
||||
_con.Set("text", this.Position);
|
||||
|
||||
|
||||
if (_cursor != null && _cursorPoint != null)
|
||||
{
|
||||
//Get the collision with map and change its X and Z value to always be in the center of a tile
|
||||
Vector3I collisionVector = (Vector3I)_cursor.GetCollisionPoint();
|
||||
_cursorPosLabel.Text = "Virtual Cursor Postion" + collisionVector.ToString();
|
||||
_cursorPoint.GlobalPosition = new Vector3(collisionVector.X - collisionVector.X % 2, 1.1f, collisionVector.Z - collisionVector.Z % 2);
|
||||
if (_cursor != null && _cursorPoint != null)
|
||||
{
|
||||
//Get the collision with map and change its X and Z value to always be in the center of a tile
|
||||
Vector3I collisionVector = (Vector3I)_cursor.GetCollisionPoint();
|
||||
_cursorPosLabel.Text = "Virtual Cursor Postion" + collisionVector.ToString();
|
||||
_cursorPoint.GlobalPosition = new Vector3(collisionVector.X - collisionVector.X % 2, 1.1f, collisionVector.Z - collisionVector.Z % 2);
|
||||
|
||||
if (game_manager.CurrentState == game_manager.State.Building)
|
||||
HandleBuilding();
|
||||
}
|
||||
}
|
||||
if (game_manager.CurrentState == game_manager.State.Building)
|
||||
HandleBuilding();
|
||||
}
|
||||
}
|
||||
|
||||
public override void _Input(InputEvent @event)
|
||||
{
|
||||
_mLeft = _mRight = _mUp = _mDown = _wIn = _wOut = false;
|
||||
public override void _Input(InputEvent @event)
|
||||
{
|
||||
_mLeft = _mRight = _mUp = _mDown = _wIn = _wOut = false;
|
||||
|
||||
if (@event is InputEventMouseMotion mouse)
|
||||
{
|
||||
Vector2 vec = mouse.Position;
|
||||
if (vec.X < 5)
|
||||
_mLeft = true;
|
||||
else if (vec.X > 1915)
|
||||
_mRight = true;
|
||||
if (vec.Y < 20)
|
||||
_mUp = true;
|
||||
else if (vec.Y > 1060)
|
||||
_mDown = true;
|
||||
if (@event is InputEventMouseMotion mouse)
|
||||
{
|
||||
Vector2 vec = mouse.Position;
|
||||
if (vec.X < 5)
|
||||
_mLeft = true;
|
||||
else if (vec.X > 1915)
|
||||
_mRight = true;
|
||||
if (vec.Y < 20)
|
||||
_mUp = true;
|
||||
else if (vec.Y > 1060)
|
||||
_mDown = true;
|
||||
|
||||
|
||||
_mousePosLabel.Text = "Mouse position: " + vec.ToString();
|
||||
_mousePosLabel.Text = "Mouse position: " + vec.ToString();
|
||||
|
||||
_cursor.Position = new Vector3(
|
||||
(vec.X - GetViewport().GetVisibleRect().Size.X / 2) * this.Position.Y / 1000,
|
||||
-((vec.Y - GetViewport().GetVisibleRect().Size.Y / 2) * this.Position.Y / 1000)
|
||||
, 0
|
||||
);
|
||||
}
|
||||
else if (@event is InputEventMouseButton mousebtn)
|
||||
{
|
||||
if (mousebtn.ButtonIndex == MouseButton.WheelUp)
|
||||
_wIn = true;
|
||||
else if (mousebtn.ButtonIndex == MouseButton.WheelDown)
|
||||
_wOut = true;
|
||||
}
|
||||
}
|
||||
private void CheckGame()
|
||||
{
|
||||
bool gameover = false;
|
||||
_cursor.Position = new Vector3(
|
||||
(vec.X - GetViewport().GetVisibleRect().Size.X / 2) * this.Position.Y / 1000,
|
||||
-((vec.Y - GetViewport().GetVisibleRect().Size.Y / 2) * this.Position.Y / 1000)
|
||||
, 0
|
||||
);
|
||||
}
|
||||
else if (@event is InputEventMouseButton mousebtn)
|
||||
{
|
||||
if (mousebtn.ButtonIndex == MouseButton.WheelUp)
|
||||
_wIn = true;
|
||||
else if (mousebtn.ButtonIndex == MouseButton.WheelDown)
|
||||
_wOut = true;
|
||||
}
|
||||
}
|
||||
private void CheckGame()
|
||||
{
|
||||
bool gameover = false;
|
||||
|
||||
if (PR <= 0)
|
||||
gameover = true;
|
||||
else if (Nukes >= 100)
|
||||
{
|
||||
_btnEnd.Disabled = false;
|
||||
_btnEnd.Pressed += () => { _sndBtn.Play(); Nuke(); };
|
||||
}
|
||||
if (PR <= 0)
|
||||
gameover = true;
|
||||
else if (Nukes >= 100)
|
||||
{
|
||||
_btnEnd.Disabled = false;
|
||||
_btnEnd.Pressed += () => { _sndBtn.Play(); Nuke(); };
|
||||
}
|
||||
if (GameTime <= 0)
|
||||
gameover = true;
|
||||
|
||||
if (GameTime <= 0)
|
||||
gameover = true;
|
||||
if (gameover)
|
||||
Chatter = "Game Over.";
|
||||
}
|
||||
|
||||
if (gameover)
|
||||
Chatter = "Game Over.";
|
||||
}
|
||||
public void BuildBuilding(int price, int pr, int nukes, int kashFlow = 0)
|
||||
{
|
||||
if (price > Kash)
|
||||
{
|
||||
Chatter = "Not enough money.";
|
||||
CheckGame();
|
||||
return;
|
||||
}
|
||||
|
||||
public void BuildBuilding(int price, int pr, int nukes, int kashFlow = 0)
|
||||
{
|
||||
if (price > Kash)
|
||||
{
|
||||
Chatter = "Not enough money.";
|
||||
CheckGame();
|
||||
return;
|
||||
}
|
||||
Nukes += nukes;
|
||||
PR += pr;
|
||||
Kash -= price;
|
||||
KashFlow += kashFlow;
|
||||
|
||||
Nukes += nukes;
|
||||
PR += pr;
|
||||
Kash -= price;
|
||||
KashFlow += kashFlow;
|
||||
base_building tempBuilding = (base_building)CurrentBuilding.Duplicate();
|
||||
GetTree().Root.CallDeferred("add_child", tempBuilding);
|
||||
game_manager.CurrentState = game_manager.State.Play;
|
||||
|
||||
base_building tempBuilding = (base_building)CurrentBuilding.Duplicate();
|
||||
GetTree().Root.CallDeferred("add_child", tempBuilding);
|
||||
game_manager.CurrentState = game_manager.State.Play;
|
||||
SetBarLabels();
|
||||
CheckGame();
|
||||
}
|
||||
|
||||
SetBarLabels();
|
||||
CheckGame();
|
||||
}
|
||||
private void MakeMoney()
|
||||
{
|
||||
Kash += KashFlow;
|
||||
GameTime--;
|
||||
_timer.Set("text", GameTime.ToString());
|
||||
|
||||
private void MakeMoney()
|
||||
{
|
||||
Kash += KashFlow;
|
||||
GameTime--;
|
||||
_timer.Set("text", GameTime.ToString());
|
||||
SetBarLabels();
|
||||
CheckGame();
|
||||
}
|
||||
|
||||
SetBarLabels();
|
||||
CheckGame();
|
||||
}
|
||||
|
||||
private void SetBarLabels()
|
||||
{
|
||||
_kash_count.Text = $"{Kash}M$({KashFlow}M$/s)";
|
||||
_nuke_count.Text = $"{Nukes} Megatons";
|
||||
_pr_count.Text = $"{PR}(%) Approval";
|
||||
}
|
||||
private void SetBarLabels()
|
||||
{
|
||||
_kash_count.Text = $"{Kash}M$({KashFlow}M$/s)";
|
||||
_nuke_count.Text = $"{Nukes} Megatons";
|
||||
_pr_count.Text = $"{PR}(%) Approval";
|
||||
}
|
||||
|
||||
|
||||
public void HandleBuilding()
|
||||
{
|
||||
if (CurrentBuilding != null)
|
||||
{
|
||||
CurrentBuilding.GlobalPosition = _cursorPoint.GlobalPosition;
|
||||
public void HandleBuilding()
|
||||
{
|
||||
if (CurrentBuilding != null)
|
||||
{
|
||||
CurrentBuilding.GlobalPosition = _cursorPoint.GlobalPosition;
|
||||
|
||||
if (Input.IsActionJustPressed("rotate"))
|
||||
{
|
||||
CurrentBuilding.RotateY(Mathf.DegToRad(90));
|
||||
}
|
||||
if (Input.IsActionJustPressed("rotate"))
|
||||
{
|
||||
CurrentBuilding.RotateY(Mathf.DegToRad(90));
|
||||
}
|
||||
|
||||
if (Input.IsActionJustPressed("cancel"))
|
||||
{
|
||||
UnHandBuilding();
|
||||
}
|
||||
if (Input.IsActionJustPressed("cancel"))
|
||||
{
|
||||
UnHandBuilding();
|
||||
}
|
||||
|
||||
if (Input.IsActionJustPressed("build"))
|
||||
{
|
||||
if (CurrentBuilding.IsPlaceable)
|
||||
{
|
||||
switch (CurrentBuilding.DisplayName)
|
||||
{
|
||||
case "Radio Tower":
|
||||
propaganda_building radio = (propaganda_building)CurrentBuilding;
|
||||
BuildBuilding(radio.KashCost, radio.Approval, 0);
|
||||
break;
|
||||
case "Nuke Silo":
|
||||
arms_building silo = (arms_building)CurrentBuilding;
|
||||
BuildBuilding(silo.KashCost, silo.Approval, silo.Megaton);
|
||||
break;
|
||||
case "Factory":
|
||||
kash_building factory = (kash_building)CurrentBuilding;
|
||||
BuildBuilding(factory.KashCost, 0, 0, factory.KashGenPerSec);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Input.IsActionJustPressed("build"))
|
||||
{
|
||||
if (CurrentBuilding.IsPlaceable)
|
||||
{
|
||||
switch (CurrentBuilding.DisplayName)
|
||||
{
|
||||
case "Radio Tower":
|
||||
propaganda_building radio = (propaganda_building)CurrentBuilding;
|
||||
BuildBuilding(radio.KashCost, radio.Approval, 0);
|
||||
break;
|
||||
case "Nuke Silo":
|
||||
arms_building silo = (arms_building)CurrentBuilding;
|
||||
BuildBuilding(silo.KashCost, silo.Approval, silo.Megaton);
|
||||
break;
|
||||
case "Factory":
|
||||
kash_building factory = (kash_building)CurrentBuilding;
|
||||
BuildBuilding(factory.KashCost, 0, 0, factory.KashGenPerSec);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Nuke() { }
|
||||
public void Nuke() {
|
||||
|
||||
var scene = GD.Load<PackedScene>("res://endings/mad.tscn");
|
||||
var instance = scene.Instantiate();
|
||||
GetNode<Node>("/root/").AddChild(instance);
|
||||
this.GetParent().QueueFree();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user