This commit is contained in:
MarcEricMartel 2023-06-11 10:45:58 -04:00
parent d83ea3c6fc
commit 4412d5bbd8
2 changed files with 47 additions and 4 deletions

View File

@ -4,7 +4,7 @@ using System;
public partial class player : Camera3D
{
private const string _path = "/root/player/";
//private Camera3D _cam;
[Export]
private Label _con;
[Export]
@ -23,10 +23,27 @@ public partial class player : Camera3D
[Export]
private TextureProgressBar _nuke, _pr, _kash;
[Export]
private Label _chatter;
[Export]
private AudioStreamPlayer _sndChtr, _sndBtn;
[Export]
private Timer _tmrChtr;
private float Nuke { 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 string Chatter { get => _chatter.Get("text").ToString(); set {
if (!(bool)_tmrChtr.Get("is_stopped") && value != "")
_sndChtr.Play();
_chatter.Set("text", value);
_tmrChtr.Start();
}
}
public Node3D CurrentBuilding { get; set; }
public override void _Ready()
@ -40,6 +57,8 @@ public partial class player : Camera3D
GetTree().Root.CallDeferred("add_child", CurrentBuilding);
}
_tmrChtr.Start();
_tmrChtr.Timeout += () => Chatter = "";
}
public override void _Process(double delta)

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=18 format=3 uid="uid://b5gb5paiupum"]
[gd_scene load_steps=19 format=3 uid="uid://b5gb5paiupum"]
[ext_resource type="Script" path="res://player/player.cs" id="1_of2l4"]
@ -63,7 +63,10 @@ height = 255
[sub_resource type="SphereMesh" id="SphereMesh_mtv4x"]
[node name="player" type="Camera3D" node_paths=PackedStringArray("_con", "_mousePosLabel", "_cursorPosLabel", "_cursor", "_cursorPoint", "_nuke", "_pr", "_kash")]
[sub_resource type="LabelSettings" id="LabelSettings_pws5q"]
font_size = 28
[node name="player" type="Camera3D" node_paths=PackedStringArray("_con", "_mousePosLabel", "_cursorPosLabel", "_cursor", "_cursorPoint", "_nuke", "_pr", "_kash", "_chatter", "_sndChtr", "_sndBtn", "_tmrChtr")]
attributes = SubResource("CameraAttributesPhysical_1ejpb")
script = ExtResource("1_of2l4")
_con = NodePath("Debug info/Label")
@ -74,8 +77,13 @@ _cursorPoint = NodePath("cursorPoint")
_nuke = NodePath("NukeBar")
_pr = NodePath("PrBar")
_kash = NodePath("KashBar")
_chatter = NodePath("lbl_Chatter")
_sndChtr = NodePath("snd_Chatter")
_sndBtn = NodePath("snd_Button")
_tmrChtr = NodePath("tmr_Chatter")
[node name="Debug info" type="Control" parent="."]
visible = false
layout_mode = 3
anchors_preset = 0
offset_right = 40.0
@ -186,3 +194,19 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 2)
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0, 0)
mesh = SubResource("SphereMesh_mtv4x")
skeleton = NodePath("../..")
[node name="lbl_Chatter" type="Label" parent="."]
offset_left = 314.0
offset_top = 270.0
offset_right = 756.0
offset_bottom = 513.0
text = "CHATTER"
label_settings = SubResource("LabelSettings_pws5q")
autowrap_mode = 3
[node name="snd_Chatter" type="AudioStreamPlayer" parent="."]
[node name="snd_Button" type="AudioStreamPlayer" parent="."]
[node name="tmr_Chatter" type="Timer" parent="."]
wait_time = 3.0