46 lines
961 B
C++
46 lines
961 B
C++
#include <modules/world/roads.h>
|
|
class Traffic: public Object {
|
|
GDCLASS(Traffic, Object);
|
|
protected:
|
|
static void _bind_methods();
|
|
Vector<Ref<PackedScene> > scenes;
|
|
int state;
|
|
List<Node *> spawner_list;
|
|
List<Node *>::Element *spawner_e;
|
|
float max_spawn_distance;
|
|
float min_spawn_distance;
|
|
Vector3 delete_distance;
|
|
Ref<RandomNumberGenerator> rnd;
|
|
float list_cooldown, spawn_cooldown;
|
|
RID immediate, instance;
|
|
Ref<SpatialMaterial> debug_mat;
|
|
bool debug;
|
|
|
|
void debug_traffic();
|
|
void control_traffic();
|
|
public:
|
|
Traffic();
|
|
~Traffic();
|
|
void add_traffic_vehicle(Ref<PackedScene> scene);
|
|
void remove_traffic_vehicle(Ref<PackedScene> scene);
|
|
void idle_runner();
|
|
|
|
inline void set_seed(int seed)
|
|
{
|
|
rnd->set_seed(seed);
|
|
}
|
|
inline int get_state()
|
|
{
|
|
return rnd->get_state();
|
|
}
|
|
inline void set_state(int seed)
|
|
{
|
|
rnd->set_state(seed);
|
|
}
|
|
|
|
static Traffic *get_singleton();
|
|
static void create_singleton();
|
|
static void destroy_singleton();
|
|
};
|
|
|