示例#1
0
        public Node <INode> GetNode(string nodeName)
        {
            switch (nodeName)
            {
            case AddForce.NAME:
                INode nodeAddForce = new AddForce() as INode;
                return(new Node <INode> (nodeAddForce));

            case AddTorque.NAME:
                INode nodeAddTorque = new AddTorque() as INode;
                return(new Node <INode> (nodeAddTorque));

            case RigidBody.NAME:
                INode nodeRigidBody = new RigidBody() as INode;
                return(new Node <INode> (nodeRigidBody));

            case Velocity.NAME:
                INode nodeVelocity = new Velocity() as INode;
                return(new Node <INode> (nodeVelocity));

            case CollisionEnter.NAME:
                INode nodeCollisionEnter = new CollisionEnter() as INode;
                return(new Node <INode> (nodeCollisionEnter));

            case CollisionStay.NAME:
                INode nodeCollisionStay = new CollisionStay() as INode;
                return(new Node <INode> (nodeCollisionStay));

            case CollisionExit.NAME:
                INode nodeCollisionExit = new CollisionExit() as INode;
                return(new Node <INode> (nodeCollisionExit));

            case FixedUpdate.NAME:
                INode nodeFixedUpdate = new FixedUpdate() as INode;
                return(new Node <INode> (nodeFixedUpdate));

            case AddImpulseForce.NAME:
                INode nodeImpulse = new AddImpulseForce() as INode;
                return(new Node <INode> (nodeImpulse));

            case Character.NAME:
                var nodeCharacter = new Character() as INode;
                return(new Node <INode> (nodeCharacter));

            case CharacterForward.NAME:
                var nodeCharacterForward = new CharacterForward() as INode;
                return(new Node <INode> (nodeCharacterForward));

            case CameraRaycast.NAME:
                var nodeCameraRayCast = new CameraRaycast() as INode;
                return(new Node <INode> (nodeCameraRayCast));

            case AddImpulseTorque.NAME:
                var nodeAddImpulseTorque = new AddImpulseTorque() as INode;
                return(new Node <INode>(nodeAddImpulseTorque));

            default:
                return(null);
            }
        }
示例#2
0
        private void Updater()
        {
            _lag            = TimeSpan.Zero;
            _tpsCounterTime = TimeSpan.Zero;
            _stopwatch.Start();
            while (IsActive)
            {
                _current = _stopwatch.Elapsed;
                _elapsed = _current - _last;
                _lag    += _elapsed;

                FixedUpdate?.Invoke(this, new UpdateEventArgs()
                {
                    DeltaTime = _elapsed
                });

                while (_lag >= _updaterFrequency)
                {
                    Update?.Invoke(this, new UpdateEventArgs()
                    {
                        DeltaTime = _elapsed + _lag
                    });
                    _lag -= _updaterFrequency;
                }

                _last = _current;
            }
        }
示例#3
0
        // Triggers when the game makes a fixed update
        internal static void OnGameFixedUpdate()
        {
            if (!isInitialized)
            {
                return;
            }

            FixedUpdate?.Invoke();
        }
