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
    }
Пример #2
0
        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();
        }
Пример #3
0
    void IEcsInitSystem.Initialize()
    {
        cameraContainer = GameObject.FindGameObjectWithTag("MainCamera");
        cam             = cameraContainer.GetComponentInChildren <Camera>();
        var camera = EcsFilterSingle <MainCamera> .Create(_world);

        camera.camera    = cameraContainer.GetComponentInChildren <Camera>();
        camera.transform = cameraContainer.transform;
        zoomScaling      = 1;
    }
Пример #4
0
        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;
        }
Пример #5
0
        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;
        }