Exemplo n.º 1
0
    void Awake()
    {
        scoreService.Init();
        Service <ScoreService> .Set(scoreService);



        World              = new EcsWorld();
        systemsUpdate      = new EcsSystems(World);
        systemsFixedUpdate = new EcsSystems(World);
#if UNITY_EDITOR
        Leopotam.Ecs.UnityIntegration.EcsWorldObserver.Create(World);
        Leopotam.Ecs.UnityIntegration.EcsSystemsObserver.Create(systemsUpdate);
        Leopotam.Ecs.UnityIntegration.EcsSystemsObserver.Create(systemsFixedUpdate);
#endif

        //Init Systems:

        //Update Systems:
        systemsUpdate.Add(new ECS.Systems.InputSystem());
        systemsUpdate.Add(new ECS.Systems.DelaySystem());
        systemsUpdate.Add(new ECS.Systems.MovementPlayerSystem());
        systemsUpdate.Add(new ECS.Systems.MovementSystem());
        systemsUpdate.Add(new ECS.Systems.ShootPlayerSystem());
        systemsUpdate.Add(new ECS.Systems.GeneratorSystem());
        systemsUpdate.Add(new ECS.Systems.ShootSystem());
        systemsUpdate.Add(new ECS.Systems.ScoreSystem());
        systemsUpdate.Add(new ECS.Systems.ScoreOutSystem());



        //Events:
        systemsUpdate.Add(new ECS.Systems.Events.CollisionPlayerEvent());
        systemsUpdate.Add(new ECS.Systems.Events.CollisionBulletEvent());
        systemsUpdate.Add(new ECS.Systems.Events.HitEventSystem());
        systemsUpdate.Add(new ECS.Systems.Events.RestartGameEventSystem());
        systemsUpdate.Add(new ECS.Systems.Events.DestroyEntityEventSystem());

        //Events UI:

        // register one-frame components (order is important), for example:
        // .OneFrame<TestComponent1> ()
        // .OneFrame<TestComponent2> ()

        // inject service instances here (order doesn't important), for example:
        // .Inject (new CameraService ())
        // .Inject (new NavMeshSupport ())


        systemsUpdate.Inject(gameData);
        systemsUpdate.Inject(scoreService);
        systemsUpdate.InjectUi(uiEmitter);
        systemsUpdate.Init();

        systemsFixedUpdate.Init();
    }
Exemplo n.º 2
0
    void Awake()
    {
        // void can be switched to IEnumerator for support coroutines.

        scoreService.Init();
        Debug.Log(scoreService.BestResult);
        Service <ScoreService> .Set(scoreService);

        Debug.Log(Service <ScoreService> .Get().BestResult);


        World         = new EcsWorld();
        systemsUpdate = new EcsSystems(World);
#if UNITY_EDITOR
        Leopotam.Ecs.UnityIntegration.EcsWorldObserver.Create(World);
        Leopotam.Ecs.UnityIntegration.EcsSystemsObserver.Create(systemsUpdate);
#endif

        //Init Systems:
        systemsUpdate.Add(new ECS.Systems.MenuUiInitSystem());

        //Update Systems:

        //Events:

        //Events UI:
        systemsUpdate.Add(new ECS.Systems.Events.MenuButtonsClicksSystem());

        // register one-frame components (order is important), for example:
        // .OneFrame<TestComponent1> ()
        // .OneFrame<TestComponent2> ()

        // inject service instances here (order doesn't important), for example:
        // .Inject (new CameraService ())
        // .Inject (new NavMeshSupport ())
        systemsUpdate.Inject(scoreService);

        systemsUpdate.Inject(MenuUi);
        systemsUpdate.InjectUi(uiEmitter);
        systemsUpdate.Init();
    }