示例#1
0
 public TestCollisionSystem(DeltaTimeHandle deltaTime, ColliderManager colliderManager, EntityContext context)
     : base(context, batchSize: 100)
 {
     this.deltaTime       = deltaTime;
     this.colliderManager = colliderManager;
     this.context         = context;
 }
 public SpawnProjectilesSystem(ColliderManager colliderManager, DeltaTimeHandle deltaTime, EntityContext context)
     : base(context, batchSize: 100)
 {
     this.colliderManager = colliderManager;
     this.deltaTime       = deltaTime;
     this.context         = context;
     this.disabledMask    = context.GetMask <DisabledTag>();
 }
示例#3
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();
        }
示例#4
0
 public AgeSystem(DeltaTimeHandle deltaTime, EntityContext context)
     : base(context, batchSize: 100)
 {
     this.deltaTime = deltaTime;
 }