Add RulesComponent, GameRulesResource, and BeeDeath state. Update Bee entity with death animation. Include new textures for particles. Add Highlight animation to Beehive.
This commit is contained in:
parent
1da411cacd
commit
d879ca30bd
222 changed files with 3980 additions and 149 deletions
|
|
@ -6,7 +6,11 @@ var spawning_type : String = ""
|
|||
|
||||
var director_drones : Array = [] # List of all director drones in the world
|
||||
|
||||
@onready var rules = get_parent().get_node("RulesComponent")
|
||||
@onready var beehive = get_parent().get_node("Beehive")
|
||||
@onready var flowers = get_parent().get_node("Flowers")
|
||||
@onready var drone_controls = %DroneControls
|
||||
@onready var ui_controls = get_parent().get_node("UiComponent")
|
||||
@onready var spawned_drones_container = get_node("SpawnedDrones")
|
||||
@onready var cursor = preload("res://resources/cursors/launch_drone.png")
|
||||
|
||||
|
|
@ -16,6 +20,17 @@ var director_drones : Array = [] # List of all director drones in the world
|
|||
@onready var distractor_drone = preload("res://entities/DistractorDrone.tscn")
|
||||
@onready var collector_drone = preload("res://entities/CollectorDrone.tscn")
|
||||
|
||||
|
||||
func _ready():
|
||||
if !rules.game_rules.collector_enabled:
|
||||
%SpawnCollector.visible = false
|
||||
if !rules.game_rules.dancer_enabled:
|
||||
%SpawnDancer.visible = false
|
||||
if !rules.game_rules.director_enabled:
|
||||
%SpawnDirector.visible = false
|
||||
if !rules.game_rules.distractor_enabled:
|
||||
%SpawnDistractor.visible = false
|
||||
|
||||
## Function to detect right click event
|
||||
func _input(event) -> void:
|
||||
if spawning_drone:
|
||||
|
|
@ -36,10 +51,14 @@ func spawn_drone(drone_type : String) -> void:
|
|||
# new_drone.visit_order = spawned_drones_container.get_child_count()
|
||||
elif drone_type == "dancer":
|
||||
new_drone = dancer_drone.instantiate()
|
||||
# Hide the dancer button
|
||||
%SpawnDancer.visible = false
|
||||
elif drone_type == "distractor":
|
||||
new_drone = distractor_drone.instantiate()
|
||||
elif drone_type == "collector":
|
||||
new_drone = collector_drone.instantiate()
|
||||
# Hide the collector button
|
||||
%SpawnCollector.visible = false
|
||||
else:
|
||||
Log.pr("Unknown drone type: " + drone_type)
|
||||
|
||||
|
|
@ -52,6 +71,8 @@ func spawn_drone(drone_type : String) -> void:
|
|||
# Update the director drone list
|
||||
update_director_drone_list()
|
||||
|
||||
reset_node_highlights()
|
||||
|
||||
func place_drone(drone_type : String) -> void:
|
||||
if !spawning_drone:
|
||||
Input.set_custom_mouse_cursor(cursor, Input.CURSOR_ARROW, Vector2(32, 32))
|
||||
|
|
@ -66,19 +87,51 @@ func cancel_spawning() -> void:
|
|||
drone_controls.enable_buttons()
|
||||
spawning_drone = false
|
||||
spawning_type = ""
|
||||
reset_node_highlights()
|
||||
|
||||
func _on_spawn_director_pressed() -> void:
|
||||
ui_controls.show_help_text("Help_Drone_Placement_Director")
|
||||
place_drone("director")
|
||||
|
||||
func _on_spawn_collector_pressed() -> void:
|
||||
flowers.show_outline()
|
||||
ui_controls.show_help_text("Help_Drone_Placement_Collector")
|
||||
place_drone("collector")
|
||||
|
||||
func _on_spawn_distractor_pressed() -> void:
|
||||
place_drone("distractor")
|
||||
|
||||
func _on_spawn_dancer_pressed() -> void:
|
||||
beehive.show_outline()
|
||||
ui_controls.show_help_text("Help_Drone_Placement_Dancer")
|
||||
place_drone("dancer")
|
||||
|
||||
func _on_spawn_director_mouse_entered():
|
||||
reset_node_highlights()
|
||||
ui_controls.show_help_text("Help_Drone_Placement_Director")
|
||||
|
||||
func _on_spawn_collector_mouse_entered():
|
||||
reset_node_highlights()
|
||||
flowers.show_outline()
|
||||
ui_controls.show_help_text("Help_Drone_Placement_Collector")
|
||||
|
||||
func _on_spawn_distractor_mouse_entered():
|
||||
reset_node_highlights()
|
||||
ui_controls.show_help_text("Help_Drone_Placement_Distractor")
|
||||
|
||||
func _on_spawn_dancer_mouse_entered():
|
||||
reset_node_highlights()
|
||||
beehive.show_outline()
|
||||
ui_controls.show_help_text("Help_Drone_Placement_Dancer")
|
||||
|
||||
|
||||
## Function to clear highlights when a button is mouse exited, if we arent spawning a drone
|
||||
func _on_button_mouse_exited() -> void:
|
||||
## Update this to trigger something that hides help messages and resets highlights after a second or so
|
||||
#if !spawning_drone:
|
||||
# reset_node_highlights.call_deferred()
|
||||
pass
|
||||
|
||||
func update_director_drone_list():
|
||||
director_drones.clear()
|
||||
for drone in spawned_drones_container.get_children():
|
||||
|
|
@ -111,4 +164,9 @@ func get_collector():
|
|||
for drone in spawned_drones_container.get_children():
|
||||
if drone is CollectorDrone:
|
||||
return drone
|
||||
return null
|
||||
return null
|
||||
|
||||
func reset_node_highlights():
|
||||
ui_controls.hide_help_text()
|
||||
beehive.hide_outline()
|
||||
flowers.hide_outline()
|
||||
Loading…
Add table
Add a link
Reference in a new issue