void RegistrationEvents() { updateSystems .OneFrame <CreateNewEnemyEvent>() .OneFrame <DestroyComponentEvent>() .OneFrame <DamageComponentEvent>() .OneFrame <ShootingEvent>() .OneFrame <ChangeHPEvent>(); fixedSystems .OneFrame <InputMoveDirectionEvent>(); }
private static void InjectOneFrameComponents(EcsSystems ecsSystems) { ecsSystems.OneFrame <CollisionEnterEvent>(); ecsSystems.OneFrame <CollisionStayEvent>(); ecsSystems.OneFrame <CollisionExitEvent>(); ecsSystems.OneFrame <TriggerEnterEvent>(); ecsSystems.OneFrame <TriggerStayEvent>(); ecsSystems.OneFrame <TriggerExitEvent>(); }
IEnumerator Start() { yield return(null); yield return(null); yield return(null); _world = new EcsWorld(); _systems = new EcsSystems(_world, "room"); #if UNITY_EDITOR Leopotam.Ecs.UnityIntegration.EcsWorldObserver.Create(_world); Leopotam.Ecs.UnityIntegration.EcsSystemsObserver.Create(_systems); #endif _systems .Add(new RoomSystem()) .Add(new RoomEventCourierSystem()) .Add(new MovementSystem()) .Add(new ResurrectionSystem()) .Add(new JoystickInputSystem()) .Add(new PushSystem()) .Add(new CameraSystem()) .Add(new RoomEventReceiverSystem()); // Events _systems .OneFrame <PushEvent>() .OneFrame <StayEvent>(); _systems .Inject(_definition) .Inject(Game.JoystickBehaviour) .Inject(Game.CameraBehaviour) .Inject(Game.TeeBehaviour) .Inject(Game.HoleBehaviour) .Inject(new RoomService()) .ProcessInjects() .Init(); Game.room = new Room(_world); }
static void InjectOneFrames(EcsSystems ecsSystems) { ecsSystems.OneFrame <EcsUiBeginDragEvent> (); ecsSystems.OneFrame <EcsUiDragEvent> (); ecsSystems.OneFrame <EcsUiEndDragEvent> (); ecsSystems.OneFrame <EcsUiDropEvent> (); ecsSystems.OneFrame <EcsUiClickEvent> (); ecsSystems.OneFrame <EcsUiDownEvent> (); ecsSystems.OneFrame <EcsUiUpEvent> (); ecsSystems.OneFrame <EcsUiEnterEvent> (); ecsSystems.OneFrame <EcsUiExitEvent> (); ecsSystems.OneFrame <EcsUiScrollViewEvent> (); ecsSystems.OneFrame <EcsUiSliderChangeEvent> (); ecsSystems.OneFrame <EcsUiTmpDropdownChangeEvent> (); ecsSystems.OneFrame <EcsUiTmpInputChangeEvent> (); ecsSystems.OneFrame <EcsUiTmpInputEndEvent> (); }
void Start() { world = new EcsWorld(); systems = new EcsSystems(world); #if UNITY_EDITOR Leopotam.Ecs.UnityIntegration.EcsWorldObserver.Create(world); Leopotam.Ecs.UnityIntegration.EcsSystemsObserver.Create(systems); #endif // order is important systems.Add(new GameMatchLauncherSystem()); systems.Add(new AiSystem()); systems.Add(new OrderingSystem()); systems.Add(new MovableSystem()); systems.Add(new TurretSystem()); systems.Add(new AttackSystem()); systems.Add(new HarvestingSystem()); systems.Add(new NavMeshSystem()); systems.Add(new ProductionSystem()); systems.Add(new SelectionSystem()); systems.Add(new SpawnUnitsSystem()); systems.Add(new ChangeUnitOwnerSystem()); systems.Add(new SearchEnemySystem()); systems.Add(new UnitsEffectsSystem()); systems.Add(new PlayersSystem()); systems.Add(new CameraSystem()); systems.Add(new ProcessDamageSystem()); systems.Add(new UI.FloatingSystem()); // todo move to UI init system? systems.Add(new UI.HealthbarsSystem()); systems.Add(new UI.GameInfoSystem()); systems.Add(new UI.BuyButtonsSystem()); systems.Inject(StartData); systems.Inject(Camera.main); systems.Inject(UICanvas); systems.OneFrame <TakeDamageEvent>(); systems.OneFrame <ChangeUnitOwnerEvent>(); systems.OneFrame <MoveOrderEvent>(); systems.OneFrame <SpawnUnitEvent>(); systems.OneFrame <ShootEvent>(); systems.OneFrame <RequestBuyUnitEvent>(); systems.OneFrame <UI.RemoveHealthbarEvent>(); systems.OneFrame <UI.AddHealthbarEvent>(); systems.OneFrame <UI.HideBuyButtonsEvent>(); systems.OneFrame <UI.ShowBuyButtonsEvent>(); systems.OneFrame <SpendPlayerResourcesEvent>(); systems.OneFrame <SpendFieldResourcesEvent>(); systems.OneFrame <AddPlayerResourcesEvent>(); systems.Init(); }
void OnEnable() { _world = new EcsWorld(); _systems = new EcsSystems(_world); _viewSystems = new EcsSystems(_world, "UnityView"); Application.targetFrameRate = 60; _gameView.Init(); UnityIntegration(); _systems .Add(new CoreGameInit()) .Add(new Utils.UnityTimeSystem()) // user input .Add(new UserInput.TapTrackerSystem()) // networking .Add(new PlayersUpdateIssuingSystem(_playerApi)) .Add(new SyncWorldSystem(_worldApi)) .Add(new ConnectSystem(_playerApi)) .Add(new PlayersUpdateSystem(_playerApi)) .Add(new DestroyNetSystem(_playerApi)) .Add(new BuyNetSystem(_playerApi)) .Add(new MoveNetSystem(_playerApi)) .Add(new AttackNetSystem(_playerApi)) .Add(new HealNetSystem(_playerApi)) // stuff .Add(new SpawnPlayerProcessing(_playerApi)) .Add(new UpdateUserPlanetProcessing()) .Add(new UpdatePlayerPointProcessing()) .Add(new UpdateOwnersProcessing(_worldApi)) .Add(new MoveTargetSys()) // object rotating system .Add(new ObjectRotationSystem()) // camera .Add(new CameraSystem()) .Add(new FollowPlayerCamera()) // space objects markers .Add(new MarkersControlSystem(_playerApi)); _viewSystems // view allocations .Add(new ViewAllocatorSystem(_gameView)) // view sync .Add(new Positioning.Systems.UPositionSyncSystem()) .Add(new Positioning.Systems.URotationsSyncSystem()) // rendering .Add(new UMeshRenderer.Systems.MatrixPositionUpdate()) .Add(new UMeshRenderer.Systems.UMeshRenderer()) //ui .Add(new UIUpadteIssuer(0.5f)) .Add(new UICoreECS.ScreenSwitchSystem(_screens, _uiRoot)) .Add(new UIPlayerStatsUpdateSystem()) .Add(new UICurrentPlanetPanelDrawer(_playerApi)) .Add(new InfoPopUpProcessing()) .Add(new UISelectedPlanetPanelDrawer(_playerApi)); _systems .OneFrame <Positioning.Components.LazyPositionUpdate>() .OneFrame <LoginActionTag>() .OneFrame <LoggedInTag>() .OneFrame <PlayersUpdateTag>() .OneFrame <SpawnPlayerTag>() .OneFrame <UpdateOwnersTag>() .OneFrame <BuyActionTag>() .OneFrame <DestroyActionTag>() .OneFrame <MoveActionTag>() .OneFrame <PointerClicked>() .OneFrame <AttackActionTag>() .OneFrame <HealActionTag>(); _viewSystems .OneFrame <AllocateView>() .OneFrame <Positioning.Components.LazyPositionUpdate>() .OneFrame <UIUpdate>(); _systems.Add(_viewSystems); _systems.Inject(new Utils.TimeService()); _systems.Init(); }