Game.cs 587 B

1234567891011121314151617181920212223242526
  1. using Godot;
  2. namespace TBL.GodotSharp
  3. {
  4. /// <summary>
  5. /// 游戏核心主节点
  6. /// <para>作为游戏根节点及各个控制对象的持有者</para>
  7. /// </summary>
  8. public abstract partial class Game : Control
  9. {
  10. /// <summary>
  11. /// 全局单例
  12. /// </summary>
  13. public static Game Instance { get; private set; }
  14. public override void _EnterTree()
  15. {
  16. Instance = this;
  17. }
  18. public override void _ExitTree()
  19. {
  20. Instance = null;
  21. }
  22. }
  23. }