Пример #1
0
        static void Main(string[] args)
        {
            Logger.InitLogger();

            DisplayManager.InitialiseDisplay(1280, 720, "Fish Girlz: Mermaid Adventures");

            InputManager.InitialiseInputManager();

            Assets.Load();

            Tiles.TileLoader.LoadTiles();

            StateMachine.AddState(new States.MainMenuState());

            while (DisplayManager.Window.IsOpen)
            {
                StateMachine.ProcessStateChanges();
                Delta.UpdateDelta();

                DisplayManager.Window.DispatchEvents();

                if (!StateMachine.IsEmpty)
                {
                    StateMachine.ActiveState.StateLogic();
                    StateMachine.ActiveState.Update();
                    StateMachine.ActiveState.HandleInput();

                    LogicSystem.Update();
                }

                DisplayManager.Window.Clear();
                if (!StateMachine.IsEmpty)
                {
                    RenderSystem.Render();
                }
                DisplayManager.Window.Display();
                InputManager.ResetInputManager();
            }

            DisplayManager.DisposeDisplay();
        }
Пример #2
0
 void FixedUpdate()
 {
     if (logicMainSystem == null)
     {
         logicMainSystem = World.Active.GetOrCreateSystem <LogicSystem>();
         var prefab = GameObjectConversionUtility.ConvertGameObjectHierarchy(agentPrefab, World.Active);
         logicMainSystem.prefab = prefab;
     }
     if (Input.GetKey(KeyCode.Space))
     {
         logicMainSystem.logicFrames.Enqueue(new LogicComfirmedFrame {
             opId = OPType.CreateAgent
         });
     }
     else
     {
         logicMainSystem.logicFrames.Enqueue(new LogicComfirmedFrame {
             opId = OPType.Idle
         });
     }
     logicMainSystem.Update();
 }