add separate meshes for different ants and positions for holding items
This commit is contained in:
BIN
assets/models/ant.glb
LFS
BIN
assets/models/ant.glb
LFS
Binary file not shown.
@@ -33,8 +33,13 @@ animation/import_rest_as_RESET=true
|
||||
import_script/path=""
|
||||
_subresources={
|
||||
"materials": {
|
||||
"@MATERIAL:0": {
|
||||
"use_external/path": "res://resources/materials/ant_nitwit_material.tres"
|
||||
"ant_gatherer_mat": {
|
||||
"use_external/enabled": true,
|
||||
"use_external/path": "res://resources/materials/ant_gatherer_mat.tres"
|
||||
},
|
||||
"ant_nitwit_mat": {
|
||||
"use_external/enabled": true,
|
||||
"use_external/path": "res://resources/materials/ant_nitwit_mat.tres"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
[ext_resource type="Texture2D" uid="uid://duf132faskeid" path="res://assets/textures/selection_unit_hover_decal.png" id="2_vinjw"]
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_8lnyq"]
|
||||
radius = 0.213583
|
||||
radius = 0.1
|
||||
|
||||
[node name="Honeydew" type="CharacterBody3D"]
|
||||
collision_layer = 256
|
||||
@@ -13,7 +13,7 @@ collision_mask = 0
|
||||
script = ExtResource("1_6fg3d")
|
||||
|
||||
[node name="Sprite3D" type="Sprite3D" parent="."]
|
||||
pixel_size = 0.0007
|
||||
pixel_size = 0.0009
|
||||
billboard = 1
|
||||
shaded = true
|
||||
alpha_cut = 1
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://bi231xk2sp410" path="res://assets/models/ant.glb" id="1_asokb"]
|
||||
[ext_resource type="Script" path="res://scripts/units/ant_gatherer.gd" id="2_vcqni"]
|
||||
[ext_resource type="Material" uid="uid://b68amtoih28uv" path="res://resources/materials/ant_gatherer_mat.tres" id="3_1br5i"]
|
||||
[ext_resource type="Texture2D" uid="uid://dehqm00kiljut" path="res://assets/textures/selection_unit_decal.png" id="3_5dykx"]
|
||||
[ext_resource type="Texture2D" uid="uid://duf132faskeid" path="res://assets/textures/selection_unit_hover_decal.png" id="4_1jps0"]
|
||||
[ext_resource type="PackedScene" uid="uid://fal1ond30jey" path="res://scenes/units/components/gathering.tscn" id="5_wwnxg"]
|
||||
[ext_resource type="Script" path="res://scripts/units/components/gathering.gd" id="6_dq55a"]
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_foq4x"]
|
||||
animation = &"idle"
|
||||
@@ -36,8 +36,48 @@ collision_layer = 4
|
||||
collision_mask = 0
|
||||
script = ExtResource("2_vcqni")
|
||||
|
||||
[node name="ant" parent="." index="0"]
|
||||
surface_material_override/0 = ExtResource("3_1br5i")
|
||||
[node name="Skeleton3D" parent="Armature" index="0"]
|
||||
bones/4/rotation = Quaternion(0.587858, -5.43255e-07, -3.94772e-07, 0.808964)
|
||||
bones/6/rotation = Quaternion(0.330686, -3.0116e-14, -4.44141e-07, 0.943741)
|
||||
bones/9/rotation = Quaternion(0.587858, 5.43255e-07, 3.94772e-07, 0.808964)
|
||||
bones/11/rotation = Quaternion(0.330686, 3.0116e-14, 4.44141e-07, 0.943741)
|
||||
bones/14/rotation = Quaternion(4.60304e-08, 0.0294697, 0.999566, -5.43234e-07)
|
||||
bones/14/scale = Vector3(1, 1, 1)
|
||||
bones/15/rotation = Quaternion(4.55913e-08, 0.0294697, 0.999566, -4.34329e-07)
|
||||
bones/15/scale = Vector3(1, 1, 1)
|
||||
bones/16/rotation = Quaternion(4.55913e-08, 0.0294697, 0.999566, -4.34329e-07)
|
||||
bones/16/scale = Vector3(1, 1, 1)
|
||||
bones/18/rotation = Quaternion(0.0294712, -6.21995e-15, 4.35675e-07, 0.999566)
|
||||
bones/19/rotation = Quaternion(0.0294712, -5.33139e-15, 4.35675e-07, 0.999566)
|
||||
bones/20/rotation = Quaternion(0.0294712, -6.21995e-15, 4.35675e-07, 0.999566)
|
||||
bones/21/rotation = Quaternion(0.0294712, -6.21995e-15, 4.35675e-07, 0.999566)
|
||||
bones/22/rotation = Quaternion(0.0294712, -6.21995e-15, 4.35675e-07, 0.999566)
|
||||
bones/23/rotation = Quaternion(0.0294712, -5.33139e-15, 4.35675e-07, 0.999566)
|
||||
bones/24/rotation = Quaternion(0.0294712, -6.21995e-15, 4.35675e-07, 0.999566)
|
||||
bones/25/rotation = Quaternion(0.0294712, -5.33139e-15, 4.35675e-07, 0.999566)
|
||||
bones/26/rotation = Quaternion(-0.221628, 0.221633, -0.671475, 0.671477)
|
||||
bones/26/scale = Vector3(1, 1, 1)
|
||||
bones/27/rotation = Quaternion(0.583948, -8.29882e-08, 2.36539e-06, 0.811791)
|
||||
bones/27/scale = Vector3(1, 1, 1)
|
||||
bones/28/rotation = Quaternion(-0.84146, 6.60837e-08, -6.26108e-06, 0.54032)
|
||||
bones/30/rotation = Quaternion(0.583949, -2.24752e-07, 2.46641e-06, 0.811791)
|
||||
bones/31/rotation = Quaternion(-0.84146, 1.69298e-07, -6.42962e-06, 0.54032)
|
||||
bones/32/scale = Vector3(1, 1, 1)
|
||||
bones/34/rotation = Quaternion(-0.841459, 1.31575e-07, -6.3826e-06, 0.540321)
|
||||
bones/34/scale = Vector3(1, 1, 1)
|
||||
bones/35/rotation = Quaternion(-0.221628, -0.221633, 0.671475, 0.671477)
|
||||
bones/35/scale = Vector3(1, 1, 1)
|
||||
bones/36/rotation = Quaternion(0.583948, 8.29882e-08, -2.36539e-06, 0.811791)
|
||||
bones/36/scale = Vector3(1, 1, 1)
|
||||
bones/37/rotation = Quaternion(-0.84146, -6.60837e-08, 6.26108e-06, 0.54032)
|
||||
bones/39/rotation = Quaternion(0.583949, 2.24752e-07, -2.46641e-06, 0.811791)
|
||||
bones/40/rotation = Quaternion(-0.84146, -1.69298e-07, 6.42962e-06, 0.54032)
|
||||
bones/41/scale = Vector3(1, 1, 1)
|
||||
bones/43/rotation = Quaternion(-0.841459, -1.31575e-07, 6.3826e-06, 0.540321)
|
||||
bones/43/scale = Vector3(1, 1, 1)
|
||||
|
||||
[node name="NitwitMesh" parent="Armature/Skeleton3D" index="1"]
|
||||
visible = false
|
||||
|
||||
[node name="AnimationPlayer" parent="." index="1"]
|
||||
deterministic = true
|
||||
@@ -75,7 +115,11 @@ neighbor_distance = 10.0
|
||||
[node name="VisibleOnScreenNotifier3D" type="VisibleOnScreenNotifier3D" parent="." index="7"]
|
||||
aabb = AABB(-0.5, 0, -0.5, 1, 0.5, 1)
|
||||
|
||||
[node name="Gathering" parent="." index="8" instance=ExtResource("5_wwnxg")]
|
||||
[node name="Gathering" type="Area3D" parent="." index="8" instance=ExtResource("5_wwnxg")]
|
||||
collision_layer = 256
|
||||
collision_mask = 256
|
||||
input_ray_pickable = false
|
||||
script = ExtResource("6_dq55a")
|
||||
|
||||
[node name="UiOrigin" type="Marker3D" parent="." index="9"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.58746, 0)
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
[gd_scene load_steps=13 format=3 uid="uid://k11usj2shbtr"]
|
||||
[gd_scene load_steps=12 format=3 uid="uid://k11usj2shbtr"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://bi231xk2sp410" path="res://assets/models/ant.glb" id="1_1u65s"]
|
||||
[ext_resource type="Script" path="res://scripts/units/ant_nitwit.gd" id="2_f1bdv"]
|
||||
[ext_resource type="Material" uid="uid://djj2dnbws3ee5" path="res://resources/materials/ant_nitwit_mat.tres" id="3_hollj"]
|
||||
[ext_resource type="Texture2D" uid="uid://dehqm00kiljut" path="res://assets/textures/selection_unit_decal.png" id="3_hxm2m"]
|
||||
[ext_resource type="Texture2D" uid="uid://duf132faskeid" path="res://assets/textures/selection_unit_hover_decal.png" id="4_vrkmw"]
|
||||
[ext_resource type="PackedScene" uid="uid://fal1ond30jey" path="res://scenes/units/components/gathering.tscn" id="5_j8w6w"]
|
||||
@@ -36,8 +35,46 @@ collision_layer = 4
|
||||
collision_mask = 0
|
||||
script = ExtResource("2_f1bdv")
|
||||
|
||||
[node name="ant" parent="." index="0"]
|
||||
surface_material_override/0 = ExtResource("3_hollj")
|
||||
[node name="Skeleton3D" parent="Armature" index="0"]
|
||||
bones/4/rotation = Quaternion(0.587858, -5.43255e-07, -3.94772e-07, 0.808964)
|
||||
bones/6/rotation = Quaternion(0.330686, -3.0116e-14, -4.44141e-07, 0.943741)
|
||||
bones/9/rotation = Quaternion(0.587858, 5.43255e-07, 3.94772e-07, 0.808964)
|
||||
bones/11/rotation = Quaternion(0.330686, 3.0116e-14, 4.44141e-07, 0.943741)
|
||||
bones/14/rotation = Quaternion(4.60304e-08, 0.0294697, 0.999566, -5.43234e-07)
|
||||
bones/14/scale = Vector3(1, 1, 1)
|
||||
bones/15/rotation = Quaternion(4.55913e-08, 0.0294697, 0.999566, -4.34329e-07)
|
||||
bones/15/scale = Vector3(1, 1, 1)
|
||||
bones/16/rotation = Quaternion(4.55913e-08, 0.0294697, 0.999566, -4.34329e-07)
|
||||
bones/16/scale = Vector3(1, 1, 1)
|
||||
bones/18/rotation = Quaternion(0.0294712, -6.21995e-15, 4.35675e-07, 0.999566)
|
||||
bones/19/rotation = Quaternion(0.0294712, -5.33139e-15, 4.35675e-07, 0.999566)
|
||||
bones/20/rotation = Quaternion(0.0294712, -6.21995e-15, 4.35675e-07, 0.999566)
|
||||
bones/21/rotation = Quaternion(0.0294712, -6.21995e-15, 4.35675e-07, 0.999566)
|
||||
bones/22/rotation = Quaternion(0.0294712, -6.21995e-15, 4.35675e-07, 0.999566)
|
||||
bones/23/rotation = Quaternion(0.0294712, -5.33139e-15, 4.35675e-07, 0.999566)
|
||||
bones/24/rotation = Quaternion(0.0294712, -6.21995e-15, 4.35675e-07, 0.999566)
|
||||
bones/25/rotation = Quaternion(0.0294712, -5.33139e-15, 4.35675e-07, 0.999566)
|
||||
bones/26/rotation = Quaternion(-0.221628, 0.221633, -0.671475, 0.671477)
|
||||
bones/27/rotation = Quaternion(0.583948, -8.29882e-08, 2.36539e-06, 0.811791)
|
||||
bones/27/scale = Vector3(1, 1, 1)
|
||||
bones/28/rotation = Quaternion(-0.84146, 6.60837e-08, -6.26108e-06, 0.54032)
|
||||
bones/30/rotation = Quaternion(0.583949, -2.24752e-07, 2.46641e-06, 0.811791)
|
||||
bones/31/rotation = Quaternion(-0.84146, 1.69298e-07, -6.42962e-06, 0.54032)
|
||||
bones/32/scale = Vector3(1, 1, 1)
|
||||
bones/34/rotation = Quaternion(-0.841459, 1.31575e-07, -6.3826e-06, 0.540321)
|
||||
bones/34/scale = Vector3(1, 1, 1)
|
||||
bones/35/rotation = Quaternion(-0.221628, -0.221633, 0.671475, 0.671477)
|
||||
bones/36/rotation = Quaternion(0.583948, 8.29882e-08, -2.36539e-06, 0.811791)
|
||||
bones/36/scale = Vector3(1, 1, 1)
|
||||
bones/37/rotation = Quaternion(-0.84146, -6.60837e-08, 6.26108e-06, 0.54032)
|
||||
bones/39/rotation = Quaternion(0.583949, 2.24752e-07, -2.46641e-06, 0.811791)
|
||||
bones/40/rotation = Quaternion(-0.84146, -1.69298e-07, 6.42962e-06, 0.54032)
|
||||
bones/41/scale = Vector3(1, 1, 1)
|
||||
bones/43/rotation = Quaternion(-0.841459, -1.31575e-07, 6.3826e-06, 0.540321)
|
||||
bones/43/scale = Vector3(1, 1, 1)
|
||||
|
||||
[node name="GathererMesh" parent="Armature/Skeleton3D" index="0"]
|
||||
visible = false
|
||||
|
||||
[node name="AnimationPlayer" parent="." index="1"]
|
||||
deterministic = true
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
[gd_scene load_steps=15 format=3 uid="uid://ceru75se7ifkb"]
|
||||
[gd_scene load_steps=16 format=3 uid="uid://ceru75se7ifkb"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://brjxxr7h0o0ay" path="res://scenes/static/ground.tscn" id="1_7osoy"]
|
||||
[ext_resource type="Script" path="res://scripts/main_camera.gd" id="1_gnxhh"]
|
||||
[ext_resource type="PackedScene" uid="uid://dx544tb0so0b4" path="res://scenes/items/honeydew.tscn" id="3_hea5m"]
|
||||
[ext_resource type="PackedScene" uid="uid://bk3ers4qaleu2" path="res://scenes/static/bunch_spawner.tscn" id="3_q7xu0"]
|
||||
[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"]
|
||||
@@ -66,6 +67,78 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -58.3389, 0, -63.0179)
|
||||
|
||||
[node name="Items" type="Node" parent="."]
|
||||
|
||||
[node name="Honeydew" parent="Items" instance=ExtResource("3_hea5m")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -54.1609, 0.0949052, -61.5021)
|
||||
|
||||
[node name="Honeydew2" parent="Items" instance=ExtResource("3_hea5m")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -53.6777, 0.094905, -61.1786)
|
||||
|
||||
[node name="Honeydew3" parent="Items" instance=ExtResource("3_hea5m")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -53.1395, 0.094905, -62.1842)
|
||||
|
||||
[node name="Honeydew4" parent="Items" instance=ExtResource("3_hea5m")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -52.8621, 0.094905, -61.3258)
|
||||
|
||||
[node name="Honeydew5" parent="Items" instance=ExtResource("3_hea5m")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -53.4127, 0.094905, -60.3237)
|
||||
|
||||
[node name="Honeydew6" parent="Items" instance=ExtResource("3_hea5m")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -53.9151, 0.094905, -60.5565)
|
||||
|
||||
[node name="Honeydew7" parent="Items" instance=ExtResource("3_hea5m")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -53.2039, 0.0949052, -61.6999)
|
||||
|
||||
[node name="Honeydew8" parent="Items" instance=ExtResource("3_hea5m")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -52.7207, 0.094905, -61.3764)
|
||||
|
||||
[node name="Honeydew9" parent="Items" instance=ExtResource("3_hea5m")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -52.1826, 0.094905, -62.382)
|
||||
|
||||
[node name="Honeydew10" parent="Items" instance=ExtResource("3_hea5m")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -51.9051, 0.094905, -61.5236)
|
||||
|
||||
[node name="Honeydew11" parent="Items" instance=ExtResource("3_hea5m")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -52.4557, 0.094905, -60.5214)
|
||||
|
||||
[node name="Honeydew12" parent="Items" instance=ExtResource("3_hea5m")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -52.9581, 0.094905, -60.7543)
|
||||
|
||||
[node name="Honeydew13" parent="Items" instance=ExtResource("3_hea5m")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -53.5179, 0.0949052, -64.0861)
|
||||
|
||||
[node name="Honeydew14" parent="Items" instance=ExtResource("3_hea5m")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -53.0347, 0.094905, -63.7626)
|
||||
|
||||
[node name="Honeydew15" parent="Items" instance=ExtResource("3_hea5m")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -52.4965, 0.094905, -64.7682)
|
||||
|
||||
[node name="Honeydew16" parent="Items" instance=ExtResource("3_hea5m")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -52.2191, 0.094905, -63.9098)
|
||||
|
||||
[node name="Honeydew17" parent="Items" instance=ExtResource("3_hea5m")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -52.7697, 0.094905, -62.9077)
|
||||
|
||||
[node name="Honeydew18" parent="Items" instance=ExtResource("3_hea5m")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -53.2721, 0.094905, -63.1405)
|
||||
|
||||
[node name="Honeydew19" parent="Items" instance=ExtResource("3_hea5m")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -52.561, 0.0949052, -64.2839)
|
||||
|
||||
[node name="Honeydew20" parent="Items" instance=ExtResource("3_hea5m")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -52.0778, 0.094905, -63.9604)
|
||||
|
||||
[node name="Honeydew21" parent="Items" instance=ExtResource("3_hea5m")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -51.5396, 0.094905, -64.966)
|
||||
|
||||
[node name="Honeydew22" parent="Items" instance=ExtResource("3_hea5m")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -51.2622, 0.094905, -64.1076)
|
||||
|
||||
[node name="Honeydew23" parent="Items" instance=ExtResource("3_hea5m")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -51.8128, 0.094905, -63.1055)
|
||||
|
||||
[node name="Honeydew24" parent="Items" instance=ExtResource("3_hea5m")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -52.3151, 0.094905, -63.3383)
|
||||
|
||||
[node name="Bunches" type="Node" parent="."]
|
||||
|
||||
[node name="AphidsBunch" parent="Bunches" instance=ExtResource("3_q7xu0")]
|
||||
|
||||
@@ -7,9 +7,13 @@ enum AntGathererState {
|
||||
GATHERING,
|
||||
}
|
||||
|
||||
const ITEM_BONE_NAME = "Gatherer_item_"
|
||||
const MAX_CARRY: int = 8
|
||||
|
||||
var state: AntGathererState = AntGathererState.WANDERING
|
||||
|
||||
@onready var gathering: Gathering = $Gathering
|
||||
@onready var skeleton: Skeleton3D = $Armature/Skeleton3D
|
||||
|
||||
|
||||
static func get_cost() -> int:
|
||||
@@ -18,11 +22,15 @@ static func get_cost() -> int:
|
||||
|
||||
func _ready() -> void:
|
||||
assert(gathering != null, "gathering missing!")
|
||||
assert(skeleton != null, "skeleton missing!")
|
||||
super._ready()
|
||||
moving_started.connect(_on_moving_started)
|
||||
moving_ended.connect(_on_moving_ended)
|
||||
nav_agent.navigation_finished.connect(gathering.on_nav_agent_navigation_finished)
|
||||
gathering.initialize(anthill, 8, 0.4, 1)
|
||||
var item_bones: Array[int] = []
|
||||
for i in MAX_CARRY:
|
||||
item_bones.append(skeleton.find_bone(ITEM_BONE_NAME + str(i)))
|
||||
gathering.initialize(anthill, skeleton, item_bones, MAX_CARRY, 0.4, 1)
|
||||
gathering.target_set.connect(_on_gathering_target_set)
|
||||
gathering.stop_gathering.connect(_on_gathering_stop)
|
||||
|
||||
|
||||
@@ -7,9 +7,12 @@ enum AntNitwitState {
|
||||
GATHERING,
|
||||
}
|
||||
|
||||
const ITEM_BONE_NAME = "Nitwit_item_"
|
||||
|
||||
var state: AntNitwitState = AntNitwitState.WANDERING
|
||||
|
||||
@onready var gathering: Gathering = $Gathering
|
||||
@onready var skeleton: Skeleton3D = $Armature/Skeleton3D
|
||||
|
||||
|
||||
static func get_cost() -> int:
|
||||
@@ -18,11 +21,15 @@ static func get_cost() -> int:
|
||||
|
||||
func _ready() -> void:
|
||||
assert(gathering != null, "gathering missing!")
|
||||
assert(skeleton != null, "skeleton missing!")
|
||||
super._ready()
|
||||
moving_started.connect(_on_moving_started)
|
||||
moving_ended.connect(_on_moving_ended)
|
||||
nav_agent.navigation_finished.connect(gathering.on_nav_agent_navigation_finished)
|
||||
gathering.initialize(anthill)
|
||||
var item_bones: Array[int] = []
|
||||
for i in gathering.DEFAULT_MAX_CARRYING:
|
||||
item_bones.append(skeleton.find_bone(ITEM_BONE_NAME + str(i)))
|
||||
gathering.initialize(anthill, skeleton, item_bones)
|
||||
gathering.target_set.connect(_on_gathering_target_set)
|
||||
gathering.stop_gathering.connect(_on_gathering_stop)
|
||||
|
||||
|
||||
@@ -16,15 +16,20 @@ enum GatherState {
|
||||
STOP,
|
||||
}
|
||||
|
||||
var state: GatherState = GatherState.STOP
|
||||
|
||||
var nearby_items: Dictionary = {}
|
||||
var carrying_items: Array[Honeydew] = []
|
||||
var max_carrying: int = DEFAULT_MAX_CARRYING
|
||||
var deposit_leftover: int = 0
|
||||
var state: GatherState = GatherState.STOP
|
||||
|
||||
var target: Honeydew
|
||||
var anthill: Anthill
|
||||
var skeleton: Skeleton3D
|
||||
|
||||
var drop_interval: float = DEFAULT_DROP_INTERVAL
|
||||
var pickup_interval: float = DEFAULT_PICKUP_INTERVAL
|
||||
var item_bones: Array[int] = []
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
@@ -35,7 +40,7 @@ func _ready() -> void:
|
||||
func _process(_delta: float) -> void:
|
||||
for i in range(carrying_items.size()):
|
||||
var item := carrying_items[i]
|
||||
item.global_position = get_nth_pile_pos(i)
|
||||
item.global_position = _get_nth_pile_pos(i)
|
||||
|
||||
if target != null:
|
||||
DebugDraw.circle(target.global_position)
|
||||
@@ -43,6 +48,8 @@ func _process(_delta: float) -> void:
|
||||
|
||||
func initialize(
|
||||
from: Anthill,
|
||||
skeleton_3d: Skeleton3D,
|
||||
bones: Array[int],
|
||||
max_carry: int = DEFAULT_MAX_CARRYING,
|
||||
drop_interv: float = DEFAULT_DROP_INTERVAL,
|
||||
pickup_interv: float = DEFAULT_PICKUP_INTERVAL,
|
||||
@@ -51,6 +58,8 @@ func initialize(
|
||||
max_carrying = max_carry
|
||||
drop_interval = drop_interv
|
||||
pickup_interval = pickup_interv
|
||||
skeleton = skeleton_3d
|
||||
item_bones = bones
|
||||
|
||||
|
||||
func go_gather(item: Honeydew) -> void:
|
||||
@@ -95,12 +104,9 @@ func stop_all_gathering() -> void:
|
||||
state = GatherState.STOP
|
||||
target = null
|
||||
|
||||
func get_nth_pile_pos(n: int) -> Vector3:
|
||||
return (
|
||||
global_position
|
||||
+ (Vector3.UP * 0.45)
|
||||
+ (Vector3.UP * 0.1 * n)
|
||||
)
|
||||
|
||||
func _get_nth_pile_pos(n: int) -> Vector3:
|
||||
return skeleton.to_global(skeleton.get_bone_global_pose(item_bones[n]).origin)
|
||||
|
||||
|
||||
func _pick_up() -> void:
|
||||
@@ -108,7 +114,7 @@ func _pick_up() -> void:
|
||||
carrying_items.append(target)
|
||||
target.set_carried(true)
|
||||
await target.start_moving(
|
||||
get_nth_pile_pos(carrying_items.size() - 1)
|
||||
_get_nth_pile_pos(carrying_items.size() - 1)
|
||||
).moved
|
||||
|
||||
await get_tree().create_timer(pickup_interval).timeout
|
||||
|
||||
Reference in New Issue
Block a user