コード例 #1
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(Game.GraphicsDevice);

            player = new PlayerSprite(
                Game.Content.Load <Texture2D>(@"Textures\Sprites\Player"),
                GameSetting.PointToVector2(GameSetting.PlayerStartPosition), //position
                GameSetting.PlayerSpeed,
                GameSetting.TileSize,                                        // dimensions
                new Point(1, 1),                                             // sheet size
                gameMap
                );

            guard = new GuardSprite(
                Game.Content.Load <Texture2D>(@"Textures\Sprites\Guard"),
                new Vector2(30 * 22, 30 * 4), //position
                GameSetting.PlayerSpeed,
                GameSetting.TileSize,         // dimensions
                new Point(1, 1),              // sheet size
                gameMap,
                this
                );

            base.LoadContent();
        }
コード例 #2
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(Game.GraphicsDevice);

            player = new PlayerSprite(
                Game.Content.Load<Texture2D>(@"Textures\Sprites\Player"),
                GameSetting.ConvertPointToVector2(GameSetting.PlayerStartPosition), //position
                GameSetting.PlayerSpeed,
                GameSetting.TileSize, // dimensions
                new Point(1, 1), // sheet size
                gameMap
                );

            // Roam Guard
            List<Point> RoamGuardsStartPointList = new List<Point>();
            RoamGuardsStartPointList.Add(new Point(11, 5));
            RoamGuardsStartPointList.Add(new Point(3, 5));
            for (int i = 0; i < RoamGuardsStartPointList.Count; i++)
            {
                GuardSprite roamGuard = new GuardSprite(
                        Game.Content.Load<Texture2D>(@"Textures\Sprites\GuardSupervisor"),
                        GameSetting.ConvertPointToVector2(RoamGuardsStartPointList[i]),  //position
                        GameSetting.GuardSpeed,
                        GameSetting.TileSize, // dimensions
                        new Point(1, 1), // sheet size
                        gameMap,
                        this,
                        new List<String>(),
                        false
                    );
                GuardsList.Add(roamGuard);
            }

            // Patrol Guards
            List<List<String>> PatrolGuardsPathList = new List<List<String>>();
            List<Point> PatrolGuardsStartPointList = new List<Point>();

            List<String> PatrolPathList_1 = new List<String>();
            PatrolPathList_1.Add("D4");
            PatrolPathList_1.Add("R6");
            PatrolPathList_1.Add("U4");
            PatrolGuardsPathList.Add(PatrolPathList_1);
            PatrolGuardsStartPointList.Add(new Point(1, 1));

            List<String> PatrolPathList_2 = new List<String>();
            PatrolPathList_2.Add("R16");
            PatrolPathList_2.Add("D1");
            PatrolPathList_2.Add("L5");
            PatrolGuardsPathList.Add(PatrolPathList_2);
            PatrolGuardsStartPointList.Add(new Point(11, 4));

            for (int i = 0; i < PatrolGuardsPathList.Count; i++)
            {
                GuardSprite patrolGuard = new GuardSprite(
                    Game.Content.Load<Texture2D>(@"Textures\Sprites\Guard"),
                    GameSetting.ConvertPointToVector2(PatrolGuardsStartPointList[i]),  //position
                    GameSetting.PlayerSpeed,
                    GameSetting.TileSize, // dimensions
                    new Point(1, 1), // sheet size
                    gameMap,
                    this,
                    PatrolGuardsPathList[i],
                    true
                );
                GuardsList.Add(patrolGuard);
            }

            base.LoadContent();
        }
コード例 #3
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(Game.GraphicsDevice);

            player = new PlayerSprite(
                Game.Content.Load<Texture2D>(@"Textures\Sprites\Player"),
                GameSetting.PointToVector2(GameSetting.PlayerStartPosition), //position
                GameSetting.PlayerSpeed,
                GameSetting.TileSize, // dimensions
                new Point(1, 1), // sheet size
                gameMap
                );

            guard = new GuardSprite(
                Game.Content.Load<Texture2D>(@"Textures\Sprites\Guard"),
                new Vector2(30 * 22, 30 * 4),  //position
                GameSetting.PlayerSpeed,
                GameSetting.TileSize, // dimensions
                new Point(1, 1), // sheet size
                gameMap,
                this
                );

            base.LoadContent();
        }