refactor code to be more decoupled
This commit is contained in:
@@ -137,18 +137,18 @@ func _on_input_validated(validated_player: Dictionary) -> void:
|
||||
|
||||
|
||||
func _object_created(name: String, state: String, position: Vector2, velocity: Vector2) -> void:
|
||||
if monitor_enabled and started:
|
||||
if monitor_enabled:
|
||||
add_object(name, state, position, velocity)
|
||||
|
||||
|
||||
func _object_updated(name: String, state: String, position: Vector2, velocity: Vector2) -> void:
|
||||
if monitor_enabled and started:
|
||||
if monitor_enabled:
|
||||
remove_object(name)
|
||||
add_object(name, state, position, velocity)
|
||||
|
||||
|
||||
func _object_removed(name: String) -> void:
|
||||
if monitor_enabled and started:
|
||||
if monitor_enabled:
|
||||
remove_object(name)
|
||||
|
||||
|
||||
@@ -179,8 +179,8 @@ func add_object(name: String, state: String, position: Vector2, velocity: Vector
|
||||
|
||||
func remove_object(name: String) -> void:
|
||||
for i in range(0, objects.size()):
|
||||
if objects[i]["name"] == name:
|
||||
objects.remove(i)
|
||||
if objects[i]["name"] == name:
|
||||
objects.remove(i)
|
||||
|
||||
|
||||
func _on_coin_update(amount: int) -> void:
|
||||
|
@@ -7,7 +7,6 @@
|
||||
pause_mode = 2
|
||||
script = ExtResource( 1 )
|
||||
monitor_enabled = true
|
||||
use_development_url = true
|
||||
|
||||
[node name="MonitorGUI" parent="." instance=ExtResource( 3 )]
|
||||
visible = false
|
||||
|
Reference in New Issue
Block a user