NestedSpawner.lua 1.1 KB

1234567891011121314151617181920212223242526272829
  1. ----------------------------------------------------------------------------------------------------
  2. --
  3. -- Copyright (c) Contributors to the Open 3D Engine Project.
  4. -- For complete copyright and license terms please see the LICENSE at the root of this distribution.
  5. --
  6. -- SPDX-License-Identifier: Apache-2.0 OR MIT
  7. --
  8. --
  9. --
  10. ----------------------------------------------------------------------------------------------------
  11. local NestedSpawner =
  12. {
  13. Properties =
  14. {
  15. Prefab = { default=SpawnableScriptAssetRef(), description="Prefab to spawn" },
  16. Translation = { default=Vector3(0.0, 0.0, 0.0) },
  17. Rotation = { default=Vector3(0.0, 0.0, 0.0) },
  18. Scale = { default=1.0 }
  19. },
  20. }
  21. function NestedSpawner:OnActivate()
  22. self.spawnableMediator = SpawnableScriptMediator()
  23. self.ticket = self.spawnableMediator:CreateSpawnTicket(self.Properties.Prefab)
  24. self.spawnableMediator:SpawnAndParentAndTransform(self.ticket, self.entityId, self.Properties.Translation, self.Properties.Rotation, self.Properties.Scale )
  25. end
  26. return NestedSpawner