예제 #1
0
 public virtual void onCollisionDetected(Map map, MapObject map_object)
 {
 }
예제 #2
0
        /// <summary>
        /// Konwersja tablicy enum-ów na tablice obiektów MapObject
        /// </summary>
        /// <param name="map_obj">zwracana tablica po konwersji</param>
        /// <param name="objects">pobierana tablica int-ów</param>
        private void CovertIntToObjects(ref MapObject[,] map_obj, ElementType[,] objects)
        {
            for (int x = 0; x < width; x++)
                for (int y = 0; y < height; y++)
                {
                    switch (objects[x, y])
                    {
                        case ElementType.AMEBA:
                            map_obj[x, y] = new DestroyableObjects.Ameba(content, new Rectangle(x * tile_size, y * tile_size, tile_size, tile_size), x, y);
                            break;
                        case ElementType.BLOB:
                            map_obj[x, y] = new Characters.Blob(content, new Rectangle(x * tile_size, y * tile_size, tile_size, tile_size), x, y);
                            break;
                        case ElementType.CHODZACABOMBA:
                            map_obj[x, y] = new Characters.ChodzacaBomba(content, new Rectangle(x * tile_size, y * tile_size, tile_size, tile_size), x, y);
                            break;
                        case ElementType.CIEZKIMUR:
                            map_obj[x, y] = new NonDestroyableObjects.CiezkiMur(content, new Rectangle(x * tile_size, y * tile_size, tile_size, tile_size), x, y);
                            break;
                        case ElementType.DYNAMIT:
                            map_obj[x, y] = new Weapon.Dynamit(content, new Rectangle(x * tile_size, y * tile_size, tile_size, tile_size), x, y);
                            break;
                        case ElementType.GIGANTYCZNYSZCZUR:
                            map_obj[x, y] = new Characters.GigantycznySzczur(content, new Rectangle(x * tile_size, y * tile_size, tile_size, tile_size), x, y);
                            break;

                        case ElementType.GOBLIN:
                            map_obj[x, y] = new Characters.Goblin(content, new Rectangle(x * tile_size, y * tile_size, tile_size, tile_size), x, y);
                            break;
                        case ElementType.KAMIEN:
                            map_obj[x, y] = new DestroyableObjects.Kamien(content, new Rectangle(x * tile_size, y * tile_size, tile_size, tile_size), x, y);
                            break;
                        case ElementType.LEKKIMUR:
                            map_obj[x, y] = new DestroyableObjects.LekkiMur(content, new Rectangle(x * tile_size, y * tile_size, tile_size, tile_size), x, y);
                            break;
                        case ElementType.MAGICZNYMUR:
                            map_obj[x, y] = new NonDestroyableObjects.MagicznyMur(content, new Rectangle(x * tile_size, y * tile_size, tile_size, tile_size), x, y);
                            break;
                        case ElementType.MARMUROWYKAMIEN:
                            map_obj[x, y] = new NonDestroyableObjects.MarmurowyKamien(content, new Rectangle(x * tile_size, y * tile_size, tile_size, tile_size), x, y);
                            break;
                        case ElementType.PEKDYNAMITOW:
                            map_obj[x, y] = new Weapon.PekDynamitow(content, new Rectangle(x * tile_size, y * tile_size, tile_size, tile_size), x, y);
                            break;
                        case ElementType.POLESILOWE:
                            map_obj[x, y] = new Weapon.PoleSilowe(content, new Rectangle(x * tile_size, y * tile_size, tile_size, tile_size), x, y);
                            break;
                        case ElementType.PUSTE:
                            map_obj[x, y] = new NonDestroyableObjects.Puste(content, new Rectangle(x * tile_size, y * tile_size, tile_size, tile_size),x,y);
                            break;
                        case ElementType.RACKET:
                            map_obj[x, y] = new Weapon.Racket(content, new Rectangle(x * tile_size, y * tile_size, tile_size, tile_size), x, y);
                            break;
                        case ElementType.RADIOAKTYWNYGLAZ:
                            map_obj[x, y] = new NonDestroyableObjects.RadioaktywnyGlaz(content, new Rectangle(x * tile_size, y * tile_size, tile_size, tile_size), x, y);
                            break;
                        case ElementType.VANDAL:
                            this.vandal  = new Characters.Vandal(content, new Rectangle(x * tile_size, y * tile_size, tile_size, tile_size), x, y);
                            map_obj[x, y] = vandal;
                            break;
                        case ElementType.ZIEMIA:
                            map_obj[x, y] = new DestroyableObjects.Ziemia(content, new Rectangle(x * tile_size, y * tile_size, tile_size, tile_size), x, y);
                            break;
                        case ElementType.CELMISJI:
                            map_obj[x, y] = new DestroyableObjects.CelMisji(content, new Rectangle(x * tile_size, y * tile_size, tile_size, tile_size), x, y, gameLevel);
                            break;
                        case ElementType.BECZKAZGAZEM:
                            map_obj[x, y] = new DestroyableObjects.BeczkaZGazem(content, new Rectangle(x * tile_size, y * tile_size, tile_size, tile_size), x, y);
                            break;
                        case ElementType.NIESTABILNABECZKA:
                            map_obj[x, y] = new DestroyableObjects.NiestabilnaBeczka(content, new Rectangle(x * tile_size, y * tile_size, tile_size, tile_size), x, y);
                            break;
                        default:
                            map_obj[x, y] = new DestroyableObjects.Ziemia(content, new Rectangle(x * tile_size, y * tile_size, tile_size, tile_size), x, y);
                            break;
                    }
                }
        }
