コード例 #1
0
        public WorldComponent(DemoGame game)
            : base(game)
        {
            _game = game;

            _game.World = new World
            {
                Boxes = new List<Box>(),
            };

            _game.World.Units = new List<Unit>
            {
                new Player(_game)
                {
                    Position = new Vector3(50f,10f,50f)
                },
                new Warrior(_game)
                {
                    Position = new Vector3(60f,0f,60f)
                },
                new Warrior(_game)
                {
                    Position = new Vector3(70f,0f,70f)
                },
                new Warrior(_game)
                {
                    Position = new Vector3(80f,0f,80f)
                }
            };

            _game.World.Terrain = new Terrain(_game, 100, 100)
            {
                LandTexture = _game.Content.Load<Texture2D>("land")
            };
        }
コード例 #2
0
 public DebugInfoComponent(DagonGame game, Unit player)
     : base(game)
 {
     _spriteBatch = new SpriteBatch(game.GraphicsDevice);
     _font = game.Content.Load<SpriteFont>("arial");
     _unit = player;
     _fps = 0;
     _frameCounter = 0;
 }
コード例 #3
0
        public FreeCamera(DagonGame game)
        {
            _projection = Matrix.CreatePerspectiveFieldOfView(
                game.Settings.FieldOfView,
                game.GraphicsDevice.Viewport.AspectRatio,
                0.1f,
                game.Settings.RangeOfVisibility);

            _view = Matrix.CreateLookAt(new Vector3(8, 3, 8), new Vector3(5, 3, 5), Vector3.Up);
        }
コード例 #4
0
        public FirstPersonCamera(DagonGame game, Unit unit)
        {
            _unit = unit;

            _projection = Matrix.CreatePerspectiveFieldOfView(
                game.Settings.FieldOfView,
                game.GraphicsDevice.Viewport.AspectRatio,
                0.1f,
                game.Settings.RangeOfVisibility);
        }
コード例 #5
0
        public AxiesComponent(DagonGame game)
            : base(game)
        {
            _game = game;
            _basicEffect = new BasicEffect(game.GraphicsDevice) { VertexColorEnabled = true };

            vertexData = new VertexPositionColor[6];
            vertexData[0] = new VertexPositionColor(new Vector3(0f, 0f, 0f), Color.Red);
            vertexData[1] = new VertexPositionColor(new Vector3(Length, 0f, 0f), Color.Red);

            vertexData[2] = new VertexPositionColor(new Vector3(0f, 0f, 0f), Color.Green);
            vertexData[3] = new VertexPositionColor(new Vector3(0f, Length, 0f), Color.Green);

            vertexData[4] = new VertexPositionColor(new Vector3(0f, 0f, 0f), Color.Blue);
            vertexData[5] = new VertexPositionColor(new Vector3(0f, 0f, Length), Color.Blue);
        }
コード例 #6
0
        public SpriteUnit(DagonGame game, Texture2D texture)
            : base(game)
        {
            _texture = texture;
            _spriteBatch = new SpriteBatch(_game.GraphicsDevice);
            _basicEffect = new BasicEffect(_game.GraphicsDevice)
            {
                TextureEnabled = true,
                VertexColorEnabled = true,

                FogEnabled = true,
                FogStart = game.Settings.RangeOfVisibility / 3f,
                FogEnd = game.Settings.RangeOfVisibility,
                FogColor = game.World.SkyColor.ToVector3()
            };
        }
コード例 #7
0
ファイル: Player.cs プロジェクト: DagonGD/DagonGraphicEngine
 public Player(DagonGame game)
     : base(game)
 {
 }
コード例 #8
0
ファイル: Warrior.cs プロジェクト: DagonGD/DagonGraphicEngine
 public Warrior(DagonGame game)
     : base(game, game.Content.Load<Texture2D>("warrior"))
 {
     Speed = 0.001f;
 }