2021-06-12 02:28:16 +02:00
|
|
|
extends Node2D
|
|
|
|
|
2021-06-12 14:46:23 +02:00
|
|
|
onready var streets = $Streets
|
2021-06-12 15:03:50 +02:00
|
|
|
onready var guests = $Guests
|
2021-06-12 02:28:16 +02:00
|
|
|
|
2021-06-12 14:46:23 +02:00
|
|
|
var Guest = load("res://Guest.tscn")
|
|
|
|
|
|
|
|
var rng = RandomNumberGenerator.new()
|
2021-06-12 02:28:16 +02:00
|
|
|
|
|
|
|
func _on_Guest_picked_up(destinationColor,name):
|
|
|
|
print('Picked Up %s with name %s' % [destinationColor,name])
|
|
|
|
|
|
|
|
func _ready():
|
2021-06-12 14:46:23 +02:00
|
|
|
rng.randomize()
|
|
|
|
pass
|
|
|
|
|
2021-06-12 02:28:16 +02:00
|
|
|
|
|
|
|
|
2021-06-12 14:46:23 +02:00
|
|
|
func _on_GuestTimer_timeout():
|
|
|
|
var used_cells = streets.get_used_cells()
|
|
|
|
var new_guest_cell = used_cells[rng.randi_range(0, used_cells.size())]
|
|
|
|
var guest_position = streets.map_to_world(new_guest_cell)
|
|
|
|
print('new guest at: %s' % [guest_position])
|
|
|
|
var guest = Guest.instance();
|
|
|
|
guest.position = guest_position;
|
2021-06-12 15:03:50 +02:00
|
|
|
guests.add_child(guest)
|
|
|
|
print('Guest count: %s' % [guests.get_child_count()])
|