Advertisement
Guest User

Untitled

a guest
Sep 8th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. /*
  2. EcsSetup
  3.  
  4. EcsPlaying
  5. EcsEditing
  6.  
  7. EcsPlayable
  8. EcsEditable
  9. */
  10.  
  11. void setup(world)
  12. {
  13. ECS_SYSTEM(world, gameplay_setup, EcsOnLoad,
  14. " EcsSetup\
  15. , EcsPlayable
  16. ,.setup_playable"
  17. );
  18.  
  19. ECS_SYSTEM(world, gameplay_begin, EcsOnLoad,
  20. " EcsSetup\
  21. , EcsPlaying
  22. ,.backup_playable"
  23. );
  24. ECS_SYSTEM(world, gameplay_end, EcsOnLoad,
  25. " EcsSetup\
  26. ,!EcsPlaying
  27. ,.restore_playable"
  28. );
  29.  
  30. ECS_SYSTEM(world, editing_begin, EcsOnLoad,
  31. " EcsSetup\
  32. , EcsEditing
  33. ,.enable_editable"
  34. );
  35. ECS_SYSTEM(world, editing_end, EcsOnLoad,
  36. " EcsSetup\
  37. ,!EcsEditing
  38. ,.disable_editable"
  39. );
  40.  
  41. }
  42.  
  43. void tick(world, editing)
  44. {
  45. if (editing)
  46. {
  47. ecs_remove(world, ECS_SINGLETON, EcsPlaying);
  48.  
  49. if (ecs_add(world, ECS_SINGLETON, EcsEditing))
  50. {
  51. ecs_add(world, ECS_SINGLETON, EcsSetup);
  52. }
  53. }
  54. else
  55. {
  56. ecs_remove(world, ECS_SINGLETON, EcsEditing);
  57.  
  58. if (ecs_add(world, ECS_SINGLETON, EcsPlaying))
  59. {
  60. ecs_add(world, ECS_SINGLETON, EcsSetup);
  61. }
  62. }
  63.  
  64. ecs_progress(world, 0);
  65.  
  66. ecs_remove(world, ECS_SINGLETON, EcsSetup);
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement