public static void Init <T>() where T : class, IEcsInitSystem, new() { _world = new EcsWorld(); #if UNITY_EDITOR EcsWorldObserver.Create(_world); #endif Instance._systems = new EcsSystems(_world) .Add(new T()) .Add(new WrapSystem()); Instance._systems.Init(); init = true; }
void OnEnable() { _world = new EcsWorld(); #if UNITY_EDITOR 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.Init(); #if UNITY_EDITOR EcsSystemsObserver.Create(_systems); #endif }
void Start() { // create ecs environment. World = new EcsWorld(); #if UNITY_EDITOR EcsWorldObserver.Create(World); #endif _systems = new Leopotam.Ecs.EcsSystems(World) .Add(new InitSystem()) .Add(new UiInputSystem()) .Add(new UpdateAvailableSkillSystem()) .Add(new SkillSystem()) .Add(new EffectSystem()) .Add(new CharacterMoveSystem()) .Add(new StatsSystem()) .Add(new CharacterStatWindowSystem()) .Inject(_characterPrefab) .Inject(_statWindow); _systems.Init(); }
void Start() { var gameContext = new GameContext(); _world = new EcsWorld(); _systems = new EcsSystems(_world); #if UNITY_EDITOR EcsWorldObserver.Create(_world); EcsSystemsObserver.Create(_systems); #endif _systems // Model .Add(new GameFieldInitSystem()) .Add(new ScoreInitSystem()) .Add(new BlockubeInitSystem()) .Add(new GameStateInitSystem()) .Add(new TargetInitSystem()) // View // Controller .Add(new InputSystem()) .Add(new GameStateInputSystem()) // TODO : implement input .Add(new MoveInputSystem()) .Add(new MoveExecuteSystem()) .Add(new MoveBesideBorderSystem()) .Add(new FallInputSystem()) .Add(new FallOnRedLineSystem()) .Add(new FallExecuteSystem()) .Add(new FallTimerStartSystem()) .Add(new BlockToFieldSystem()) .Add(new BlockInstallColorSystem()) .Add(new NextColorSystem()) .Add(new FindManyIdenticalBlocksSystem()) .Add(new RemoveManyIdenticalBlocksSystem()) .Add(new RemoveLineTimerStartSystem()) .Add(new BoomSystem()) .Add(new MergeSystem()) .Add(new MergeTimerStartSystem()) .Add(new RotateColorChangeSystem()) .Add(new TargetSystem()) .Add(new TargetOnOffSystem()) .Add(new TimersSystem()) // register one-frame components .OneFrame <InputMoveStartedEvent>() .OneFrame <InputMoveCanceledEvent>() .OneFrame <InputFallStartedEvent>() .OneFrame <ChangePositionEvent>() .OneFrame <IsFallMadeEvent>() .OneFrame <BlockInstallToFieldEvent>() .OneFrame <IsRemoveLineMadeEvent>() .OneFrame <IsMergeMadeEvent>() .OneFrame <SetNextColorEvent>() .OneFrame <GameOverEvent>() .OneFrame <ColorChangeStartEvent>() .OneFrame <TargetEvent>() .OneFrame <IsBoomBlockEvent>() // inject .Inject(gameConfiguration) .Inject(GetComponent <SceneData>()) .Inject(gameContext) .Inject(new PoolsObject()) .Init(); }