Beispiel #1
0
 /// <summary>
 /// 根据UI传过来的用户按键,进行相应操作
 /// </summary>
 /// <param name="Key"></param>
 public void keyDownOperation(string Key)
 {
     //判断按键是否在gizmoSystem中有对应的gizmo操作
     for (int i = 0; i < scene.GizmoOpera.Count; i++)
     {
         if (Key == scene.GizmoOpera[i].operationKey)
         {
             for (Body b = PhysicWorld.MyWorld.GetBodyList(); b != null; b = b.GetNext())
             {
                 if (b.GetUserData() != null)
                 {
                     GizmoComponents tmpGizmo = (GizmoComponents)b.GetUserData();
                     //找到按键对应的box2d物理世界中的body
                     if (scene.GizmoOpera[i].id == tmpGizmo.Id && scene.GizmoOpera[i].operationKey == Key)
                     {
                         PhysicWorld.operateBody(b, Key, scene.GizmoOpera[i].keyType);
                     }
                 }
             }
         }
     }
 }
Beispiel #2
0
 /// <summary>
 /// 初始化box2d物理世界
 /// </summary>
 public void startGame()
 {
     PhysicWorld.initialWorld(scene);
 }
Beispiel #3
0
 /// <summary>
 /// 物理世界根据时间粒度前进一步
 /// </summary>
 public void stepWorld()
 {
     PhysicWorld.stepWorld();
 }
Beispiel #4
0
 public GizmoSystem()
 {
     PhysicWorld = new PhysicWorld();
     scene       = new Scene();
 }