Esempio n. 1
0
        public ObjectGeneric[,] Movimiento(ObjectGeneric[,] Dungeon, int x, int y, int size)
        {
            char     Mov = Console.ReadKey().KeyChar;
            TextInfo ti  = CultureInfo.CurrentCulture.TextInfo;

            Mov = ti.ToUpper(Mov);

            if (comprobar(Mov, size - 1, x, y, Dungeon))
            {
                switch (Mov)
                {
                case 'W':
                    Dungeon[x - 1, y] = Dungeon[x, y];
                    Dungeon[x, y]     = new ObjectsNulls(' ');
                    break;

                case 'A':
                    Dungeon[x, y - 1] = Dungeon[x, y];
                    Dungeon[x, y]     = new ObjectsNulls(' ');
                    break;

                case 'S':
                    Dungeon[x + 1, y] = Dungeon[x, y];
                    Dungeon[x, y]     = new ObjectsNulls(' ');
                    break;

                case 'D':
                    Dungeon[x, y + 1] = Dungeon[x, y];
                    Dungeon[x, y]     = new ObjectsNulls(' ');
                    break;
                }
            }
            return(Dungeon);
        }
Esempio n. 2
0
        public ObjectGeneric[,] Movimiento(ObjectGeneric[,] Dungeon, int x, int y, int size)
        {
            Random sc  = new Random();
            int    Mov = sc.Next(1, 5);

            if (comprobar(Mov, size - 1, x, y, Dungeon))
            {
                switch (Mov)
                {
                case 1:
                    Dungeon[x - 1, y] = Dungeon[x, y];
                    Dungeon[x, y]     = new ObjectsNulls(' ');
                    break;

                case 2:
                    Dungeon[x, y - 1] = Dungeon[x, y];
                    Dungeon[x, y]     = new ObjectsNulls(' ');
                    break;

                case 3:
                    Dungeon[x + 1, y] = Dungeon[x, y];
                    Dungeon[x, y]     = new ObjectsNulls(' ');
                    break;

                case 4:
                    Dungeon[x, y + 1] = Dungeon[x, y];
                    Dungeon[x, y]     = new ObjectsNulls(' ');
                    break;
                }
            }
            return(Dungeon);
        }
Esempio n. 3
0
 private void InicializarDungeon(ObjectGeneric[,] dungeon)
 {
     for (int x = 0; x < Size; x++)
     {
         for (int y = 0; y < Size; y++)
         {
             Dungeon[x, y] = new ObjectsNulls(' ');
         }
     }
 }