示例#4
0
        private void Updater()
        {
            _stopwatch.Start();
            while (CurrentState == TimerState.Active || CurrentState == TimerState.Paused)
            {
                while (CurrentState == TimerState.Paused)
                {
                    if (CurrentState == TimerState.Active || CurrentState == TimerState.Stopped)
                    {
                        break;
                    }
                    PausedUpdate?.Invoke(null, UpdateEventArgs.Empty);
                }

                _current = _stopwatch.Elapsed;
                _elapsed = _current - _last;
                _lag    += _elapsed;

                Update?.Invoke(this, new UpdateEventArgs()
                {
                    DeltaTime = _elapsed
                });
                Debugging.UpdateTime = (float)_elapsed.TotalSeconds;
                ticks++;

                Debugging.LagTime = (float)_lag.TotalSeconds * 1000.0f;

                while (_lag >= _updaterFrequency)
                {
                    FixedUpdate?.Invoke(this, new UpdateEventArgs()
                    {
                        DeltaTime = _elapsed + _lag
                    });
                    Debugging.FixedUpdateTime = ((float)_elapsed.TotalSeconds + (float)_lag.TotalSeconds);
                    fixedTicks++;
                    _lag -= _updaterFrequency;
                }

                _last            = _current;
                _tpsAccumulator += _elapsed;
                if (_tpsAccumulator >= TimeSpan.FromSeconds(1.0f))
                {
                    Debugging.TPS      = ticks;
                    Debugging.FixedTPS = fixedTicks;
                    ticks           = 0;
                    fixedTicks      = 0;
                    _tpsAccumulator = TimeSpan.Zero;
                }
            }
            if (CurrentState == TimerState.Paused || CurrentState == TimerState.Active)
            {
                Debugging.Log(LogEntryType.Warning, "Update timer was stopped unexpectedly!");
            }
        }
 public void Run()
 {
     Console.Clear();
     _tumbler    = new Tumbler();
     FixedUpdate = new FixedUpdate {
         UpdateCallback = Step
     };
     while (!_stopToken.IsCancellationRequested)
     {
         FixedUpdate.Tick();
     }
 }
示例#6
0
        public void Awake()
        {
            World            = new World(new Vector2(0, 0));
            World.AllowSleep = false;
            World.SetContactListener(this);

            Body ground;
            var  bd = new BodyDef();

            ground      = World.CreateBody(bd);
            FixedUpdate = new FixedUpdate(TimeSpan.FromSeconds(0.01d), () => { Step(true); });
            FixedUpdate.Start();
        }
示例#7
0
 private void FixedUpdate()
 {
     if (globals.fixedUpdates < FixedUpdates.Length)
     {
         FixedUpdate f = new FixedUpdate();
         f.time           = Time.time;
         f.deltaTime      = Time.deltaTime;
         f.fixedDeltaTime = Time.fixedDeltaTime;
         f.runDirSway     = Mathf.Sin(Time.time * .5f) * .5f;
         globals.fixedUpdate[globals.fixedUpdates] = f;
         ++globals.fixedUpdates;
     }
 }
示例#8
0
 public void Step(TimeSpan elapsed)
 {
     if (disposed)
     {
         throw new ObjectDisposedException("PhysicsWorld");
     }
     accumulatedTime += elapsed.TotalSeconds;
     while (accumulatedTime > TIMESTEP)
     {
         FixedUpdate?.Invoke(TimeSpan.FromSeconds(TIMESTEP));
         if (disposed)
         {
             return;           //Alllow delete within FixedUpdate. Hacky but works
         }
         btWorld.StepSimulation(TIMESTEP, 1, TIMESTEP);
         accumulatedTime -= TIMESTEP;
     }
     foreach (var obj in dynamicObjects)
     {
         obj.UpdateProperties();
     }
 }
示例#9
0
 public void Step(TimeSpan elapsed)
 {
     if (disposed)
     {
         throw new ObjectDisposedException("PhysicsWorld");
     }
     accumulatedTime += elapsed.TotalSeconds;
     while (accumulatedTime >= TIMESTEP)
     {
         FixedUpdate?.Invoke(TimeSpan.FromSeconds(TIMESTEP));
         if (disposed)
         {
             return;           //Alllow delete within FixedUpdate. Hacky but works
         }
         btWorld.StepSimulation(TIMESTEP, 0, TIMESTEP);
         accumulatedTime -= TIMESTEP;
         //Update C#-side properties after each step. Creates stuttering otherwise
         foreach (var obj in dynamicObjects)
         {
             obj.UpdateProperties();
             obj.RigidBody.Activate(true);
         }
     }
 }
示例#10
0
 internal static void Internal_FixedUpdate()
 {
     Time.SyncData();
     FixedUpdate?.Invoke();
 }
