Spawns a given actor
on a given location
with given optional rotation
and scale
. Returns spawned actor.
Source
T spawnActor<T extends Actor>(T actor, Vector2 location, { Vector2 rotation, Vector2 scale }) { actor.initialize(this); actor.location = location; if (rotation != null) actor.rotation = rotation; if (scale != null) actor.scale = scale; this.actors.add(actor); if (isRunning) actor.beginPlay(); _actorSpawnedEvent.add(actor); return actor; }