Ejemplo n.º 1
0
        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
            });
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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
            });
        }