示例#11
0
 public static AwaitInstructionAwaiter <WaitForFrames> WaitFixedUpdate(this MonoBehaviour mono)
 => FixedUpdate.ConfigureAwait(mono);
示例#12
0
        public void Tumbler(bool stressTest = false, bool showProfile = false)
        {
            if (stressTest == false)
            {
                Console.Clear();
            }

            Body ground;

            {
                var bd = new BodyDef();
                ground = World.CreateBody(bd);
            }

            {
                var bd = new BodyDef
                {
                    BodyType   = BodyType.DynamicBody,
                    AllowSleep = false,
                    Position   = new Vector2(0.0f, 10.0f)
                };
                var body = World.CreateBody(bd);

                var shape = new PolygonShape();
                shape.SetAsBox(0.5f, 10.0f, new Vector2(10.0f, 0.0f), 0.0f);
                body.CreateFixture(shape, 5.0f);
                shape.SetAsBox(0.5f, 10.0f, new Vector2(-10.0f, 0.0f), 0.0f);
                body.CreateFixture(shape, 5.0f);
                shape.SetAsBox(10.0f, 0.5f, new Vector2(0.0f, 10.0f), 0.0f);
                body.CreateFixture(shape, 5.0f);
                shape.SetAsBox(10.0f, 0.5f, new Vector2(0.0f, -10.0f), 0.0f);
                body.CreateFixture(shape, 5.0f);

                var jd = new RevoluteJointDef
                {
                    BodyA          = ground,
                    BodyB          = body,
                    LocalAnchorA   = new Vector2(0.0f, 10.0f),
                    LocalAnchorB   = new Vector2(0.0f, 0.0f),
                    ReferenceAngle = 0.0f,
                    MotorSpeed     = 0.05f * Settings.Pi,
                    MaxMotorTorque = 1e8f,
                    EnableMotor    = true
                };
                _joint = (RevoluteJoint)World.CreateJoint(jd);
            }

            _bodyCount = 0;
            if (stressTest)
            {
                var timer = Stopwatch.StartNew();
                for (int i = 0; i < FrameCount; i++)
                {
                    Step(false);
                }

                timer.Stop();
                Console.WriteLine($"{timer.ElapsedMilliseconds} ms");
            }
            else
            {
                FixedUpdate = new FixedUpdate {
                    UpdateCallback = () => Step(showProfile)
                };
                while (true)
                {
                    FixedUpdate.Tick();
                }
            }
        }
示例#13
0
 internal static void Internal_FixedUpdate()
 {
     FixedUpdate?.Invoke();
 }
