Example #1
0
 public RuntimeEngine()
 {
     GameThread         = null;
     gameObjects        = new List <GameObject>();
     Manage            += gameObject => gameObjects.Add(gameObject);
     Object.GameObjects = gameObjects;
     //进行配置初始化
     OnInitialized += () =>
     {
         Setting.Config config = Setting.Load();
         //初始化渲染系统与摄像机
         GameObject camera = new GameObject("Camera");
         camera.Tag = "MainCamera";
         camera.transform.Position.X = config.CameraPosX;
         camera.transform.Position.Y = config.CameraPosY;
         Camera cam = camera.AddComponent <Camera>();
         cam.CharWidth            = config.CharWidth;
         cam.Height               = config.CameraHeight;
         cam.Width                = config.CameraWidth;
         RendererSystem.DebugMode = config.DebugMode;
         RendererSystem.Init(camera);
         //初始化网络系统
         NetworkSystem.Init(config.UseNet, config.ClientSyncRate, config.ServerBroadcastRate);
     };
 }
Example #2
0
 private void UpdateGameObjects()
 {
     //GameObject在List中的位置将会影响游戏物体在生命周期中的更新顺序
     InvokeSystem.Update();
     CallScriptMethod(gameObjects, "Start", true);   //调用Start
     PhysicsSystem.Update(gameObjects);              //碰撞检测
     CallScriptMethod(gameObjects, "Update");        //调用Update
     NetworkSystem.Update(gameObjects);              //传输消息
     RendererSystem.Update(gameObjects);             //渲染物体
 }