public void Init() { _hasInited = false; EventGroup = new EventGroup(); MapConfig = Logic.Map.Map.Deserialize(Name); FixedQuadTree = new FixedQuadTree <SceneObject>(); FixedQuadTree.SetBounds(new Utility.FixedRect(-FixedMath.One * MapConfig.Width / 2, -FixedMath.One * MapConfig.Height / 2, FixedMath.One * MapConfig.Width, FixedMath.One * MapConfig.Height)); PhysicsTree = new DynamicTree <FixtureProxy>(); for (int i = 0; i < MapConfig.Data.Data.Count; i++) { var stageData = MapConfig.Data.Data[i]; var aabb = new AABB(new Vector2d(stageData.X * FixedMath.One + FixedMath.Half, stageData.Y * FixedMath.One + FixedMath.Half), FixedMath.One, FixedMath.One); var fp = new FixtureProxy(); fp.AABB = aabb; fp.Fixture = new Transform2d() { p = aabb.Center, angle = 0 }; var nodeid = PhysicsTree.AddProxy(ref aabb, fp); } EventGroup.ListenEvent(SceneEvent.OnLoaded.ToInt(), OnLoded); }
public void ListenEvent(int id, EventMsgHandler e) { EventGroup.ListenEvent(id, e); }