示例#14
0
        private static void Main(string[] args)
        {
            // 异步方法全部会回掉到主线程
            SynchronizationContext.SetSynchronizationContext(OneThreadSynchronizationContext.Instance);
            try
            {
                BsonHelper.Init();
                //添加Model.dll到字典维护
                Game.EventSystem.Add(DLLType.Model, typeof(Game).Assembly);
                //添加Hotfix.dll到字典维护
                Game.EventSystem.Add(DLLType.Hotfix, DllHelper.GetHotfixAssembly());
                //添加并获取设置组件的引用
                Options options = Game.Scene.AddComponent <OptionComponent, string[]>(args).Options;
                //添加并获取初始配置的组件的引用
                StartConfig startConfig = Game.Scene.AddComponent <StartConfigComponent, string, int>(options.Config, options.AppId).StartConfig;

                //判断配置文件是否正确
                if (!options.AppType.Is(startConfig.AppType))
                {
                    Log.Error("命令行参数apptype与配置不一致");
                    return;
                }

                //配置文件相关
                IdGenerater.AppId = options.AppId;

                LogManager.Configuration.Variables["appType"]       = $"{startConfig.AppType}";
                LogManager.Configuration.Variables["appId"]         = $"{startConfig.AppId}";
                LogManager.Configuration.Variables["appTypeFormat"] = $"{startConfig.AppType,-8}";
                LogManager.Configuration.Variables["appIdFormat"]   = $"{startConfig.AppId:0000}";

                Console.WriteLine($"server start........................ {startConfig.AppId} {startConfig.AppType}");

                //增加计时器组件
                Game.Scene.AddComponent <TimerComponent>();
                //增加OpcodeType组件(是双端通讯协议的重要组成部分)
                Game.Scene.AddComponent <OpcodeTypeComponent>();
                //增加消息分发组件(确保从服务端收到的消息能正确的送到到接受者手中)
                Game.Scene.AddComponent <MessageDispatcherComponent>();

                // 根据不同的AppType添加不同的组件
                OuterConfig  outerConfig  = startConfig.GetComponent <OuterConfig>();
                InnerConfig  innerConfig  = startConfig.GetComponent <InnerConfig>();
                ClientConfig clientConfig = startConfig.GetComponent <ClientConfig>();

                switch (startConfig.AppType)
                {
                case AppType.Manager:
                    Game.Scene.AddComponent <AppManagerComponent>();
                    Game.Scene.AddComponent <NetInnerComponent, string>(innerConfig.Address);
                    Game.Scene.AddComponent <NetOuterComponent, string>(outerConfig.Address);
                    break;

                case AppType.Realm:
                    Game.Scene.AddComponent <MailboxDispatcherComponent>();
                    Game.Scene.AddComponent <ActorMessageDispatcherComponent>();
                    Game.Scene.AddComponent <NetInnerComponent, string>(innerConfig.Address);
                    Game.Scene.AddComponent <NetOuterComponent, string>(outerConfig.Address);
                    Game.Scene.AddComponent <LocationProxyComponent>();
                    Game.Scene.AddComponent <RealmGateAddressComponent>();
                    break;

                case AppType.Gate:
                    Game.Scene.AddComponent <PlayerComponent>();
                    Game.Scene.AddComponent <MailboxDispatcherComponent>();
                    Game.Scene.AddComponent <ActorMessageDispatcherComponent>();
                    Game.Scene.AddComponent <NetInnerComponent, string>(innerConfig.Address);
                    Game.Scene.AddComponent <NetOuterComponent, string>(outerConfig.Address);
                    Game.Scene.AddComponent <LocationProxyComponent>();
                    Game.Scene.AddComponent <ActorMessageSenderComponent>();
                    Game.Scene.AddComponent <ActorLocationSenderComponent>();
                    Game.Scene.AddComponent <GateSessionKeyComponent>();
                    Game.Scene.AddComponent <CoroutineLockComponent>();
                    break;

                case AppType.Location:
                    Game.Scene.AddComponent <NetInnerComponent, string>(innerConfig.Address);
                    Game.Scene.AddComponent <LocationComponent>();
                    Game.Scene.AddComponent <CoroutineLockComponent>();
                    break;

                case AppType.Map:
                    Game.Scene.AddComponent <NetInnerComponent, string>(innerConfig.Address);
                    Game.Scene.AddComponent <UnitComponent>();
                    Game.Scene.AddComponent <LocationProxyComponent>();
                    Game.Scene.AddComponent <ActorMessageSenderComponent>();
                    Game.Scene.AddComponent <ActorLocationSenderComponent>();
                    Game.Scene.AddComponent <MailboxDispatcherComponent>();
                    Game.Scene.AddComponent <ActorMessageDispatcherComponent>();
                    Game.Scene.AddComponent <RecastPathComponent>();
                    Game.Scene.AddComponent <CoroutineLockComponent>();
                    break;

                case AppType.AllServer:
                    // 发送普通actor消息
                    Game.Scene.AddComponent <ActorMessageSenderComponent>();

                    // 发送location actor消息
                    Game.Scene.AddComponent <ActorLocationSenderComponent>();

                    //添加MongoDB组件,处理与服务器的交互
                    Game.Scene.AddComponent <DBComponent>();
                    //添加MongoDB代理组件,代理服务端对数据库的操作
                    Game.Scene.AddComponent <DBProxyComponent>();

                    // location server需要的组件
                    Game.Scene.AddComponent <LocationComponent>();

                    // 访问location server的组件
                    Game.Scene.AddComponent <LocationProxyComponent>();

                    // 这两个组件是处理actor消息使用的
                    Game.Scene.AddComponent <MailboxDispatcherComponent>();
                    Game.Scene.AddComponent <ActorMessageDispatcherComponent>();

                    // 内网消息组件
                    Game.Scene.AddComponent <NetInnerComponent, string>(innerConfig.Address);

                    // 外网消息组件
                    Game.Scene.AddComponent <NetOuterComponent, string>(outerConfig.Address);

                    // manager server组件,用来管理其它进程使用
                    Game.Scene.AddComponent <AppManagerComponent>();
                    Game.Scene.AddComponent <RealmGateAddressComponent>();
                    Game.Scene.AddComponent <GateSessionKeyComponent>();

                    // 配置管理
                    Game.Scene.AddComponent <ConfigComponent>();

                    // recast寻路组件
                    Game.Scene.AddComponent <RecastPathComponent>();

                    //添加玩家组件(使用字典维护,可当做抽象化的玩家,处于不同的游戏流程会有不同的身份)
                    Game.Scene.AddComponent <PlayerComponent>();

                    //添加单位组件(这是游戏中物体的最小单元,继承自Entity)
                    Game.Scene.AddComponent <UnitComponent>();

                    Game.Scene.AddComponent <ConsoleComponent>();

                    //RealmGlobalComponent,增加在线组件,记录在线玩家
                    Game.Scene.AddComponent <OnlineComponent>();

                    //添加碰撞实例管理者 TODO 待优化,一场游戏一个碰撞实例管理者
                    Game.Scene.AddComponent <B2S_WorldColliderManagerComponent>();

                    //添加物理世界 TODO 待优化,一场游戏一个物理世界
                    Game.Scene.AddComponent <B2S_WorldComponent>();

                    //添加碰撞检测监听者 TODO 待优化,一场游戏一个碰撞检测监听者
                    Game.Scene.AddComponent <B2S_CollisionListenerComponent>();

                    //增加碰撞体数据仓库
                    Game.Scene.AddComponent <B2S_ColliderDataRepositoryComponent>();

                    Game.Scene.AddComponent <B2S_CollisionRelationRepositoryComponent>();

                    //增加英雄基础数据仓库组件
                    Game.Scene.AddComponent <HeroBaseDataRepositoryComponent>();
                    Game.Scene.AddComponent <CoroutineLockComponent>();

                    Game.Scene.AddComponent <NP_SyncComponent>();
                    Game.Scene.AddComponent <NP_TreeDataRepository>();
                    //战斗系统中的事件系统组件 TODO 待优化,一场游戏挂载一个战斗系统的事件系统
                    Game.Scene.AddComponent <BattleEventSystem>();
                    //增加Buff池组件
                    Game.Scene.AddComponent <BuffPoolComponent>();
                    break;

                case AppType.Benchmark:
                    Game.Scene.AddComponent <NetOuterComponent>();
                    Game.Scene.AddComponent <BenchmarkComponent, string>(clientConfig.Address);
                    break;

                case AppType.BenchmarkWebsocketServer:
                    Game.Scene.AddComponent <NetOuterComponent, string>(outerConfig.Address);
                    break;

                case AppType.BenchmarkWebsocketClient:
                    Game.Scene.AddComponent <NetOuterComponent>();
                    Game.Scene.AddComponent <WebSocketBenchmarkComponent, string>(clientConfig.Address);
                    break;

                default:
                    throw new Exception($"命令行参数没有设置正确的AppType: {startConfig.AppType}");
                }

                //用于FixedUpdate
                FixedUpdate fixedUpdate = new FixedUpdate()
                {
                    UpdateCallback = () => Game.EventSystem.FixedUpdate()
                };

                while (true)
                {
                    try
                    {
                        Thread.Sleep(1);
                        OneThreadSynchronizationContext.Instance.Update();
                        Game.EventSystem.Update();
                        fixedUpdate.Tick();
                    }
                    catch (Exception e)
                    {
                        Log.Error(e);
                    }
                }
            }
            catch (Exception e)
            {
                Log.Error(e);
            }
        }
