Refactor: Added explicit typing and void return types
- Introduced explicit typing to variables and functions across multiple scripts for better code clarity. - Specified 'void' as the return type for functions that do not return a value. - Removed redundant code in some scripts.
This commit is contained in:
parent
a62cd6018e
commit
2a9e78b52e
37 changed files with 216 additions and 248 deletions
|
|
@ -1,11 +1,11 @@
|
|||
extends Node2D
|
||||
class_name BeeSpawner
|
||||
|
||||
var bee = preload("res://entities/Bee.tscn")
|
||||
var bee : Resource = preload("res://entities/Bee.tscn")
|
||||
|
||||
@onready var beehive = get_node("../Beehive")
|
||||
@onready var bee_sound = get_node("BigBeeSound")
|
||||
@onready var small_bee_sound = get_node("BeeSound")
|
||||
@onready var beehive : Beehive = get_node("../Beehive")
|
||||
@onready var bee_sound : AudioStreamPlayer = get_node("BigBeeSound")
|
||||
@onready var small_bee_sound : AudioStreamPlayer = get_node("BeeSound")
|
||||
|
||||
var bee_count : int = 0
|
||||
var max_bees : int = 100
|
||||
|
|
@ -13,12 +13,12 @@ var spawn_interval : float = 0.5
|
|||
var spawn_timer : float = 0.0
|
||||
var bee_sound_timer : float = 0.0
|
||||
|
||||
func spawn_bee():
|
||||
var bee_instance = bee.instantiate()
|
||||
func spawn_bee() -> void:
|
||||
var bee_instance : Bee = bee.instantiate()
|
||||
add_child(bee_instance)
|
||||
bee_instance.position = beehive.global_position
|
||||
|
||||
func _process(delta):
|
||||
func _process(delta : float) -> void:
|
||||
spawn_timer += delta
|
||||
|
||||
if spawn_timer > spawn_interval and bee_count < max_bees and beehive.dancer_in_range:
|
||||
|
|
@ -30,7 +30,7 @@ func _process(delta):
|
|||
if bee_count > 0 and small_bee_sound.playing == false:
|
||||
small_bee_sound.play()
|
||||
|
||||
func _physics_process(delta):
|
||||
func _physics_process(delta : float) -> void:
|
||||
bee_sound_timer += delta
|
||||
if bee_sound_timer > 1.0 and bee_count > 0:
|
||||
bee_sound_timer = 0.0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue