public GodotDragonBonesFactory(SceneTree sceneTree, DataParser dataParser = null) : base(dataParser) // initialization { if (_factory != null) { return; } _factory = this; if (sceneTree == null) { return; } if (sceneTree.Paused) { InitDragonBonesInstance(null); } // factory node if (_factoryNode == null ) // creating hidden static GodotDragonBonesFactory reference as in-game node, and attach it in root { _factoryNode = new Node { Name = FACTORY_NODE_NAME }; var root = sceneTree.Root.GetChild(0); // todo: hardcode. temporary solution root.AddChild(_factoryNode); } // clock handler var clockHandler = _factoryNode.FindNode(CLOCK_HANDLER_NODE_NAME) as ClockHandler; if (clockHandler == null) { clockHandler = new ClockHandler { Name = CLOCK_HANDLER_NODE_NAME }; _factoryNode.AddChild(clockHandler); } // event dispatcher var godotEventDispatcher = _factoryNode.FindNode(GODOT_EVENT_DISPATCHER_NODE_NAME) as GodotEventDispatcher; if (godotEventDispatcher == null) { godotEventDispatcher = new GodotEventDispatcher { Name = GODOT_EVENT_DISPATCHER_NODE_NAME }; _factoryNode.AddChild(godotEventDispatcher); } InitDragonBonesInstance(godotEventDispatcher); }
public override void _Process(float delta) { GodotDragonBonesFactory.GetFactory()._dragonBones.AdvanceTime(delta); }