Spawner for scenes
This commit is contained in:
29
modules/world/spawner.h
Normal file
29
modules/world/spawner.h
Normal file
@@ -0,0 +1,29 @@
|
||||
#include <scene/main/node.h>
|
||||
#include <scene/resources/packed_scene.h>
|
||||
class Spawner: public Object {
|
||||
GDCLASS(Spawner, Object);
|
||||
protected:
|
||||
Vector3 last_org;
|
||||
bool force_update;
|
||||
HashMap<String, Ref<PackedScene> > scenes;
|
||||
struct spawn_object {
|
||||
Transform xform;
|
||||
bool active;
|
||||
bool relative;
|
||||
int parent_instance;
|
||||
int instance;
|
||||
};
|
||||
HashMap<String, PoolVector<struct spawn_object> > positions;
|
||||
Mutex lock;
|
||||
static void _bind_methods();
|
||||
public:
|
||||
void add_scene(const StringName &name, Ref<PackedScene> scene);
|
||||
void remove_scene(const StringName &name);
|
||||
void place_scene(const StringName &name, const Transform &place);
|
||||
void place_scene_relative(const StringName &name, Node *parent, const Transform &place);
|
||||
void update_view(Node *node, float distance);
|
||||
static void create_singleton();
|
||||
static void destroy_singleton();
|
||||
static Spawner *get_singleton();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user