remove ding from initial spawn
This commit is contained in:
@@ -24,7 +24,7 @@ states/locomotion/node = SubResource("AnimationNodeBlendSpace1D_0mwos")
|
||||
states/locomotion/position = Vector2(334, 100)
|
||||
transitions = ["Start", "locomotion", SubResource("AnimationNodeStateMachineTransition_pwnkm")]
|
||||
|
||||
[sub_resource type="CylinderShape3D" id="CylinderShape3D_wq0od"]
|
||||
[sub_resource type="CylinderShape3D" id="CylinderShape3D_8admi"]
|
||||
height = 0.5
|
||||
|
||||
[node name="ControlledAntUnit" instance=ExtResource("1_66kao")]
|
||||
@@ -65,7 +65,7 @@ anim_player = NodePath("../AntModel/AnimationPlayer")
|
||||
parameters/locomotion/blend_position = 0
|
||||
|
||||
[node name="CollisionShape3D" parent="." index="2"]
|
||||
shape = SubResource("CylinderShape3D_wq0od")
|
||||
shape = SubResource("CylinderShape3D_8admi")
|
||||
|
||||
[node name="HoverIndicator" parent="." index="3"]
|
||||
transform = Transform3D(1.3376, 0, 0, 0, 1.3376, 0, 0, 0, 1.3376, 0, 0, 0)
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://bbph6o74lao46"]
|
||||
[gd_scene load_steps=6 format=3 uid="uid://bbph6o74lao46"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://lbs0vilymbum" path="res://scenes/units/abstract/controlled_ant_unit.tscn" id="1_m5yy7"]
|
||||
[ext_resource type="Script" path="res://scripts/units/ant_gatherer.gd" id="2_7pblm"]
|
||||
[ext_resource type="PackedScene" uid="uid://fal1ond30jey" path="res://scenes/units/components/gathering.tscn" id="3_7b5q8"]
|
||||
[ext_resource type="Script" path="res://scripts/sound_effects_player.gd" id="4_vy34h"]
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_f7l1n"]
|
||||
radius = 15.0
|
||||
@@ -11,8 +12,15 @@ radius = 15.0
|
||||
script = ExtResource("2_7pblm")
|
||||
|
||||
[node name="Skeleton3D" parent="AntModel/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)
|
||||
@@ -22,11 +30,23 @@ 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="AntModel/Armature/Skeleton3D" index="0"]
|
||||
@@ -43,5 +63,8 @@ shape = SubResource("SphereShape3D_f7l1n")
|
||||
[node name="GatheringRadius" parent="Gathering/NearbyItemsSearch" index="0"]
|
||||
transform = Transform3D(30.8235, 0, 0, 0, 30.8235, 0, 0, 0, 30.8235, 0, 0, 0)
|
||||
|
||||
[node name="AudioStreamPlayerPolyphonic" type="AudioStreamPlayer3D" parent="." index="10"]
|
||||
script = ExtResource("4_vy34h")
|
||||
|
||||
[editable path="AntModel"]
|
||||
[editable path="Gathering"]
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://caawcj1cibfdh"]
|
||||
[gd_scene load_steps=6 format=3 uid="uid://caawcj1cibfdh"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://lbs0vilymbum" path="res://scenes/units/abstract/controlled_ant_unit.tscn" id="1_w0xhf"]
|
||||
[ext_resource type="Script" path="res://scripts/units/ant_nitwit.gd" id="2_rfn2k"]
|
||||
[ext_resource type="PackedScene" uid="uid://fal1ond30jey" path="res://scenes/units/components/gathering.tscn" id="4_k3phm"]
|
||||
[ext_resource type="Script" path="res://scripts/sound_effects_player.gd" id="4_pn81r"]
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_dwl4o"]
|
||||
radius = 4.0
|
||||
@@ -10,6 +11,27 @@ radius = 4.0
|
||||
[node name="AntNitwit" instance=ExtResource("1_w0xhf")]
|
||||
script = ExtResource("2_rfn2k")
|
||||
|
||||
[node name="Skeleton3D" parent="AntModel/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/15/rotation = Quaternion(4.55913e-08, 0.0294697, 0.999566, -4.34329e-07)
|
||||
bones/16/rotation = Quaternion(4.55913e-08, 0.0294697, 0.999566, -4.34329e-07)
|
||||
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/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/34/rotation = Quaternion(-0.841459, 1.31575e-07, -6.3826e-06, 0.540321)
|
||||
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/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/43/rotation = Quaternion(-0.841459, -1.31575e-07, 6.3826e-06, 0.540321)
|
||||
|
||||
[node name="NitwitMesh" parent="AntModel/Armature/Skeleton3D" index="1"]
|
||||
visible = true
|
||||
|
||||
@@ -21,5 +43,8 @@ shape = SubResource("SphereShape3D_dwl4o")
|
||||
[node name="GatheringRadius" parent="Gathering/NearbyItemsSearch" index="0"]
|
||||
transform = Transform3D(8.24392, 0, 0, 0, 8.24392, 0, 0, 0, 8.24392, 0, 0, 0)
|
||||
|
||||
[node name="AudioStreamPlayerPolyphonic" type="AudioStreamPlayer3D" parent="." index="10"]
|
||||
script = ExtResource("4_pn81r")
|
||||
|
||||
[editable path="AntModel"]
|
||||
[editable path="Gathering"]
|
||||
|
||||
@@ -25,7 +25,7 @@ func _ready() -> void:
|
||||
assert(audio_player != null, "audio_player missing!")
|
||||
super._ready()
|
||||
honeydew += AntNitwit.get_cost()
|
||||
spawn_nitwit()
|
||||
spawn_nitwit(false)
|
||||
|
||||
|
||||
func space_left() -> int:
|
||||
@@ -44,9 +44,9 @@ func deposit_honeydew(amount: int) -> int:
|
||||
return leftover
|
||||
|
||||
|
||||
func spawn_nitwit() -> void:
|
||||
func spawn_nitwit(ding: bool = true) -> void:
|
||||
print('spawn!')
|
||||
var new_unit := _create_unit(ant_nitwit, AntNitwit.get_cost())
|
||||
var new_unit := _create_unit(ant_nitwit, AntNitwit.get_cost(), ding)
|
||||
if new_unit == null:
|
||||
return
|
||||
print('add!')
|
||||
@@ -64,7 +64,7 @@ func _click() -> void:
|
||||
UiManager.anthill_info.open(self)
|
||||
|
||||
|
||||
func _create_unit(unit_scene: PackedScene, cost: int) -> ControlledUnit:
|
||||
func _create_unit(unit_scene: PackedScene, cost: int, ding: bool = true) -> ControlledUnit:
|
||||
var new_honeydew_amount := honeydew - cost
|
||||
print(new_honeydew_amount)
|
||||
if new_honeydew_amount < 0:
|
||||
@@ -80,5 +80,6 @@ func _create_unit(unit_scene: PackedScene, cost: int) -> ControlledUnit:
|
||||
new_pos
|
||||
)
|
||||
)
|
||||
audio_player.play_sound(SoundManager.ding())
|
||||
if ding:
|
||||
audio_player.play_sound(SoundManager.ding())
|
||||
return new_unit
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
extends AudioStreamPlayer3D
|
||||
class_name SoundEffectsPlayer
|
||||
|
||||
var playback: AudioStreamPlaybackPolyphonic
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
stream = AudioStreamPolyphonic.new()
|
||||
play()
|
||||
playback = get_stream_playback()
|
||||
|
||||
func play_sound(
|
||||
new_stream: AudioStream,
|
||||
from_offset: float = 0,
|
||||
new_volume_db: float = 0,
|
||||
new_pitch_scale: float = 1.0,
|
||||
) -> void:
|
||||
playback.play_stream(
|
||||
new_stream,
|
||||
from_offset,
|
||||
new_volume_db,
|
||||
new_pitch_scale,
|
||||
)
|
||||
Reference in New Issue
Block a user