Guest User

Untitled

a guest
Jul 23rd, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. public class BootupECSJob
  2. {
  3. public static MeshInstanceRenderer cubeLook;
  4. public static Settings settings;
  5.  
  6. [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterSceneLoad)]
  7. public static void Init()
  8. {
  9. EntityManager entityManager = World.Active.GetOrCreateManager<EntityManager>();
  10.  
  11. cubeLook = GetLookFromPrototype("CubePrototype");
  12.  
  13. GameObject go = GameObject.Find("Settings");
  14. settings = go.GetComponent<Settings>();
  15.  
  16. int channelCount = World.Active.GetOrCreateManager<SpectrumSystem>().Init(settings);
  17. World.Active.GetOrCreateManager<SpawnCubeSystem>().Init(settings,
  18. entityManager,
  19. cubeLook);
  20.  
  21. World.Active.GetExistingManager<TransformSystem>().Enabled = false;
  22. }
  23.  
  24. private static MeshInstanceRenderer GetLookFromPrototype(string protoName)
  25. {
  26. GameObject proto = GameObject.Find(protoName);
  27. MeshInstanceRenderer result = proto.GetComponent<MeshInstanceRendererComponent>().Value;
  28. Object.Destroy(proto);
  29. return result;
  30. }
  31. }
  32.  
  33. public struct Cube : IComponentData {}
  34.  
  35. public struct Origin : IComponentData
  36. {
  37. public float3 Value;
  38. }
Add Comment
Please, Sign In to add comment