예제 #3
0
 /// <summary>
 /// Konwersja tablicy obiektów MapObject na jednowymiarową tablicę intów
 /// Funkcja potzrebna na potzreby serializacji XML
 /// </summary>
 /// <param name="int_obj">Zwracana tablica int-ów</param>
 /// <param name="objects">Pobierana tablica obiektów MaoObject</param>
 private void ConvertObjectsToInt(ref int[] int_obj, MapObject[,] objects)
 {
     for (int x = 0; x < width; x++)
         for (int y = 0; y < height; y++)
                 int_obj[y * width + x] = (int)objects[x, y].TypeTag;
 }
예제 #4
0
 /// <summary>
 /// Ustawienie obiektu na wybranej pozycji
 /// </summary>
 /// <param name="x">Nowa wspolrzedna x na mapie</param>
 /// <param name="y">Nowa wspolrzedna y na mapie</param>
 /// <param name="obj">Obiekt , którego pozycje ustawiamy</param>
 public void setObject(int x, int y, MapObject obj)
 {
     obj.rectangle.X = x * tile_size;
     obj.rectangle.Y = y * tile_size;
     objects[x, y] = obj;
 }
예제 #5
0
 /// <summary>
 /// Ustawienie obiektu na wybranej pozycji
 /// </summary>
 /// <param name="x">Nowa wspolrzedna x na mapie</param>
 /// <param name="y">Nowa wspolrzedna y na mapie</param>
 /// <param name="obj">Obiekt , którego pozycje ustawiamy</param>
 public void setObject(int x, int y, MapObject obj)
 {
     obj.rectangle.X = x * tile_size;
     obj.rectangle.Y = y * tile_size;
     objects[x, y]   = obj;
 }
