Exemplo n.º 1
0
        public LongRunningAction LoadHexahedronAt(int id, string toLevel)
        {
            Volume  volume = this.LevelManager.Volumes[id];
            Vector3 center = (volume.From + volume.To) / 2f;
            Worker <NowLoadingHexahedron> worker  = this.ThreadPool.Take <NowLoadingHexahedron>(new Action <NowLoadingHexahedron>(VolumeService.LoadHex));
            NowLoadingHexahedron          context = new NowLoadingHexahedron(ServiceHelper.Game, center, toLevel);

            worker.Start(context);
            worker.Finished += (Action)(() => this.ThreadPool.Return <NowLoadingHexahedron>(worker));
            bool disposed = false;

            context.Disposed += (EventHandler <EventArgs>)((_, __) => disposed = true);
            return(new LongRunningAction((Func <float, float, bool>)((_, __) => disposed)));
        }
Exemplo n.º 2
0
 private static void LoadHex(NowLoadingHexahedron nlh)
 {
     ServiceHelper.AddComponent((IGameComponent)nlh);
 }