示例#15
0
        /// <summary>
        /// Handles all key presses on the window and manages input for the game.
        /// </summary>
        /// <param name="sender">The form that is sending the event.</param>
        /// <param name="e">Arguments about the key down event. Includes which key was pressed.</param>
        private void KeyboardInput(object sender, KeyEventArgs e)
        {
            if (pGameManager != null)
            {
                if (pGameManager.IsGameRunning())
                {
                    if (e.KeyCode == Keys.Left)
                    {
                        pGameManager.GetPlayerManager.Movement("Left");
                    }

                    if (e.KeyCode == Keys.Right)
                    {
                        pGameManager.GetPlayerManager.Movement("Right");
                    }
                }
            }

            if (e.KeyCode == Keys.Up)
            {
                pMenuManager.NavigateTo(pMenuManager.GetCurrentMenu - 1);
                this.Invalidate();
            }

            if (e.KeyCode == Keys.Down)
            {
                pMenuManager.NavigateTo(pMenuManager.GetCurrentMenu + 1);
                this.Invalidate();
            }

            if (e.KeyCode == Keys.Back)
            {
                // Go back
                pMenuManager.NavigateTo(1);
                this.Invalidate();
            }

            if (e.KeyCode == Keys.Enter)
            {
                if (pMenuManager.GetCurrentMenu == 1)
                {
                    pGameManager = new GameManager();

                    FixedUpdate.Start();
                    pGameManager.StartGame();
                }

                if (pMenuManager.GetCurrentMenu == 2)
                {
                    pMenuManager.NavigateTo(6);
                }

                if (pMenuManager.GetCurrentMenu == 3)
                {
                    pMenuManager.NavigateTo(7);
                }

                if (pMenuManager.GetCurrentMenu == 4)
                {
                    pMenuManager.NavigateTo(8);
                }

                this.Invalidate();
            }
        }
