Пример #1
0
 public GameSimulationService(Level level, EnemySpawningService enemySpawningService, PlayerInteractionService interactionService, ClusterPhysicsService clusterPhysicsService)
 {
     this.level = level;
     this.enemySpawningService  = enemySpawningService;
     this.interactionService    = interactionService;
     this.clusterPhysicsService = clusterPhysicsService;
 }
Пример #2
0
        private Level setupRendering()
        {
            var level = createLevel();


            var cam = TW.Data.Get <CameraInfo>();

            cam.Mode = CameraInfo.CameraMode.ThirdPerson;

            var camEntity = new Entity();

            cam.ThirdPersonCameraTarget = camEntity;

            var phys = new ClusterPhysicsService(level);

            var controller = new ClusterFlightController(TW.Graphics.Keyboard);

            engine.AddSimulator(new BasicSimulator(() =>
            {
                controller.SimulateFlightStep(cameraIsland, cameraIsland.GetForward(), cameraIsland.Position);
                camEntity.WorldMatrix =
                    Matrix.Translation(
                        cameraIsland.GetIslandsInCluster().Aggregate(new Vector3(), (acc, el) => acc + el.Position) /
                        cameraIsland.GetIslandsInCluster().Count());

                phys.UpdateClusterMovement();
            }));

            engine.AddSimulator(new ThirdPersonCameraSimulator());

            //engine.AddSimulator(new LoadLevelSimulator(level));
            engine.AddSimulator(new WorldRenderingSimulator());
            return(level);
        }
 public ScatteredGame(PlayerMovementSimulator playerMovementSimulator,
                      PlayerInteractionService playerInteractionService,
                      ClusterPhysicsService clusterPhysicsService,
                      PlayerCameraSimulator playerCameraSimulator,
                      ScatteredRenderingSimulator scatteredRenderingSimulator,
                      WorldGenerationService gen,
                      GameSimulationService gameSimulationService)
 {
     PlayerMovementSimulator          = playerMovementSimulator;
     this.playerInteractionService    = playerInteractionService;
     this.clusterPhysicsService       = clusterPhysicsService;
     this.PlayerCameraSimulator       = playerCameraSimulator;
     this.ScatteredRenderingSimulator = scatteredRenderingSimulator;
     this.gen = gen;
     this.gameSimulationService = gameSimulationService;
 }