예제 #6
0
        /// <summary>
        /// Konwersja mapy w postaci tablicy 1-wymairowej (z XML) do tablicy dwywymiarowej obiektów typu MapObject
        /// </summary>
        /// <param name="map_obj">zwracana tablica obiektów</param>
        /// <param name="map">pobierana tablica integerów</param>
        public void CovertSquareIntToObjects(ref MapObject[,] map_obj, int[] map)
        {
            for (int i = 0; i < map.Length; i++)
            {
                int y = i / width;
                int x = i % width;
                switch ((ElementType)map[i])
                {
                    case ElementType.AMEBA:
                        map_obj[x, y] = new DestroyableObjects.Ameba(content, new Rectangle(x * tile_size, y * tile_size, tile_size, tile_size), x, y);
                        break;
                    case ElementType.BECZKAZGAZEM:
                        break;
                    case ElementType.BLOB:
                        map_obj[x, y] = new Characters.Blob(content, new Rectangle(x * tile_size, y * tile_size, tile_size, tile_size), x, y);
                        break;
                    case ElementType.CHODZACABOMBA:
                        map_obj[x, y] = new Characters.ChodzacaBomba(content, new Rectangle(x * tile_size, y * tile_size, tile_size, tile_size), x, y);
                        break;
                    case ElementType.CIEZKIMUR:
                        map_obj[x, y] = new NonDestroyableObjects.CiezkiMur(content, new Rectangle(x * tile_size, y * tile_size, tile_size, tile_size), x, y);
                        break;
                    case ElementType.DYNAMIT:
                        map_obj[x, y] = new Weapon.Dynamit(content, new Rectangle(x * tile_size, y * tile_size, tile_size, tile_size), x, y);
                        break;
                    case ElementType.GIGANTYCZNYSZCZUR:
                        map_obj[x, y] = new Characters.GigantycznySzczur(content, new Rectangle(x * tile_size, y * tile_size, tile_size, tile_size), x, y);
                        break;
                    case ElementType.GOBLIN:
                        map_obj[x, y] = new Characters.Goblin(content, new Rectangle(x * tile_size, y * tile_size, tile_size, tile_size), x, y);
                        break;
                    case ElementType.KAMIEN:
                        map_obj[x, y] = new DestroyableObjects.Kamien(content, new Rectangle(x * tile_size, y * tile_size, tile_size, tile_size), x, y);
                        break;
                    case ElementType.LEKKIMUR:
                        map_obj[x, y] = new DestroyableObjects.LekkiMur(content, new Rectangle(x * tile_size, y * tile_size, tile_size, tile_size), x, y);
                        break;
                    case ElementType.MAGICZNYMUR:
                        map_obj[x, y] = new NonDestroyableObjects.MagicznyMur(content, new Rectangle(x * tile_size, y * tile_size, tile_size, tile_size), x, y);
                        break;
                    case ElementType.MARMUROWYKAMIEN:
                        map_obj[x, y] = new NonDestroyableObjects.MarmurowyKamien(content, new Rectangle(x * tile_size, y * tile_size, tile_size, tile_size), x, y);
                        break;
                    case ElementType.NIESTABILNABECZKA:
                        break;
                    case ElementType.PEKDYNAMITOW:
                        map_obj[x, y] = new Weapon.PekDynamitow(content, new Rectangle(x * tile_size, y * tile_size, tile_size, tile_size), x, y);
                        break;
                    case ElementType.POLESILOWE:
                        map_obj[x, y] = new Weapon.PoleSilowe(content, new Rectangle(x * tile_size, y * tile_size, tile_size, tile_size), x, y);
                        break;
                    case ElementType.PUSTE:
                        map_obj[x, y] = new NonDestroyableObjects.Puste(content, new Rectangle(x * tile_size, y * tile_size, tile_size, tile_size),x,y);
                        break;
                    case ElementType.RACKET:
                        map_obj[x, y] = new Weapon.Racket(content, new Rectangle(x * tile_size, y * tile_size, tile_size, tile_size), x, y);
                        break;
                    case ElementType.RADIOAKTYWNYGLAZ:
                        map_obj[x, y] = new NonDestroyableObjects.RadioaktywnyGlaz(content, new Rectangle(x * tile_size, y * tile_size, tile_size, tile_size), x, y);
                        break;
                    case ElementType.VANDAL:
                        this.vandal = new Characters.Vandal(content, new Rectangle(x * tile_size, y * tile_size, tile_size, tile_size), x, y);
                        map_obj[x, y] = vandal;
                        break;
                    case ElementType.ZIEMIA:
                        map_obj[x, y] = new DestroyableObjects.Ziemia(content, new Rectangle(x * tile_size, y * tile_size, tile_size, tile_size), x, y, player.IntelligenceLevel);
                        break;
                    case ElementType.CELMISJI:
                        map_obj[x, y] = new DestroyableObjects.CelMisji(content, new Rectangle(x * tile_size, y * tile_size, tile_size, tile_size), x, y, gameLevel, player.IntelligenceLevel);
                        break;
                    default:
                        map_obj[x, y] = new DestroyableObjects.Ziemia(content, new Rectangle(x * tile_size, y * tile_size, tile_size, tile_size), x, y, player.IntelligenceLevel);
                        break;

                }
            }
        }