示例#16
0
        public static void Run()
        {
            shouldRun = true;

            Stopwatch watch          = new Stopwatch();
            Stopwatch frameTimeWatch = new Stopwatch();

            watch.Start();
            elapsedMs = watch.ElapsedMilliseconds;
            float fixedUpdateTimer = 0;

            while (shouldRun)
            {
                Profiler.StartFrame(FrameNumber);
                frameTimeWatch.Restart();

                long  newTimeMs = watch.ElapsedMilliseconds;
                float deltaTime = (newTimeMs - elapsedMs) / 1000f;
                if (deltaTime > 1)
                {
                    deltaTime = fixedUpdateStep;
                }
                elapsedMs         = newTimeMs;
                fixedUpdateTimer += deltaTime;

                int fixedUpdatesPerformed = 0;
                while (fixedUpdateTimer > fixedUpdateStep)
                {
                    fixedUpdatesPerformed++;
                    FixedUpdate?.Invoke(fixedUpdateStep);
                    fixedUpdateTimer -= fixedUpdateStep;
                    if (frameTimeWatch.ElapsedMilliseconds / 1000f > maxFixedUpdateCatchup)
                    {
                        fixedUpdateTimer = 0;
                        deltaTime        = fixedUpdateStep * fixedUpdatesPerformed;
                        elapsedMs        = watch.ElapsedMilliseconds;
                    }
                }

                Update?.Invoke(deltaTime);

                Render?.Invoke(deltaTime);

                Profiler.EndFrame();
                frameTimeWatch.Stop();

                if (targetFps > 0)
                {
                    float targetFrameTime = 1f / targetFps;
                    float sleepTime       = targetFrameTime - (frameTimeWatch.ElapsedMilliseconds / 1000f);
                    if (sleepTime > 0)
                    {
                        Thread.Sleep((int)(sleepTime * 1000f));
                    }
                }

                FrameNumber++;
            }

            Update      -= World.InvokeUpdate;
            Render      -= World.InvokeRender;
            FixedUpdate -= World.InvokeFixedUpdate;

            //Cleanup
            World.CleanUp();
            if (Window.window.Exists)
            {
                Window.Close();
            }
            GraphicsContext.DisposeResources();             // Needs to be called after everything else has been cleaned up
        }
