コード例 #1
0
 public PlayerMovementSimulator(Level level, ScatteredPlayer player)
 {
     NoclipMode            = false;
     this.level            = level;
     this.player           = player;
     oldPlayerPos          = player.Position;
     playerMovementService = new PlayerMovementService(level, new IslandRaycastingService(level));
 }
コード例 #2
0
 public Level(OptimizedWorldOctree <IRenderable> worldOctree)
 {
     this.worldOctree = worldOctree;
     createItemTypes();
     Node = new SceneGraphNode();
     Node.AssociatedObject = this;
     LocalPlayer           = new ScatteredPlayer(this, Node.CreateChild());
 }
コード例 #3
0
        /*[Test]
         * public void TestCoreGame()
         * {
         *  var level = new Level();
         *  var player = level.LocalPlayer;
         *  addPlaySimulators(level, player);
         *
         *  Action<Island> addBridge = il => il.AddAddon(new Bridge(level, il.Node.CreateChild()).Alter(b => b.Node.Relative = Matrix.Translation(0, 0, 8)));
         *
         *  Island i;
         *
         *  player.Position = new Vector3(0, 3, 0);
         *
         *  i = level.CreateNewIsland(new Vector3(0, 0, 0));
         *  addBridge(i);
         *  i.AddAddon(new FlightEngine(level, i.Node.CreateChild(), level.CoalType));
         *
         *
         *  i = level.CreateNewIsland(new Vector3(10, 0, 0));
         *  addBridge(i);
         *
         *  i = level.CreateNewIsland(new Vector3(20, 0, 0));
         *  addBridge(i);
         *  i.AddAddon(new Enemy(level, i.Node.CreateChild(), new Vector3(),
         *      (position, direction, speed, lifetime) => new Bullet(level, level.Node.CreateChild(), position, direction, speed, lifetime))
         *      .Alter(e => e.Node.Relative = Matrix.Translation(Vector3.UnitY * 3)));
         *
         *  i = level.CreateNewIsland(new Vector3(30, 0, 0));
         *  addBridge(i);
         *  var crystalItem = new ItemType() { Mesh = TW.Assets.LoadMesh("Scattered\\Models\\Items\\CrystalItem"), Name = "Crystal" };
         *  i.AddAddon(new Storage(level, i.Node.CreateChild())
         *      .Alter(s => s.Inventory.AddNewItems(crystalItem, 4)));
         *
         *  i = level.CreateNewIsland(new Vector3(40, 0, 0));
         *  addBridge(i);
         *  i.AddAddon(new ResourceGenerator(level, i.Node.CreateChild(), crystalItem));
         *
         *  i = level.CreateNewIsland(new Vector3(50, 0, 0));
         *  addBridge(i);
         *  i.AddAddon(new Tower(level, i.Node.CreateChild()));
         *
         *
         *
         *  //engine.AddSimulator(new AudioSimulator());
         * }*/

        private void addPlaySimulators(Level level, ScatteredPlayer player)
        {
            throw new NotImplementedException();
            //engine.AddSimulator(new PlayerMovementSimulator(level, player));
            //engine.AddSimulator(new PlayerInteractionService(level, player));
            //engine.AddSimulator(new GameSimulationService(level));
            //engine.AddSimulator(new ClusterPhysicsService(level));
            //engine.AddSimulator(new PlayerCameraSimulator(player));

            //engine.AddSimulator(new ScatteredRenderingSimulator(level, () => level.EntityNodes,
            //                                                    () => level.Islands.SelectMany(c => c.Addons)));
            //engine.AddSimulator(new WorldRenderingSimulator());
            //engine.AddSimulator(new AudioSimulator());
        }
コード例 #4
0
 public PlayerInteractionService(Level level, ScatteredPlayer player)
 {
     this.level  = level;
     this.player = player;
 }
コード例 #5
0
 public PlayerCameraSimulator(ScatteredPlayer player)
 {
     this.player    = player;
     camEntity      = new Entity();
     firstPersonSim = new ThirdPersonCameraSimulator();
 }