add unit info ui
This commit is contained in:
Binary file not shown.
BIN
assets/textures/gui/think_bubble.png
LFS
Normal file
BIN
assets/textures/gui/think_bubble.png
LFS
Normal file
Binary file not shown.
34
assets/textures/gui/think_bubble.png.import
Normal file
34
assets/textures/gui/think_bubble.png.import
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://cc40vkh4nc6pk"
|
||||||
|
path="res://.godot/imported/think_bubble.png-57fcf04de07e72c3db7be0179d1c2e28.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/textures/gui/think_bubble.png"
|
||||||
|
dest_files=["res://.godot/imported/think_bubble.png-57fcf04de07e72c3db7be0179d1c2e28.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
[gd_scene load_steps=16 format=3 uid="uid://ceru75se7ifkb"]
|
[gd_scene load_steps=17 format=3 uid="uid://ceru75se7ifkb"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://scripts/main_camera.gd" id="1_gnxhh"]
|
[ext_resource type="Script" path="res://scripts/main_camera.gd" id="1_gnxhh"]
|
||||||
[ext_resource type="PackedScene" uid="uid://d4c6ujs1ra1ob" path="res://scenes/units/aphid.tscn" id="3_eh22j"]
|
[ext_resource type="PackedScene" uid="uid://d4c6ujs1ra1ob" path="res://scenes/units/aphid.tscn" id="3_eh22j"]
|
||||||
[ext_resource type="PackedScene" uid="uid://c70rhvk2okkcu" path="res://scenes/ui/buy_ants.tscn" id="4_irvxk"]
|
[ext_resource type="PackedScene" uid="uid://c70rhvk2okkcu" path="res://scenes/ui/buy_ants.tscn" id="4_irvxk"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://dhtofjn8dnuw3" path="res://scenes/ui/unit_info.tscn" id="5_asam3"]
|
||||||
[ext_resource type="PackedScene" uid="uid://davys5ol18oyo" path="res://scenes/ui/pause_menu.tscn" id="5_ljrsn"]
|
[ext_resource type="PackedScene" uid="uid://davys5ol18oyo" path="res://scenes/ui/pause_menu.tscn" id="5_ljrsn"]
|
||||||
[ext_resource type="Script" path="res://scripts/ambient_audio.gd" id="7_413eh"]
|
[ext_resource type="Script" path="res://scripts/ambient_audio.gd" id="7_413eh"]
|
||||||
[ext_resource type="PackedScene" uid="uid://clftjlaotf2g2" path="res://scenes/structures/anthill.tscn" id="7_f30w3"]
|
[ext_resource type="PackedScene" uid="uid://clftjlaotf2g2" path="res://scenes/structures/anthill.tscn" id="7_f30w3"]
|
||||||
@@ -101,6 +102,8 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.79455, 0, 1.78811)
|
|||||||
|
|
||||||
[node name="BuyAnts" parent="UI" instance=ExtResource("4_irvxk")]
|
[node name="BuyAnts" parent="UI" instance=ExtResource("4_irvxk")]
|
||||||
|
|
||||||
|
[node name="UnitInfo" parent="UI" instance=ExtResource("5_asam3")]
|
||||||
|
|
||||||
[node name="PauseMenu" parent="UI" instance=ExtResource("5_ljrsn")]
|
[node name="PauseMenu" parent="UI" instance=ExtResource("5_ljrsn")]
|
||||||
|
|
||||||
[node name="MainCamera" type="Camera3D" parent="."]
|
[node name="MainCamera" type="Camera3D" parent="."]
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=10 format=3 uid="uid://davys5ol18oyo"]
|
[gd_scene load_steps=11 format=3 uid="uid://davys5ol18oyo"]
|
||||||
|
|
||||||
[ext_resource type="StyleBox" uid="uid://do5c5v5kvgv0s" path="res://resources/styles/panel_small_style.tres" id="1_06xpe"]
|
[ext_resource type="StyleBox" uid="uid://do5c5v5kvgv0s" path="res://resources/styles/panel_small_style.tres" id="1_06xpe"]
|
||||||
[ext_resource type="Script" path="res://scripts/ui/pause_menu.gd" id="1_kcif0"]
|
[ext_resource type="Script" path="res://scripts/ui/pause_menu.gd" id="1_kcif0"]
|
||||||
@@ -9,6 +9,10 @@
|
|||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_4k086"]
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_4k086"]
|
||||||
bg_color = Color(0, 0, 0, 0.25098)
|
bg_color = Color(0, 0, 0, 0.25098)
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_k576p"]
|
||||||
|
texture = ExtResource("2_e7opb")
|
||||||
|
modulate_color = Color(0.664997, 0.596536, 0.412061, 1)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_td4xc"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_td4xc"]
|
||||||
atlas = ExtResource("4_dmywd")
|
atlas = ExtResource("4_dmywd")
|
||||||
region = Rect2(376.638, 15.8875, 58.3096, 53.2115)
|
region = Rect2(376.638, 15.8875, 58.3096, 53.2115)
|
||||||
@@ -44,10 +48,11 @@ offset_right = 80.0
|
|||||||
offset_bottom = 55.5
|
offset_bottom = 55.5
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
theme_override_styles/panel = ExtResource("1_06xpe")
|
theme_override_styles/panel = SubResource("StyleBoxTexture_k576p")
|
||||||
|
|
||||||
[node name="QuitButton" type="TextureButton" parent="Panel"]
|
[node name="QuitButton" type="TextureButton" parent="Panel"]
|
||||||
modulate = Color(0.843007, 0.282913, 0.299802, 1)
|
modulate = Color(0.843007, 0.282913, 0.299802, 1)
|
||||||
|
layout_mode = 0
|
||||||
offset_left = 38.0
|
offset_left = 38.0
|
||||||
offset_top = 24.0
|
offset_top = 24.0
|
||||||
offset_right = 117.0
|
offset_right = 117.0
|
||||||
@@ -75,6 +80,7 @@ texture = SubResource("AtlasTexture_td4xc")
|
|||||||
|
|
||||||
[node name="CancelButton" type="TextureButton" parent="Panel"]
|
[node name="CancelButton" type="TextureButton" parent="Panel"]
|
||||||
modulate = Color(0.81, 0.748035, 0.5913, 1)
|
modulate = Color(0.81, 0.748035, 0.5913, 1)
|
||||||
|
layout_mode = 0
|
||||||
offset_left = 117.0
|
offset_left = 117.0
|
||||||
offset_top = -25.0
|
offset_top = -25.0
|
||||||
offset_right = 182.0
|
offset_right = 182.0
|
||||||
|
|||||||
151
scenes/ui/unit_info.tscn
Normal file
151
scenes/ui/unit_info.tscn
Normal file
@@ -0,0 +1,151 @@
|
|||||||
|
[gd_scene load_steps=12 format=3 uid="uid://dhtofjn8dnuw3"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://cc40vkh4nc6pk" path="res://assets/textures/gui/think_bubble.png" id="1_hsifm"]
|
||||||
|
[ext_resource type="Script" path="res://scripts/ui/unit_info.gd" id="2_b6c6l"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://slraulfmk8c0" path="res://assets/textures/gui/pictograms.png" id="6_vrqjx"]
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_wrdqv"]
|
||||||
|
texture = ExtResource("1_hsifm")
|
||||||
|
modulate_color = Color(0.664997, 0.596536, 0.412061, 1)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_7modd"]
|
||||||
|
atlas = ExtResource("6_vrqjx")
|
||||||
|
region = Rect2(404.555, 93.7849, 67.5499, 53.8488)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_2jq3t"]
|
||||||
|
atlas = ExtResource("6_vrqjx")
|
||||||
|
region = Rect2(476.79, 88.6228, 77.4275, 53.8488)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_beuyo"]
|
||||||
|
atlas = ExtResource("6_vrqjx")
|
||||||
|
region = Rect2(572.197, 83.8424, 60.0876, 64.636)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_o8jta"]
|
||||||
|
atlas = ExtResource("6_vrqjx")
|
||||||
|
region = Rect2(654.844, 86.7453, 91.2445, 50.4017)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_ndwb1"]
|
||||||
|
atlas = ExtResource("6_vrqjx")
|
||||||
|
region = Rect2(405.682, 154.985, 69.6633, 48.5967)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_fh2cu"]
|
||||||
|
atlas = ExtResource("6_vrqjx")
|
||||||
|
region = Rect2(493.617, 151.821, 88.0582, 58.802)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_q6lpn"]
|
||||||
|
atlas = ExtResource("6_vrqjx")
|
||||||
|
region = Rect2(605.33, 162.323, 47.3997, 44.5031)
|
||||||
|
|
||||||
|
[node name="UnitInfo" type="Panel"]
|
||||||
|
offset_right = 128.0
|
||||||
|
offset_bottom = 128.0
|
||||||
|
pivot_offset = Vector2(63, 130)
|
||||||
|
size_flags_horizontal = 4
|
||||||
|
size_flags_vertical = 8
|
||||||
|
theme_override_styles/panel = SubResource("StyleBoxTexture_wrdqv")
|
||||||
|
script = ExtResource("2_b6c6l")
|
||||||
|
|
||||||
|
[node name="AntIdle" type="TextureRect" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 8
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = -26.0
|
||||||
|
offset_top = -40.0
|
||||||
|
offset_right = 41.0
|
||||||
|
offset_bottom = 13.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
texture = SubResource("AtlasTexture_7modd")
|
||||||
|
|
||||||
|
[node name="AntMoving" type="TextureRect" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 8
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = -39.0
|
||||||
|
offset_top = -41.0
|
||||||
|
offset_right = 38.0
|
||||||
|
offset_bottom = 12.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
texture = SubResource("AtlasTexture_2jq3t")
|
||||||
|
|
||||||
|
[node name="AntPickingUp" type="TextureRect" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 8
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = -29.0
|
||||||
|
offset_top = -48.0
|
||||||
|
offset_right = 31.0
|
||||||
|
offset_bottom = 16.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
texture = SubResource("AtlasTexture_beuyo")
|
||||||
|
|
||||||
|
[node name="AntDepositing" type="TextureRect" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 8
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = -45.0
|
||||||
|
offset_top = -38.0
|
||||||
|
offset_right = 46.0
|
||||||
|
offset_bottom = 12.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
texture = SubResource("AtlasTexture_o8jta")
|
||||||
|
|
||||||
|
[node name="AphidIdle" type="TextureRect" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 8
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = -32.0
|
||||||
|
offset_top = -37.0
|
||||||
|
offset_right = 37.0
|
||||||
|
offset_bottom = 11.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
texture = SubResource("AtlasTexture_ndwb1")
|
||||||
|
|
||||||
|
[node name="AphidPanic" type="TextureRect" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 8
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = -43.0
|
||||||
|
offset_top = -41.0
|
||||||
|
offset_right = 45.0
|
||||||
|
offset_bottom = 17.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
texture = SubResource("AtlasTexture_fh2cu")
|
||||||
|
|
||||||
|
[node name="AphidEat" type="TextureRect" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 8
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = -19.0
|
||||||
|
offset_top = -24.0
|
||||||
|
offset_right = 28.0
|
||||||
|
offset_bottom = 20.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
texture = SubResource("AtlasTexture_q6lpn")
|
||||||
@@ -77,3 +77,6 @@ neighbor_distance = 10.0
|
|||||||
aabb = AABB(-0.5, 0, -0.5, 1, 0.5, 1)
|
aabb = AABB(-0.5, 0, -0.5, 1, 0.5, 1)
|
||||||
|
|
||||||
[node name="Gathering" parent="." index="8" instance=ExtResource("5_wwnxg")]
|
[node name="Gathering" parent="." index="8" instance=ExtResource("5_wwnxg")]
|
||||||
|
|
||||||
|
[node name="UiOrigin" type="Marker3D" parent="." index="9"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.58746, 0)
|
||||||
|
|||||||
@@ -77,3 +77,6 @@ neighbor_distance = 10.0
|
|||||||
aabb = AABB(-0.5, 0, -0.5, 1, 0.5, 1)
|
aabb = AABB(-0.5, 0, -0.5, 1, 0.5, 1)
|
||||||
|
|
||||||
[node name="Gathering" parent="." index="8" instance=ExtResource("5_j8w6w")]
|
[node name="Gathering" parent="." index="8" instance=ExtResource("5_j8w6w")]
|
||||||
|
|
||||||
|
[node name="UiOrigin" type="Marker3D" parent="." index="9"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.58746, 0)
|
||||||
|
|||||||
@@ -68,3 +68,6 @@ neighbor_distance = 10.0
|
|||||||
|
|
||||||
[node name="VisibleOnScreenNotifier3D" type="VisibleOnScreenNotifier3D" parent="." index="6"]
|
[node name="VisibleOnScreenNotifier3D" type="VisibleOnScreenNotifier3D" parent="." index="6"]
|
||||||
aabb = AABB(-0.5, 0, -0.5, 1, 0.5, 1)
|
aabb = AABB(-0.5, 0, -0.5, 1, 0.5, 1)
|
||||||
|
|
||||||
|
[node name="UiOrigin" type="Marker3D" parent="." index="7"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.58746, 0)
|
||||||
|
|||||||
@@ -68,3 +68,6 @@ neighbor_distance = 10.0
|
|||||||
|
|
||||||
[node name="VisibleOnScreenNotifier3D" type="VisibleOnScreenNotifier3D" parent="." index="7"]
|
[node name="VisibleOnScreenNotifier3D" type="VisibleOnScreenNotifier3D" parent="." index="7"]
|
||||||
aabb = AABB(-0.5, 0, -0.5, 1, 0.5, 1)
|
aabb = AABB(-0.5, 0, -0.5, 1, 0.5, 1)
|
||||||
|
|
||||||
|
[node name="UiOrigin" type="Marker3D" parent="." index="8"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.58746, 0)
|
||||||
|
|||||||
@@ -2,8 +2,10 @@ extends Node
|
|||||||
|
|
||||||
@onready var anthill_info: AnthillInfo = $/root/World/UI/AnthillInfo
|
@onready var anthill_info: AnthillInfo = $/root/World/UI/AnthillInfo
|
||||||
@onready var buy_ants: BuyAnts = $/root/World/UI/BuyAnts
|
@onready var buy_ants: BuyAnts = $/root/World/UI/BuyAnts
|
||||||
|
@onready var unit_info: UnitInfo = $/root/World/UI/UnitInfo
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
assert(anthill_info != null, "anthill_info missing!")
|
assert(anthill_info != null, "anthill_info missing!")
|
||||||
assert(buy_ants != null, "buy_ants missing!")
|
assert(buy_ants != null, "buy_ants missing!")
|
||||||
|
assert(unit_info != null, "unit_info missing!")
|
||||||
|
|||||||
@@ -16,10 +16,7 @@ func _input(event: InputEvent) -> void:
|
|||||||
var button_event := event as InputEventMouseButton
|
var button_event := event as InputEventMouseButton
|
||||||
if not button_event.pressed:
|
if not button_event.pressed:
|
||||||
return
|
return
|
||||||
if (
|
if button_event.button_index == MOUSE_BUTTON_LEFT:
|
||||||
button_event.button_index == MOUSE_BUTTON_RIGHT
|
|
||||||
or button_event.button_index == MOUSE_BUTTON_LEFT
|
|
||||||
):
|
|
||||||
close()
|
close()
|
||||||
|
|
||||||
if event is InputEventMouseMotion:
|
if event is InputEventMouseMotion:
|
||||||
|
|||||||
107
scripts/ui/unit_info.gd
Normal file
107
scripts/ui/unit_info.gd
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
extends FollowingUI
|
||||||
|
class_name UnitInfo
|
||||||
|
|
||||||
|
enum InfoState {
|
||||||
|
NONE,
|
||||||
|
ANT_IDLE,
|
||||||
|
ANT_MOVING,
|
||||||
|
ANT_PICKING_UP,
|
||||||
|
ANT_DEPOSITING,
|
||||||
|
APHID_IDLE,
|
||||||
|
APHID_PANIC,
|
||||||
|
APHID_EAT,
|
||||||
|
}
|
||||||
|
|
||||||
|
var unit: Unit
|
||||||
|
var state: InfoState = InfoState.NONE
|
||||||
|
|
||||||
|
@onready var ant_idle: Control = $AntIdle
|
||||||
|
@onready var ant_moving: Control = $AntMoving
|
||||||
|
@onready var ant_picking_up: Control = $AntPickingUp
|
||||||
|
@onready var ant_depositing: Control = $AntDepositing
|
||||||
|
@onready var aphid_idle: Control = $AphidIdle
|
||||||
|
@onready var aphid_panic: Control = $AphidPanic
|
||||||
|
@onready var aphid_eat: Control = $AphidEat
|
||||||
|
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
assert(ant_idle != null, "ant_idle missing!")
|
||||||
|
assert(ant_moving != null, "ant_moving missing!")
|
||||||
|
assert(ant_picking_up != null, "ant_picking_up missing!")
|
||||||
|
assert(ant_depositing != null, "ant_depositing missing!")
|
||||||
|
assert(aphid_idle != null, "aphid_idle missing!")
|
||||||
|
assert(aphid_panic != null, "aphid_panic missing!")
|
||||||
|
assert(aphid_eat != null, "aphid_eat missing!")
|
||||||
|
super._ready()
|
||||||
|
|
||||||
|
func _process(delta: float) -> void:
|
||||||
|
super._process(delta)
|
||||||
|
if unit == null or not visible:
|
||||||
|
return
|
||||||
|
|
||||||
|
_get_state()
|
||||||
|
_set_image()
|
||||||
|
|
||||||
|
|
||||||
|
func open(who: Unit) -> void:
|
||||||
|
visible = true
|
||||||
|
unit = who
|
||||||
|
set_target(unit.ui_origin)
|
||||||
|
|
||||||
|
|
||||||
|
func _set_image()->void:
|
||||||
|
for child:Control in get_children():
|
||||||
|
child.visible = false
|
||||||
|
|
||||||
|
match state:
|
||||||
|
InfoState.ANT_IDLE:
|
||||||
|
ant_idle.visible = true
|
||||||
|
InfoState.ANT_MOVING:
|
||||||
|
ant_moving.visible = true
|
||||||
|
InfoState.ANT_PICKING_UP:
|
||||||
|
ant_picking_up.visible = true
|
||||||
|
InfoState.ANT_DEPOSITING:
|
||||||
|
ant_depositing.visible = true
|
||||||
|
InfoState.APHID_IDLE:
|
||||||
|
aphid_idle.visible = true
|
||||||
|
InfoState.APHID_PANIC:
|
||||||
|
aphid_panic.visible = true
|
||||||
|
InfoState.APHID_EAT:
|
||||||
|
aphid_eat.visible = true
|
||||||
|
|
||||||
|
|
||||||
|
func _get_state() -> void:
|
||||||
|
if unit is Aphid:
|
||||||
|
match (unit as Aphid).state:
|
||||||
|
Aphid.AphidState.WANDERING:
|
||||||
|
state = InfoState.APHID_IDLE
|
||||||
|
|
||||||
|
if unit is AntNitwit:
|
||||||
|
match (unit as AntNitwit).state:
|
||||||
|
AntNitwit.AntNitwitState.WANDERING:
|
||||||
|
state = InfoState.ANT_IDLE
|
||||||
|
AntNitwit.AntNitwitState.MOVING:
|
||||||
|
state = InfoState.ANT_MOVING
|
||||||
|
AntNitwit.AntNitwitState.GATHERING:
|
||||||
|
match (unit as AntNitwit).gathering.state:
|
||||||
|
Gathering.GatherState.PICKING_UP:
|
||||||
|
state = InfoState.ANT_PICKING_UP
|
||||||
|
Gathering.GatherState.DEPOSITING:
|
||||||
|
state = InfoState.ANT_DEPOSITING
|
||||||
|
Gathering.GatherState.STOP:
|
||||||
|
state = InfoState.NONE
|
||||||
|
|
||||||
|
if unit is AntGatherer:
|
||||||
|
match (unit as AntGatherer).state:
|
||||||
|
AntGatherer.AntGathererState.WANDERING:
|
||||||
|
state = InfoState.ANT_IDLE
|
||||||
|
AntGatherer.AntGathererState.MOVING:
|
||||||
|
state = InfoState.ANT_MOVING
|
||||||
|
AntGatherer.AntGathererState.GATHERING:
|
||||||
|
match (unit as AntGatherer).gathering.state:
|
||||||
|
Gathering.GatherState.PICKING_UP:
|
||||||
|
state = InfoState.ANT_PICKING_UP
|
||||||
|
Gathering.GatherState.DEPOSITING:
|
||||||
|
state = InfoState.ANT_DEPOSITING
|
||||||
|
Gathering.GatherState.STOP:
|
||||||
|
state = InfoState.NONE
|
||||||
@@ -13,6 +13,7 @@ var wandering_timer: float = 0
|
|||||||
var wandering_center: Vector3 = Vector3.ZERO
|
var wandering_center: Vector3 = Vector3.ZERO
|
||||||
|
|
||||||
@onready var nav_agent: NavigationAgent3D = $NavigationAgent3D
|
@onready var nav_agent: NavigationAgent3D = $NavigationAgent3D
|
||||||
|
@onready var ui_origin: Node3D = $UiOrigin
|
||||||
@onready var animation_tree: AnimationTree = $AnimationTree
|
@onready var animation_tree: AnimationTree = $AnimationTree
|
||||||
@onready var visibility_notifier: VisibleOnScreenNotifier3D = (
|
@onready var visibility_notifier: VisibleOnScreenNotifier3D = (
|
||||||
$VisibleOnScreenNotifier3D
|
$VisibleOnScreenNotifier3D
|
||||||
@@ -23,6 +24,7 @@ func _ready() -> void:
|
|||||||
assert(nav_agent != null, "nav_agent missing!")
|
assert(nav_agent != null, "nav_agent missing!")
|
||||||
assert(animation_tree != null, "animation_tree missing!")
|
assert(animation_tree != null, "animation_tree missing!")
|
||||||
assert(visibility_notifier != null, "visibility_notifier missing!")
|
assert(visibility_notifier != null, "visibility_notifier missing!")
|
||||||
|
assert(ui_origin != null, "ui_origin missing!")
|
||||||
super._ready()
|
super._ready()
|
||||||
|
|
||||||
wandering_center = global_position
|
wandering_center = global_position
|
||||||
@@ -46,6 +48,10 @@ func _physics_process(_delta: float) -> void:
|
|||||||
_navigate()
|
_navigate()
|
||||||
|
|
||||||
|
|
||||||
|
func _click() ->void:
|
||||||
|
UiManager.unit_info.open(self)
|
||||||
|
|
||||||
|
|
||||||
func _navigate() -> void:
|
func _navigate() -> void:
|
||||||
if nav_agent.is_navigation_finished():
|
if nav_agent.is_navigation_finished():
|
||||||
velocity = Vector3.ZERO
|
velocity = Vector3.ZERO
|
||||||
|
|||||||
Reference in New Issue
Block a user