コード例 #1
0
ファイル: TerrainTest.cs プロジェクト: jwvdiermen/LD28
        public void LoadContent()
        {
            _spriteBatch = new SpriteBatch(_graphics);

            _world = new StaticEntityWorld(_game.Services);

            var pp = _graphics.PresentationParameters;
            _camera = new DefaultCamera(null, new Viewport(0, 0, pp.BackBufferWidth, pp.BackBufferHeight));
            _cameraNode = _world.Scene.Root.CreateChild("Camera");
            _cameraNode.Position = new Vector3(_camera.ScreenSize / 2.0f, 0.0f);
            _cameraNode.Scale = new Vector3(.5f);
            _cameraNode.Attach(_camera);

            // Create the tile map.
            _terrain = new Terrain(new Vector2(102.4f, 102.4f), 51.2f, 9);
            _terrain.DebugEnabled = true;
            _world.Add(_terrain);

            // Create the circle brush.
            _circleBrush = new CircleBrush(2.5f);

            _circleBrushNode = _world.Scene.CreateSceneNode();
            _circleBrushNode.Attach(new CircleRenderable(2.5f, 64)
            {
                Color = Vector3.One
            });
        }
コード例 #2
0
ファイル: TerrainTest.cs プロジェクト: jwvdiermen/LD28
        public void LoadContent()
        {
            _spriteBatch = new SpriteBatch(_graphics);

            _world = new StaticEntityWorld(_game.Services);

            var pp = _graphics.PresentationParameters;

            _camera              = new DefaultCamera(null, new Viewport(0, 0, pp.BackBufferWidth, pp.BackBufferHeight));
            _cameraNode          = _world.Scene.Root.CreateChild("Camera");
            _cameraNode.Position = new Vector3(_camera.ScreenSize / 2.0f, 0.0f);
            _cameraNode.Scale    = new Vector3(.5f);
            _cameraNode.Attach(_camera);

            // Create the tile map.
            _terrain = new Terrain(new Vector2(102.4f, 102.4f), 51.2f, 9);
            _terrain.DebugEnabled = true;
            _world.Add(_terrain);

            // Create the circle brush.
            _circleBrush = new CircleBrush(2.5f);

            _circleBrushNode = _world.Scene.CreateSceneNode();
            _circleBrushNode.Attach(new CircleRenderable(2.5f, 64)
            {
                Color = Vector3.One
            });
        }
コード例 #3
0
ファイル: Terrain.cs プロジェクト: jwvdiermen/LD28
 protected override void OnWorldChanged(IEntityWorld world)
 {
     if (_blockGrid != null)
     {
         foreach (var quadTree in _blockGrid)
         {
             quadTree.World = world;
         }
     }
 }
コード例 #4
0
        public ScatteredGame()
        {
            graphics = new GraphicsDeviceManager(this);
            graphics.PreferredBackBufferWidth  = Width;
            graphics.PreferredBackBufferHeight = Height;

            IsFixedTimeStep = false;
            graphics.SynchronizeWithVerticalRetrace = false;

            entityWorld = EntityManagerFactory.CreateEntityWorld(256, 256, BitmaskSize.Bit32);

            IsMouseVisible = true;
        }
コード例 #5
0
ファイル: Payload.cs プロジェクト: jwvdiermen/LD28
        protected override void OnWorldChanged(IEntityWorld world)
        {
            DestroyPhysics();

            if (world != null)
            {
                _physicsWorld = ((DynamicEntityWorld)world).PhysicsWorld;
                InitializePhysics();
            }
            else
            {
                _physicsWorld = null;
            }
        }
コード例 #6
0
ファイル: Payload.cs プロジェクト: jwvdiermen/LD28
        protected override void OnWorldChanged(IEntityWorld world)
        {
            DestroyPhysics();

            if (world != null)
            {
                _physicsWorld = ((DynamicEntityWorld)world).PhysicsWorld;
                InitializePhysics();
            }
            else
            {
                _physicsWorld = null;
            }
        }
コード例 #7
0
ファイル: Entity.cs プロジェクト: tipfom/quasi_
 public Entity Create(Vector2 spawnLocation, IEntityWorld world, bool liftPosition = true)
 {
     if (Species == -1 || Components.HasChanged)
     {
         Species = ++currentSpecies;
         entityNames.Add(Species, Name);
         Components.ResolveComponentDependencies( );
         Components.Sort( );
     }
     if (liftPosition)
     {
         spawnLocation += new Vector2(0, Transform.HalfSize.Y);
     }
     return(new Entity(Components, new Transform(spawnLocation, Transform.Size), world, Species));
 }
コード例 #8
0
ファイル: Entity.cs プロジェクト: tipfom/quasi_
        public Entity(ComponentList Components, Transform Transform, IEntityWorld World, int Species)
        {
            this.World     = World;
            this.Transform = Transform;
            this.Species   = Species;
            this.ID        = ++currentInstance;

            for (int i = 0; i < pendingComponentInfos.Length; i++)
            {
                pendingComponentInfos[i] = new Queue <object[]>( );
            }

            this.Components = new Component[Components.Count];
            for (int i = 0; i < this.Components.Length; i++)
            {
                this.Components[i] = Components[i].Create(this);
            }

            World.Add(this);
        }
コード例 #9
0
ファイル: Terrain.cs プロジェクト: jwvdiermen/LD28
 protected override void OnWorldChanged(IEntityWorld world)
 {
     if (_blockGrid != null)
     {
         foreach (var quadTree in _blockGrid)
         {
             quadTree.World = world;
         }
     }
 }
コード例 #10
0
 public EntityFactory(RenderingSystem renderingSystem, IEntityWorld entityManager)
 {
     this.renderingSystem = renderingSystem;
     this.entityManager   = entityManager;
 }
コード例 #11
0
 /// <summary>
 /// Creates a new ComponentMapper instance associated with the specified entity world.
 /// </summary>
 /// <param name="world">Entity world instance to associate with.</param>
 public ComponentMapper(IEntityWorld world)
 {
     _world         = world;
     _componentType = ComponentTypeManager.GetTypeFor <T>();
 }
コード例 #12
0
ファイル: EntityBase.cs プロジェクト: jwvdiermen/LD28
 /// <summary>
 /// This method is called when a new world has been set for the entity.
 /// </summary>
 /// <param name="world">The new world. Can be null.</param>
 protected virtual void OnWorldChanged(IEntityWorld world)
 {
 }
コード例 #13
0
ファイル: ChainElement.cs プロジェクト: jwvdiermen/LD28
 protected override void OnWorldChanged(IEntityWorld world)
 {
     DestroyPhysics();
 }
コード例 #14
0
ファイル: ChainElement.cs プロジェクト: jwvdiermen/LD28
 protected override void OnWorldChanged(IEntityWorld world)
 {
     DestroyPhysics();
 }