예제 #1
0
        public void GameLoop()
        {
            DateTime curr_time = DateTime.UtcNow;
            DateTime last_time = curr_time;

            running = true;
            while (running)
            {
                curr_time = DateTime.UtcNow;
                TimeSpan deltaTime;
                // caculate time span between current and last time
                if ((deltaTime = curr_time - last_time).TotalMilliseconds > 0)
                {
                    PhysicEngine.Update(deltaTime);
                    GSManager.Update(deltaTime);
                }
                // correct time into fps
                float TargetSecond = 1f / TargetFps;
                if (deltaTime.TotalSeconds < TargetSecond)
                {
                    Thread.Sleep((int)(TargetSecond - deltaTime.TotalSeconds));
                }
                last_time = curr_time;
            }
        }
예제 #2
0
 public void Close()
 {
     if (loopTask != null)
     {
         loopTask.Wait();
     }
     GSManager.Clear();
 }
예제 #3
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
        static void Init()
        {
            Global.FontDefault = Global.FontDefault.Master.GetFont(Font.FontSizes.One);

            UIManager = new UIManager();
            GSManager = new GSManager();
            Player    = new Player();

            UIManager.Init();

            World = new World(true);
            World.WorldMap.GenerateMap();
        }
예제 #5
0
    private void Awake()
    {
        gs    = Object.FindObjectOfType <GSManager>();
        data  = Object.FindObjectOfType <DataManager>();
        board = Object.FindObjectOfType <BoardManager>();
        ui    = Object.FindObjectOfType <UIManager>();

        // Init EM runtime if needed (useful in case only this scene is built).
        if (!RuntimeManager.IsInitialized())
        {
            RuntimeManager.Init();
        }
    }
예제 #6
0
 public void Close()
 {
     GSManager.Clear();
 }