示例#17
0
 public void OnFixedUpdate(int dTime)
 {
     Asynced = false;
     FixedUpdate?.Invoke(dTime);
 }
示例#18
0
 public static void InvokeFixedUpdate()
 {
     FixedUpdate.SafeInvoke();
 }
示例#19
0
 public void OnFixedUpdate() => FixedUpdate?.Invoke();
示例#20
0
        private async ETVoid StartAsync()
        {
            try
            {
                BsonHelper.Init();
                ForwardRenderBridge.Instance.Init();

                SynchronizationContext.SetSynchronizationContext(OneThreadSynchronizationContext.Instance);
                DontDestroyOnLoad(gameObject);
                DontDestroyOnLoad(MainCamera);
                Game.EventSystem.Add(DLLType.Model, typeof(Init).Assembly);

                Game.Scene.AddComponent <NumericWatcherComponent>();

                fixedUpdate = new FixedUpdate()
                {
                    UpdateCallback = () => Game.EventSystem.FixedUpdate()
                };

                Game.Scene.AddComponent <TimerComponent>();

                Game.Scene.AddComponent <GlobalConfigComponent>();
                Game.Scene.AddComponent <NetOuterComponent>();
                Game.Scene.AddComponent <ResourcesComponent>();
                Game.Scene.AddComponent <PlayerComponent>();

                Game.Scene.AddComponent <CoroutineLockComponent>();
                Game.Scene.AddComponent <UnitComponent>();

                Game.Scene.AddComponent <FUIPackageComponent>();
                Game.Scene.AddComponent <FUIComponent>();
                Game.Scene.AddComponent <FUIInitComponent>();

                //用户输入管理组件
                Game.Scene.AddComponent <UserInputComponent>();
                Game.Scene.AddComponent <CampAllocManagerComponent>();
                Game.Scene.AddComponent <MouseTargetSelectorComponent>();

                Game.Scene.AddComponent <GameObjectPool>();

                // 下载ab包
                await BundleHelper.DownloadBundle();

                Game.Hotfix.LoadHotfixAssembly();

                // 加载配置
                Game.Scene.AddComponent <ConfigComponent>();

                Game.Scene.AddComponent <OpcodeTypeComponent>();
                Game.Scene.AddComponent <MessageDispatcherComponent>();

                Game.Scene.AddComponent <HeroBaseDataRepositoryComponent>();

                Game.Scene.AddComponent <B2S_DebuggerComponent>();

                Game.Hotfix.GotoHotfix();

                Game.Scene.AddComponent <NP_SyncComponent>();
                Game.Scene.AddComponent <NP_TreeDataRepository>();

                Game.Scene.AddComponent <CDComponent>();
                Game.Scene.AddComponent <SoundComponent>();
                Game.Scene.GetComponent <SoundComponent>().PlayMusic("Sound_BGM", 0, 0.4f, true);

                //战斗系统的事件系统组件
                Game.Scene.AddComponent <BattleEventSystem>();
                //UnitFactory.NPBehaveTestCreate();
            }
            catch (Exception e)
            {
                Log.Error(e);
            }
        }
示例#21
0
文件: Wait.Job.cs 项目: Hoodrij/Core
 public static AwaitInstructionAwaiter <WaitForFrames> WaitFixedUpdate(this Job job)
 => FixedUpdate.ConfigureAwait(job.Token);