- skeletons[random.Next<unsigned char>() % skeletons.Size()].Instantiate(e.GetModel());
- e.AngularVelocity(rot);
- Controller *ctrl;
- if (random()) {
- ctrl = new RandomWalk(e, random.Next<std::uint64_t>());
- } else {
- ctrl = new Chaser(world, e, reference);
- }
- controllers.emplace_back(ctrl);
+ RandomModel().Instantiate(e.GetModel());
+ e.SetController(new AIController(world, e));
+ e.Name("spawned");
+ e.Ref();
+ entities.emplace_back(&e);
+}
+
+Model &Spawner::RandomModel() noexcept {
+ std::size_t offset = (world.Random().Next<std::size_t>() % model_length) + model_offset;
+ return models[offset];