void OnEnable() { _world = new EcsWorld(); #if UNITY_EDITOR Leopotam.Ecs.UnityIntegration.EcsWorldObserver.Create(_world); #endif var sharedData = EcsFilterSingle <SharedGameState> .Create(_world); _systems = new EcsSystems(_world) .Add(new GameSystems()) .Add(new TanksControlSystem()) .Add(new BulletControlSystem()) .Add(new DataSystem(this)) .Add(new MainCameraSystem());/* * .Add(new NpcMovementSystem()) * .Add(new PlayerMovementSystem()) * .Add(new DamageSystem()) * .Add(new SquadSystem()) * .Add(new SelectionSystem());*/ _systems.Initialize(); #if UNITY_EDITOR Leopotam.Ecs.UnityIntegration.EcsSystemsObserver.Create(_systems); #endif }
void OnEnable() { _world = new EcsWorld(); #if UNITY_EDITOR Leopotam.Ecs.UnityIntegration.EcsWorldObserver.Create(_world); #endif _gameplaySystems = new EcsSystems(_world) //.Add(jitEmitter) .Add(new InitializePlayerSystem()) .Add(new InitializeCameraSystem()) .Add(new InputSystem(joystick, jumpButton)) //.Add(new FrameSelectionSystem()) //.Add(new RecorderSystem()) //.Add(new ReplaySystem()) .Add(new CameraFollowSystem()) .Add(new PlayerDieSystem()); _gameplaySystems.Initialize(); _physicsSystems = new EcsSystems(_world) .Add(new PlayerMoveSystem()) .Add(new PlayerJumpSystem()); _physicsSystems.Initialize(); #if UNITY_EDITOR Leopotam.Ecs.UnityIntegration.EcsSystemsObserver.Create(_gameplaySystems); #endif }
private void InitializeECS() { // Initialize ECS _world = new EcsWorld(); _systems = new EcsSystems(_world); _renderingSystems = new EcsSystems(_world, "Rendering Systems"); _renderingSystems.Add(new SpriteRenderingSystem(graphics, GraphicsDevice)); _gameplaySystems = new EcsSystems(_world, "Gameplay Systems"); _gameplaySystems.Add(_timingSystem = new TimingSystem()); _gameplaySystems.Add(new StateSystem()); _gameplaySystems.Add(new InputSystem()); _gameplaySystems.Add(new PaddleMovementSystem()); _gameplaySystems.Add(new MovementSystem()); _gameplaySystems.Add(new CollisionSystem()); _gameplaySystems.Add(new BrickBreakingSystem()); _gameplaySystems.Add(new CameraShakeSystem()); _gameplaySystems.Add(new BallBounceSystem()); _systems.Add(_renderingSystems); _systems.Add(_gameplaySystems); _systems.Initialize(); }
// The constructor initializes all the fields public Game(MainWindow mainWindow) { this.mainWindow = mainWindow; // Create new ecs world instance Logger.Info("Creating world instance."); world = new EcsWorld(); // Create the ecs systems Logger.Info("Creating systems."); systems = new EcsSystems(world) .Add(new SnakeSystem(this)) .Add(new FoodSystem(this)); // Initialize systems Logger.Info("Initializing systems."); systems.Initialize(); // Set initial score Logger.Info("Setting initial score."); SetScore(0); // Setup game Logger.Info("Setting up game entities."); GameSetup(); }
private void GunshotWoundInit() { _ecsWorld = new EcsWorld(); _mainConfig = EcsFilterSingle <MainConfig> .Create(_ecsWorld); LoadConfigsFromXml(); _updateSystems = new EcsSystems(_ecsWorld); LastSystem = "AddNpcSystem"; if (_mainConfig.NpcConfig.AddingPedRange > 1f) { _updateSystems .Add(new NpcSystem()); } LastSystem = "AddPlayerSystem"; if (_mainConfig.PlayerConfig.WoundedPlayerEnabled) { _updateSystems .Add(new PlayerSystem()); } LastSystem = "AddAdrenalineSystem"; if (_mainConfig.PlayerConfig.AdrenalineSlowMotion) { _updateSystems .Add(new AdrenalineSystem()); } LastSystem = "AddOtherSystems"; _updateSystems .Add(new InstantHealSystem()) .AddHitSystems() .AddDamageSystems() .AddWoundSystems() .AddPainSystems() .Add(new HitCleanSystem()) .Add(new HelmetRequestSystem()) .Add(new DebugInfoSystem()) .Add(new CheckSystem()) .Add(new NotificationSystem()) .Add(new ArmorSystem()) .Add(new RagdollSystem()) .Add(new SwitchAnimationSystem()); LastSystem = "OnInit"; _updateSystems.Initialize(); Tick += OnTick; KeyUp += OnKeyUp; Function.Call(Hash.SET_PLAYER_WEAPON_DAMAGE_MODIFIER, Game.Player, 0.00001f); Function.Call(Hash.SET_PLAYER_HEALTH_RECHARGE_MULTIPLIER, Game.Player, 0f); LastSystem = "Stopwatch"; _debugStopwatch = new Stopwatch(); }
private void OnEnable() { _world = new EcsWorld(); #if UNITY_EDITOR LeopotamGroup.Ecs.UnityIntegration.EcsWorldObserver.Create(_world); #endif _systems = new EcsSystems(_world) .Add(new UserInputSystem()) .Add(new MovePlayerSystem()) .Add(new CheckPointSystem()) .Add(new GameOverSystem()); _systems.Initialize(); #if UNITY_EDITOR LeopotamGroup.Ecs.UnityIntegration.EcsSystemsObserver.Create(_systems); #endif }
public void Init() { _world = new EcsWorld(); _systems = new EcsSystems(_world); StatsContainerEntity = _world.CreateEntityWith(out StatsContainerComponent _); _systems .Add(new ConfigInitSystem()) .Add(new LocalizationInitSystem()) .Add(new UidInitSystem()) .Add(new HashesInitSystem()) .Add(new GswWorldInitSystem()) .Add(new GswWorldCleanSystem()) .Add(new GswWorldSystem()) .Add(new PlayerInitSystem()) .Add(new WoundInitSystem()) .Add(new HealthInitSystem()) .Add(new PainInitSystem()) .Add(new BleedingInitSystem()) .Add(new WeaponInitSystem()) .Add(new ArmorInitSystem()) .Add(new CritInitSystem()) .Add(new PainStateInitSystem()) .Add(new PainStateSystem()) .Add(new BaseHitDetectingSystem()) .Add(new BodyPartInitSystem()) .Add(new BodyHitDetectingSystem()) #if DEBUG .Add(new BodyHitHistoryShowSystem()) #endif .Add(new WeaponHitDetectingSystem()) .Add(new BaseHitCleanSystem()) .Add(new HelmetHitProcessingSystem()) .Add(new ArmorHitProcessingSystem()) .Add(new CritSystem()) .Add(new WoundSystem()) .Add(new HealDetectSystem()) .Add(new HealthSystem()) .Add(new PainSystem()) .Add(new BleedingCleanSystem()) .Add(new BleedingHealSystem()) .Add(new BleedingCreateSystem()) .Add(new BleedingSystem()); _systems.Initialize(); GameFiber.Yield(); }
void OnEnable() { _world = new EcsWorld(); #if UNITY_EDITOR Leopotam.Ecs.UnityIntegration.EcsWorldObserver.Create(_world); #endif _systems = new EcsSystems(_world) .Add(new ObstacleProcessing()) .Add(new UserInputProcessing()) .Add(new MovementProcessing()) .Add(new FoodProcessing()) .Add(new DeadProcessing()) .Add(new ScoreProcessing()); _systems.Initialize(); #if UNITY_EDITOR Leopotam.Ecs.UnityIntegration.EcsSystemsObserver.Create(_systems); #endif }
void OnEnable() { _world = new EcsWorld(); #if UNITY_EDITOR Leopotam.Ecs.UnityIntegration.EcsWorldObserver.Create(_world); #endif _updateSystems = new EcsSystems(_world) .Add(new PlayerInitSystem()) .Add(new FMovePlayerSystem() { SpeedMultipiler = Settings.SpeedMultipiler }) .Add(new CameraSystem() { CameraDistance = Settings.CameraDistance, CameraSpeed = Settings.CameraSpeed }) .Add(new InputKeyboardSystem()) .Add(new InputStickSystem()) .Add(new FWorldGenSystem() { PlayerPrefab = Settings.PlayerPrefab, Fow = Settings.FieldOfView, HexSize = Settings.HexSize, MapSize = Settings.MapSize, MapSeed = Settings.MapSeed, Spawn = Settings.Spawn, Enemy = Settings.Enemy, Diamond = Settings.Diamond, Obstacle = Settings.Obstacle, Water = Settings.Water, Grass = Settings.Grass, Swamp = Settings.Swamp, Forest = Settings.Forest }) .Add(new FAISystem()); // _updateSystems.Initialize(); #if UNITY_EDITOR Leopotam.Ecs.UnityIntegration.EcsSystemsObserver.Create(_updateSystems); #endif }
public void Initialize() { _world = new EcsWorld(); _state = new Match3State(_settings); CreateWorldObserver(_world); _systems = new EcsSystems(_world) .Add(new StoneSwapSystem(_world, _eventsReceiver, _state)) .Add(new FallStoneSystem(_eventsReceiver, _state)) .Add(new CreateNewStonesSystem(_world, _eventsReceiver, _state)) .Add(new MarkDestroyingComboSystem(_world, _state)) .Add(new DestroyStoneSystem(_world, _eventsReceiver, _state)) .Add(new FieldInitializeSystem(_world, _eventsReceiver, _state)); _systems.Initialize(); CreateSystemsObserver(_systems); }
public World(Context context) { _context = context; _world = new EcsWorld(); _systems = new EcsSystems(_world); _registeredSystems = new Dictionary <Type, IEcsSystem>(); // CI _container = new Container(); _container.Register(() => this, Lifestyle.Singleton); _container.Register(() => _world, Lifestyle.Singleton); _container.Register(() => _systems, Lifestyle.Singleton); _container.Register(() => _context, Lifestyle.Singleton); RegisterSystems(); _systems.Initialize(); Log.Information("World initialized"); }
private void Start() { Current = new EcsWorld(); systems = new EcsSystems(Current); systems.Add(new InputSystem()) .Add(new AimSystem()) .Add(new MoveSystem()) .Add(new CameraSystem()) .Add(new TimeSystem()) .Add(new ObstaclesSystem()) .Add(new HealthSystem()) .Add(new AudioSystem()) .Add(new MenuSystem()) .Add(new GameOverSystem()) .Add(new SceneSystem()); systems.Initialize(); }
void OnEnable() { _world = new ReverseSnakeWorld(); #if UNITY_EDITOR Leopotam.Ecs.UnityIntegration.EcsWorldObserver.Create(_world); #endif _gameManager = GameManager.GetInstance(_world); _systems = new EcsSystems(_world) .Add(_uiEmitter) .Add(new StateSystem()) .Add(new StepReactiveSystemOnAdd()) .Add(new StepReactiveSystemOnRemove()) .Add(new WallReactivitySystemOnAdd()) .Add(new WallReactivitySystemOnRemove()) .Add(new TargetReactivitySystemOnAdd()) .Add(new TargetReactivitySystemOnUpdate()) .Add(new TargetReactiveSystemOnRemove()) .Add(new ScoreReactivitySystemOnUpdate()) .Add(new UserInputSystem()) .Add(new GameEndSystem()); _systems.Initialize(); #if UNITY_EDITOR Leopotam.Ecs.UnityIntegration.EcsSystemsObserver.Create(_systems); #endif SaveState.OnLoaded += OnLoadState; if (LoadState) { SaveState.Load(); } else { _gameManager.StartNewGame(); } }
// Use this for initialization private void Start() { EcsWorld = new EcsWorld(); #if UNITY_EDITOR Leopotam.Ecs.UnityIntegration.EcsWorldObserver.Create(EcsWorld); #endif UpdateSystems = new EcsSystems(EcsWorld) .Add(new PlayerInitSystem { StartLifes = _startLifes, StartSpeed = _startPacmanSpeed }) .Add(new WallInitSystem()) .Add(new PlayerInputSystem()) .Add(new CommandSystem()) .Add(new GhostSystem { GhostSpeed = _ghostSpeed }) .Add(new MoveSystem()) .Add(new PortalSystem()) .Add(new DeathSystem()) .Add(new TeleportSystem()) .Add(new GuiSystem { Text = _scoresText }) .Add(new GameStateSystem { GuiElement = _pauseMenu }) .AddItemSystems(); UpdateSystems.Initialize(); #if UNITY_EDITOR Leopotam.Ecs.UnityIntegration.EcsSystemsObserver.Create(UpdateSystems); #endif EcsWorld.CreateEntityWith <GameStateComponent>().State = GameStates.START; }
internal void Initialize() { updateSystems.Initialize(); renderSystems.Initialize(); }
public void Init() { EcsWorld?.Dispose(); EcsWorld = new EcsWorld(); _systems = new EcsSystems(EcsWorld); StatsContainerEntity = EcsWorld.CreateEntityWith(out StatsContainerComponent _); _systems .Add(new PauseDetectingSystem()) #if DEBUG .Add(new FrameTimeStartSystem()) #endif //InitSystems .Add(new ConfigInitSystem()) .Add(new ConsoleCommandsInitSystem()) .Add(new LocalizationInitSystem()) .Add(new UidInitSystem()) .Add(new HashesInitSystem()) .Add(new NotificationsInitSystem()) .Add(new DonateListSystem()) .Add(new GswWorldInitSystem()) .Add(new GswWorldCleanSystem()) .Add(new GswWorldSystem()) .Add(new PlayerInitSystem()) .Add(new WoundInitSystem()) .Add(new HealthInitSystem()) .Add(new PainInitSystem()) .Add(new BleedingInitSystem()) .Add(new WeaponInitSystem()) .Add(new ArmorInitSystem()) .Add(new PainStateInitSystem()) .Add(new CritInitSystem()) .Add(new RagdollInitSystem()) .Add(new BodyPartInitSystem()) .Add(new NaturalMotionInitSystem()) .Add(new FacialAnimationInitSystem()) .Add(new InstantKillInitSystem()) .Add(new WeaponDropInitSystem()) .Add(new MovementInitSystem()) .Add(new MovementClipsetInitSystem()) .Add(new FlashInitSystem()) .Add(new CameraShakeInitSystem()) .Add(new ScreenEffectInitSystem()) .Add(new PedFlagsInitSystem()) .Add(new PlayPainInitSystem()) .Add(new SpecialAbilityLockInitSystem()) .Add(new VehicleControlInitSystem()) //RunSystems .Add(new PainStateSystem()) .Add(new BaseHitDetectingSystem()) .Add(new BodyHitDetectingSystem()) .Add(new WeaponHitDetectingSystem()) .Add(new BaseHitCleanSystem()) .Add(new HelmetHitProcessingSystem()) .Add(new ArmorHitProcessingSystem()) .Add(new WoundSystem()) .Add(new FullHealDetectSystem()) .Add(new CritSystem()) .Add(new HealthSystem()) .Add(new PainSystem()) .Add(new BleedingCleanSystem()) .Add(new BleedingCreateSystem()) .Add(new BleedingSystem()) .Add(new SelfHealingSystem()) .Add(new RagdollSystem()) .Add(new NaturalMotionSystem()) .Add(new FacialAnimationSystem()) .Add(new InstantKillSystem()) .Add(new WeaponDropSystem()) .Add(new MovementSystem()) .Add(new MovementClipsetSystem()) .Add(new FlashSystem()) .Add(new CameraShakeSystem()) .Add(new ScreenEffectSystem()) .Add(new PedFlagsSystem()) .Add(new PlayPainSystem()) .Add(new SpecialAbilityLockSystem()) .Add(new VehicleControlSystem()) #if DEBUG .Add(new DamagedBoneHistorySystem()) .Add(new FrameTimeStopSystem()) .Add(new DebugTextSystem()) #endif .Add(new WoundNotificationSystem()) .Add(new NotificationsSystem()) .Inject(Random) .Inject(new GameService()); _systems.Initialize(); GameFiber.Yield(); }
private void GunshotWoundInit() { _ecsWorld = new EcsWorld(); _mainConfig = EcsFilterSingle <MainConfig> .Create(_ecsWorld); _localeConfig = EcsFilterSingle <LocaleConfig> .Create(_ecsWorld); _gswWorld = EcsFilterSingle <GswWorld> .Create(_ecsWorld); _gswWorld.GswPeds = new Dictionary <Ped, int>(); try { TryToLoadConfigsFromXml(); _configLoaded = true; } catch (Exception e) { LoadDefaultConfigs(); _configLoaded = false; #if DEBUG UI.Notify(e.ToString()); #endif } try { TryToLoadLocalization(); _localizationLoaded = true; } catch (Exception e) { LoadDefaultLocalization(); _localizationReason = e.Message; _localizationLoaded = false; #if DEBUG UI.Notify(e.ToString()); #endif } _everyFrameSystems = new EcsSystems(_ecsWorld); _commonSystems = new MultiTickEcsSystems(_ecsWorld, MultiTickEcsSystems.RestrictionModes.MILLISECONDS, 10); if (_mainConfig.NpcConfig.AddingPedRange > MINIMAL_RANGE_FOR_WOUNDED_PEDS) { _commonSystems .Add(new NpcFindSystem()) .Add(new ConvertPedToNpcGswPedSystem()) .Add(new RemoveWoundedPedSystem()); } if (_mainConfig.PlayerConfig.WoundedPlayerEnabled) { _everyFrameSystems .Add(new PlayerSystem()) .Add(new SpecialAbilityLockSystem()); if (_mainConfig.PlayerConfig.MaximalSlowMo < 1f) { _everyFrameSystems .Add(new AdrenalineSystem()); } } _everyFrameSystems .Add(new InstantHealSystem()) .Add(new HelmetRequestSystem()) .Add(new RagdollSystem()) .Add(new SwitchAnimationSystem()) .Add(new DebugInfoSystem()) .Add(new CameraShakeSystem()) .Add(new FlashSystem()) .Add(new PainRecoverySystem()) .Add(new BleedingSystem()) .Add(new BandageSystem()) .Add(new SelfHealingSystem()); _commonSystems .Add(new ArmorSystem()) .AddHitDetectSystems() .AddDamageProcessingSystems() .AddWoundSystems() .AddPainStateSystems() .Add(new CheckSystem()) .Add(new NotificationSystem()); _everyFrameSystems.Initialize(); _commonSystems.Initialize(); Tick += OnTick; KeyUp += OnKeyUp; _isPaused = false; }
private void GunshotWoundInit() { Function.Call(Hash._SET_CAM_EFFECT, 0); _ecsWorld = new EcsWorld(); _mainConfig = EcsFilterSingle <MainConfig> .Create(_ecsWorld); _localeConfig = EcsFilterSingle <LocaleConfig> .Create(_ecsWorld); _gswWorld = EcsFilterSingle <GswWorld> .Create(_ecsWorld); _gswWorld.GswPeds = new Dictionary <Ped, int>(); (_configLoaded, _configReason) = MainConfig.TryToLoadFromXml(_mainConfig); (_localizationLoaded, _localizationReason) = LocaleConfig.TryToLoadLocalization(_localeConfig, _mainConfig.Language); _everyFrameSystems = new EcsSystems(_ecsWorld); _commonSystems = new MultiTickEcsSystems(_ecsWorld, MultiTickEcsSystems.RestrictionModes.MILLISECONDS, 10); if (_mainConfig.NpcConfig.AddingPedRange > MinimalRangeForWoundedPeds) { _commonSystems .Add(new NpcFindSystem()) .Add(new ConvertPedToNpcGswPedSystem()) .Add(new RemoveWoundedPedSystem()); } if (_mainConfig.PlayerConfig.WoundedPlayerEnabled) { _everyFrameSystems .Add(new PlayerSystem()) .Add(new SpecialAbilityLockSystem()); if (_mainConfig.PlayerConfig.MaximalSlowMo < 1f) { _everyFrameSystems.Add(new AdrenalineSystem()); } } _everyFrameSystems .Add(new InstantHealSystem()) .Add(new HelmetRequestSystem()) .Add(new RagdollSystem()) .Add(new MoveSetSwitchSystem()) .Add(new DebugInfoSystem()) .Add(new CameraShakeSystem()) .Add(new FlashSystem()) .Add(new PainRecoverySystem()) .Add(new BleedingSystem()) .Add(new BandageSystem()) .Add(new SelfHealingSystem()); _commonSystems .Add(new ArmorSystem()) .AddHitDetectSystems() .AddDamageProcessingSystems() .AddWoundSystems() .AddPainStateSystems() .Add(new CheckSystem()) .Add(new NotificationSystem()); _everyFrameSystems.Initialize(); _commonSystems.Initialize(); Tick += OnTick; KeyUp += OnKeyUp; _isPaused = false; }
void OnGUI() { var size = 100; var offset = 100; var buttonnum = 0; if (GUI.Button(new Rect(offset, buttonnum * size, size, size), "Init Leo\n All Sys")) { var t0 = Time.realtimeSinceStartup; _world = new EcsWorld(); _systems = LeoSystemsCreator.CreateAllSystems(_world); _systems.Initialize(); Debug.Log("Init Leo All Sys " + (Time.realtimeSinceStartup - t0)); } buttonnum++; if (GUI.Button(new Rect(offset, buttonnum * size, size, size), "Init Leo\n Only Run Sys")) { var t0 = Time.realtimeSinceStartup; _world = new EcsWorld(); _systems = LeoSystemsCreator.CreateOnlyRunSystems(_world); _systems.Initialize(); Debug.Log("Init Leo Only Run Sys " + (Time.realtimeSinceStartup - t0)); } buttonnum++; if (GUI.Button(new Rect(offset, buttonnum * size, size, size), "Add entitys")) { var t0 = Time.realtimeSinceStartup; LeoEntitiesCreator.CreateEntitys(_world); Debug.Log("Add Leo entitys " + (Time.realtimeSinceStartup - t0)); } buttonnum++; if (GUI.Button(new Rect(offset, buttonnum * size, size, size), "Run 1")) { var t0 = Time.realtimeSinceStartup; _systems.Run(); Debug.Log("Run Leo Single Run time " + (Time.realtimeSinceStartup - t0)); } buttonnum++; if (GUI.Button(new Rect(offset, buttonnum * size, size, size), "Run " + Iterations)) { var t0 = Time.realtimeSinceStartup; for (int i = 0; i < Iterations; i++) { _systems.Run(); } Debug.Log("Run Leo Iterations_" + Iterations + " time " + (Time.realtimeSinceStartup - t0)); } buttonnum++; if (GUI.Button(new Rect(offset, buttonnum * size, size, size), "Register Components\n Creation")) { var t0 = Time.realtimeSinceStartup; LeoComponentRegCreators.RegisterComponentCreators(); Debug.Log("Register Components Creators time " + (Time.realtimeSinceStartup - t0)); } buttonnum++; }