Init.cs 796 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System;
  2. using Model;
  3. namespace Hotfix
  4. {
  5. public static class Init
  6. {
  7. private static void Start()
  8. {
  9. try
  10. {
  11. Hotfix.Scene.ModelScene.AddComponent<NetOuterComponent>();
  12. Hotfix.Scene.ModelScene.AddComponent<ResourcesComponent>();
  13. Hotfix.Scene.ModelScene.AddComponent<BehaviorTreeComponent>();
  14. Hotfix.Scene.AddComponent<UIComponent>();
  15. Hotfix.Scene.AddComponent<UnitComponent>();
  16. Hotfix.Scene.GetComponent<EventComponent>().Run(EventIdType.InitSceneStart);
  17. }
  18. catch (Exception e)
  19. {
  20. Log.Error(e.ToString());
  21. }
  22. }
  23. private static void Update()
  24. {
  25. try
  26. {
  27. ObjectEvents.Instance.Update();
  28. }
  29. catch (Exception e)
  30. {
  31. Log.Error(e.ToString());
  32. }
  33. }
  34. private static void OnApplicationQuit()
  35. {
  36. Hotfix.Close();
  37. }
  38. }
  39. }