public override void SetupEngines(EnginesRoot enginesRoot, IEntityFactory factory, IEntityFunctions functions) { movementPhaser = new MovementScheduler(); lifterCollectionEngine = new LifterCollectionEngine(); lifterMovementEngine = new LifterMovementEngine(movementPhaser); movingPositionEngine = new MovingPositionEngine(movementPhaser); enginesRoot.AddEngine(lifterCollectionEngine); enginesRoot.AddEngine(lifterMovementEngine); enginesRoot.AddEngine(movingPositionEngine); }
/// <summary> /// Wire all the game logic and setup the engines /// </summary> private IEnumerator SetupEngines(EnginesRoot ecs) { IEntityFactory entityFactory = ecs.GenerateEntityFactory(); IEntityFunctions entityFunctions = ecs.GenerateEntityFunctions(); MovementScheduler movementPhaser = new MovementScheduler(); Sequencer landingEventResponseSequence = new Sequencer(); var lifterCollection = new LifterCollectionEngine(); var lifterMovement = new LifterMovementEngine(movementPhaser); var movingPosition = new MovingPositionEngine(movementPhaser); var lifterSnap = new AnyLifterSnapEngine(movementPhaser, landingEventResponseSequence); ecs.AddEngine(lifterCollection); ecs.AddEngine(lifterMovement); ecs.AddEngine(movingPosition); // a sequence is just a set of "labels" each label can be triggered by the owning engine // and cause the listed engines to receive the messages. landingEventResponseSequence.SetSequence ( new Steps { { // LABEL // owning engine lifterSnap, // when lifterSnap calls "next" the message is delivered "To"... //listed engines new To { lifterCollection //.. lifterCollection } } } ); while (true) { movementPhaser.ScheduleMovement(); yield return(null); } }
public override void SetupEngines(EnginesRoot enginesRoot, IEntityFactory factory, IEntityFunctions functions) { lifterCollectionEngine = new LifterCollectionEngine(); enginesRoot.AddEngine(lifterCollectionEngine); }