コード例 #1
0
ファイル: Game1.cs プロジェクト: negimakun/ClickMoveClass
        /// <summary>
        /// 初期化処理(起動時、コンストラクタの後に1度だけ呼ばれる)
        /// </summary>
        protected override void Initialize()
        {
            // この下にロジックを記述
            player = new Player();
            camp   = new Camp();

            players = new List <Player>();
            players.Add(player);

            wall  = new Wall(new Vector2(500, 200), new Rectangle(0, 0, 10 * 50, 10 * 50));
            walls = new List <Wall>();
            walls.Add(wall);

            Top    = new EnemyLevel1(Direction.TOP, camp, players, walls);
            Bottom = new EnemyLevel1(Direction.BOTTOM, camp, players, walls);
            Right  = new EnemyLevel1(Direction.RIGHT, camp, players, walls);
            Left   = new EnemyLevel1(Direction.LEFT, camp, players, walls);

            eL1List = new List <EnemyLevel1>();
            eL1List.Add(Top);
            eL1List.Add(Bottom);
            eL1List.Add(Right);
            eL1List.Add(Left);

            foreach (var el1 in eL1List)
            {
                el1.Initialze();
            }

            // この上にロジックを記述
            base.Initialize();// 親クラスの初期化処理呼び出し。絶対に消すな!!
        }
コード例 #2
0
 public static bool WallXEnemy(Wall wall, EnemyLevel1 el1)
 {
     if (wall.position.X <= el1.enemyMovePos.X + el1.TextureSize &&//壁の左側
         wall.position.X + wall.rectangle.Width >= el1.enemyMovePos.X - el1.TextureSize &&//壁の右側
         wall.position.Y + wall.rectangle.Height >= el1.enemyMovePos.Y - el1.TextureSize && //壁の下側
         wall.position.Y <= el1.enemyMovePos.Y + el1.TextureSize)                           //壁の上側
     {
         return(true);                                                                      //当たってる
     }
     return(false);
 }
コード例 #3
0
 public static bool WallXEnemy(Wall wall, EnemyLevel1 el1)
 {
     if (wall.position.X <= el1.enemyPos.X + el1.TextureSize &&
         wall.position.X + wall.rectangle.Width >= el1.enemyPos.X)
     {
         if (wall.position.Y + wall.rectangle.Height >= el1.enemyPos.Y &&
             wall.position.Y <= el1.enemyPos.Y + el1.TextureSize)
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #4
0
 public static Direction WallXEnemyDirection(Wall wall, EnemyLevel1 el1)
 {
     if (wall.position.X + wall.rectangle.Width <= el1.enemyPos.X)
     {//壁の右側(進行方向は左)
         return(Direction.LEFT);
     }
     else if (wall.position.X >= el1.enemyPos.X + el1.TextureSize)
     {//壁の左側(進行方向は右)
         return(Direction.RIGHT);
     }
     else if (wall.position.Y >= el1.enemyPos.Y + el1.TextureSize)
     {//壁の上側(進行方向は下)
         return(Direction.BOTTOM);
     }
     else if (wall.position.Y + wall.rectangle.Height >= el1.enemyPos.Y)
     {//壁の側(進行方向は)
         return(Direction.TOP);
     }
     return(Direction.NULL);
 }
コード例 #5
0
        /// <summary>
        /// 初期化処理(起動時、コンストラクタの後に1度だけ呼ばれる)
        /// </summary>
        protected override void Initialize()
        {
            // この下にロジックを記述
            gameDevice = GameDevice.Instance(Content, GraphicsDevice);

            bgmLoader = new BGMLoader(new string[, ] {
                { "gamePlay", "./Sound/" }
            });


            CSVReader csvReader = new CSVReader();

            csvReader.Read("spawn.csv");



            unchis = new List <Unchi>();
            player = new Player();
            camp   = new Camp();

            players = new List <Player>();
            players.Add(player);

            wall  = new Wall(new Vector2(700, 200), new Rectangle(0, 0, 10 * 50, 1 * 50));
            walls = new List <Wall>();
            walls.Add(wall);
            walls.Add(new Wall(new Vector2(500, 400), new Rectangle(0, 0, 2 * 50, 5 * 50)));
            walls.Add(new Wall(new Vector2(700, 800), new Rectangle(0, 0, 8 * 50, 1 * 50)));
            walls.Add(new Wall(new Vector2(1200, 400), new Rectangle(0, 0, 2 * 50, 5 * 50)));

            foreach (var wa in walls)
            {
                wa.Initialize();
            }

            Top    = new EnemyLevel1(Direction.TOP, camp, players, walls, 0, unchis);
            Bottom = new EnemyLevel1(Direction.BOTTOM, camp, players, walls, 1, unchis);
            Right  = new EnemyLevel1(Direction.RIGHT, camp, players, walls, 5, unchis);
            Left   = new EnemyLevel1(Direction.LEFT, camp, players, walls, 9, unchis);

            eL1List = new List <EnemyLevel1>();
            eL1List.Add(Top);
            eL1List.Add(Bottom);
            eL1List.Add(Right);
            eL1List.Add(Left);

            EnemyCSVParser parser   = new EnemyCSVParser(camp, players, walls, unchis);
            var            dataList = parser.Parse("spawn.csv", "./");

            foreach (var data in dataList)
            {
                eL1List.Add(data);
            }


            foreach (var el1 in eL1List)
            {
                el1.Initialze();
            }


            // この上にロジックを記述
            base.Initialize();// 親クラスの初期化処理呼び出し。絶対に消すな!!
        }