Ejemplo n.º 1
0
        protected void Awake()
        {
            if (assetLibrary == null)
            {
                Debug.LogError($"[{nameof(DemoController)}] No '{nameof(GraphicAssetLibrary)}' provided!");
                return;
            }

            //Create utilities
            logger          = new Utils.Logger(UnityEngine.Debug.Log);
            subtaskRunner   = new SubtaskRunner(executorCount);
            entityContext   = new EntityContext();
            deltaTime       = new DeltaTimeHandle();
            random          = new ShiftRandomProvider();
            renderManager   = new RenderManager(executorCount, assetLibrary);
            colliderManager = new ColliderManager(new AABox(minCollisionArea, maxCollisionArea));

            //Create systems
            systemManager = new TaskManager(subtaskRunner, new ECS.Tasks.ITask[]
            {
                new ApplyVelocitySystem(deltaTime, entityContext),
                new RegisterColliderSystem(colliderManager, entityContext),
                new TestCollisionSystem(deltaTime, colliderManager, entityContext),
                new ApplyGravitySystem(deltaTime, entityContext),

                new SpawnProjectilesSystem(colliderManager, deltaTime, entityContext),
                new SpawnTurretSystem(new AABox(minTurretSpawnArea, maxTurretSpawnArea), turretCount, random, entityContext),
                new SpawnSpaceshipSystem(new AABox(minSpaceshipSpawnArea, maxSpaceshipSpawnArea), spaceshipCount, random, entityContext),

                new ExplodeSpaceshipWhenCrashSystem(entityContext),
                new DisableSpaceshipWhenHitSystem(entityContext),

                new AgeSystem(deltaTime, entityContext),
                new LifetimeSystem(entityContext),

                new RegisterRenderObjectsSystem(renderManager, entityContext),
            }, logger, timeline);

            timeline?.StartTimers();
        }
Ejemplo n.º 2
0
 public ITaskExecutor CreateExecutor(SubtaskRunner runner, Logger logger = null, Profiler.Timeline profiler = null)
 => new GroupExecutor(innerTasks, runner, logger, profiler);
Ejemplo n.º 3
0
 public ITaskExecutor CreateExecutor(SubtaskRunner runner, Logger logger = null, Profiler.Timeline profiler = null)
 {
     return(new SubtaskExecutor(this, runner, batchSize, logger, profiler));
 }