当前位置: 首页>>代码示例>>C#>>正文


C# Map.setObject方法代码示例

本文整理汇总了C#中Map.setObject方法的典型用法代码示例。如果您正苦于以下问题:C# Map.setObject方法的具体用法?C# Map.setObject怎么用?C# Map.setObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Map的用法示例。


在下文中一共展示了Map.setObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MoveInDirection

 /// <summary>
 /// Poruszanie w określonym kierunku
 /// </summary>
 /// <param name="add_x">Zmiana indeksu x na tablicy obiektów</param>
 /// <param name="add_y">Zmiana indeksu y na tablicy obiektów </param>
 /// <param name="map">Mapa obiektów</param>
 public void MoveInDirection(int add_x, int add_y, Map.Map map)
 {
     int new_x = x + add_x;
     int new_y = y + add_y;
     collision_obj = map.getObject(new_x, new_y);
     if (collision_obj.GetType() == typeof(NonDestroyableObjects.Puste) || collision_obj.GetType() == typeof(DestroyableObjects.Ziemia))
     {
         map.setObject(new_x, new_y, this);
         map.setObject(x, y, new NonDestroyableObjects.Puste(content, new Rectangle(x * this.rectangle.Width, y * this.rectangle.Height, this.rectangle.Width, this.rectangle.Height),x,y));
         x = new_x;
         y = new_y;
     }
 }
开发者ID:kuzawskak,项目名称:DungeonVandal,代码行数:19,代码来源:Enemy.cs

示例2: Update

        /// <summary>
        /// Aktualizacja stanu (uzalezniona od stanu sasiadujacych komórek na mapie)
        /// </summary>
        /// <param name="gametime"></param>
        /// <param name="map"></param>
        public override void Update(GameTime gametime,Map.Map map)
        {
            int x_index = rectangle.X / rectangle.Width;
             int y_index = rectangle.Y / rectangle.Height;
             if (y_index == map.getHeight() - 1)
             {
                 if (is_falling)
                 {
                     MessageBox.Show(x_index.ToString() + "  " + y_index.ToString());
                     map.setObject(x_index, y_index, this);
                     map.setObject(x_index, y_index - 1, new NonDestroyableObjects.Puste(content, rectangle, x_index, y_index - 1));
                     is_falling = false;
                     return;
                 }
                 else
                     return;
             }
             if (is_falling)
             {

                 //nie spadl calkowice jeszcze na odpowiedni prosokat
                 if (rectangle.Y % rectangle.Height != 0)
                 {
                     Spadaj();
                 }
                 else
                 {
                     map.setObject(x_index, y_index, this);
                     map.setObject(x_index, y_index - 1, new NonDestroyableObjects.Puste(content, rectangle, x_index, y_index - 1));
                     if (y_index < map.getHeight() - 1 && map.getObject(x_index, y_index + 1).GetType() == typeof(NonDestroyableObjects.Puste))
                     {
                         Spadaj();
                     }
                     else is_falling = false;
                 }
             }
             else if (map.getObject(x_index, y_index + 1).GetType() == typeof(NonDestroyableObjects.Puste)&& !map.is_vandal_on_rectangle(x_index, y_index + 1))
             {//rozpoczecie spadania
                 is_falling = true;
                 Spadaj();
             }
        }
开发者ID:kuzawskak,项目名称:DungeonVandal,代码行数:47,代码来源:MarmurowyKamien.cs

示例3: Przesun

        /// <summary>
        /// Przesuwanie 
        /// </summary>
        /// <param name="map"> Aktualna mapa obiektów</param>
        /// <param name="x_vel">Predkość w poziomie</param>
        /// <returns></returns>
        public bool Przesun(Map.Map map, int x_vel)
        {
            if (map.vandal != null)
            {
                if (map.GetVandalDirection() == Game.direction.left && map.getObject((int)(x_vel / this.Rectangle.Width) - 1, (int)(map.getVandalRectangle().Y / map.getVandalRectangle().Height)).GetType() == typeof(NonDestroyableObjects.Puste))
                {
                    if ((x_vel) % this.rectangle.Width == 0)
                    {
                        int x_ind = (int)(x_vel / this.Rectangle.Width);
                        int y_ind = (int)(this.Rectangle.Y / this.Rectangle.Height);
                        map.setObject(x_ind, y_ind, this);
                        map.setObject(x_ind + 1, y_ind, new NonDestroyableObjects.Puste(content, new Rectangle((x_ind + 1) * this.rectangle.Width, y_ind * this.Rectangle.Height, this.rectangle.Width, this.rectangle.Width), x_ind + 1, y_ind));

                    }

                    rectangle.X = x_vel;
                    return true;

                }
                if (map.GetVandalDirection() == Game.direction.right && map.getObject((int)(x_vel / this.Rectangle.Width), (int)(map.getVandalRectangle().Y / map.getVandalRectangle().Height)).GetType() == typeof(NonDestroyableObjects.Puste))
                {
                    if ((x_vel) % this.rectangle.Width == 0)
                    {
                        int x_ind = (int)(x_vel / this.Rectangle.Width);
                        int y_ind = (int)(this.Rectangle.Y / this.Rectangle.Height);
                        map.setObject(x_ind - 1, y_ind, this);
                        map.setObject(x_ind, y_ind, new NonDestroyableObjects.Puste(content, new Rectangle((x_ind - 1) * this.rectangle.Width, y_ind * this.Rectangle.Height, this.rectangle.Width, this.rectangle.Width), x_ind, y_ind));
                    }
                    rectangle.X = x_vel;
                    return true;
                }
            }
            return false;
        }
开发者ID:kuzawskak,项目名称:DungeonVandal,代码行数:40,代码来源:Kamien.cs

示例4: Update

        /// <summary>
        /// Aktualizacja stanu na mapie z uwzględnieniem spadania
        /// </summary>
        /// <param name="gametime"></param>
        /// <param name="map"></param>
        public override void Update(GameTime gametime, Map.Map map)
        {
            if (explode)
            {
                if (current_frame == 16) { die = true; explode = false; }
                else
                    src_rectangle = new Rectangle((current_frame++) * 64, 0, 64, 64);
            }
            else if (die)
            {
                map.setObject(x, y, new NonDestroyableObjects.Puste(content, this.Rectangle, x, y));
            }
            else
            {
                int x_index = rectangle.X / rectangle.Width;
                int y_index = rectangle.Y / rectangle.Height;

                //sprawdzenie wszytkich dookola pol
                if (map.is_vandal_on_rectangle(x_index - 1, y_index) ||
                    map.is_vandal_on_rectangle(x_index + 1, y_index) ||
                    map.is_vandal_on_rectangle(x_index, y_index - 1) ||
                    map.is_vandal_on_rectangle(x_index, y_index + 1) ||
                    map.is_vandal_on_rectangle(x_index - 1, y_index - 1) ||
                    map.is_vandal_on_rectangle(x_index - 1, y_index + 1) ||
                    map.is_vandal_on_rectangle(x_index + 1, y_index + 1) ||
                    map.is_vandal_on_rectangle(x_index + 1, y_index - 1))
                {
                    Zabij(map);
                    return;
                }

                if (y_index == map.getHeight() - 1)
                {
                    if (is_falling)
                    {
                        map.setObject(x_index, y_index, this);
                        this.x = x_index;
                        this.y = y_index;
                        map.setObject(x_index, y_index - 1, new NonDestroyableObjects.Puste(content, rectangle, x_index, y_index - 1));
                        is_falling = false;
                        return;
                    }
                    else return;
                }
                if (is_falling)
                {
                    //nie spadl calkowice jeszcze na odpowiedni prosokat
                    if (rectangle.Y % rectangle.Height != 0)
                    {
                        Spadaj();
                    }
                    else
                    {
                        map.setObject(x_index, y_index, this);
                        this.x = x_index;
                        this.y = y_index;
                        map.setObject(x_index, y_index - 1, new NonDestroyableObjects.Puste(content, rectangle, x_index, y_index - 1));
                        if (y_index < map.getHeight() - 1 && map.getObject(x_index, y_index + 1).GetType() == typeof(NonDestroyableObjects.Puste))
                        {
                            Spadaj();
                        }
                        else is_falling = false;
                    }
                }
                else if (map.getObject(x_index, y_index + 1).GetType() == typeof(NonDestroyableObjects.Puste) && !map.is_vandal_on_rectangle(x_index, y_index + 1))
                {//rozpoczecie spadania
                    is_falling = true;
                    Spadaj();
                }
                else return;
            }
        }
开发者ID:kuzawskak,项目名称:DungeonVandal-new,代码行数:77,代码来源:NiestabilnaBeczka.cs

示例5: CreateNewAmeba

 /// <summary>
 /// Stworzenie nowej ameby na dostepnym miejscu
 /// </summary>
 /// <param name="map">mapa obiektow</param>
 void CreateNewAmeba(Map.Map map)
 {
     //losuj dostepne puste miejsce
     if (available_tiles.Capacity > 0)
     {
         int random_pos = rand.Next(0, available_tiles.Capacity - 1);
         map.setObject(available_tiles[random_pos].x, available_tiles[random_pos].y, new DestroyableObjects.Ameba(content, new Rectangle(available_tiles[random_pos].x * rectangle.Width, available_tiles[random_pos].y * rectangle.Height, rectangle.Width, rectangle.Height), available_tiles[random_pos].x, available_tiles[random_pos].y));
     }
 }
开发者ID:kuzawskak,项目名称:DungeonVandal-new,代码行数:13,代码来源:Ameba.cs

示例6: Przesun

        /// <summary>
        /// Przesuwanie 
        /// </summary>
        /// <param name="map"> Aktualna mapa obiektów</param>
        /// <param name="x_vel">Predkość w poziomie</param>
        /// <returns>czy moze byc przesuniety</returns>
        public bool Przesun(Map.Map map, int x_vel)
        {
            if (map.getObject(x + x_vel, y).GetType() == typeof(NonDestroyableObjects.Puste))
            {

                map.setObject(x + x_vel, y, this);
                this.x = x + x_vel;
                this.y = y;
                return true;
            }
            else return false;
        }
开发者ID:kuzawskak,项目名称:DungeonVandal-new,代码行数:18,代码来源:BeczkaZGazem.cs

示例7: Update

        /// <summary>
        /// Aktualizacja stanu rakiety
        /// </summary>
        /// <param name="gametime">Czas gry</param>
        /// <param name="map">Mapa obiektów</param>
        public override void Update(GameTime gametime, Map.Map map)
        {
            if (gametime.TotalGameTime.Milliseconds % 20 == 0 && is_fired)
            {

                int collision_x = x;
                int collision_y = y;
                switch (direction)
                {
                    case Game.direction.down:
                        texture = content.Load<Texture2D>("Textures\\racket_down");
                        collision_x = x;
                        collision_y = y + 1;

                        break;
                    case Game.direction.up:
                        texture = content.Load<Texture2D>("Textures\\racket_up");
                        collision_x = x;
                        collision_y = y - 1;

                        break;
                    case Game.direction.left:
                        texture = content.Load<Texture2D>("Textures\\racket_left");
                        collision_x = x - 1;
                        collision_y = y;

                        break;
                    case Game.direction.right:
                        texture = content.Load<Texture2D>("Textures\\racket_right");
                        collision_x = x + 1;
                        collision_y = y;

                        break;
                }

                if (map.getObject(collision_x, collision_y).GetType() != typeof(NonDestroyableObjects.Puste) && map.getObject(collision_x, collision_y) != this)
                {

                    if (map.player.Rackets > 0)
                    {

                        map.addPlayersRacket(-1);

                        //explosion
                        SoundEffect explosion_sound = content.Load<SoundEffect>("Audio\\explosion_sound");
                        if (!map.player.AudioSettings.IsMuted)
                        {
                            SoundEffect.MasterVolume = (float)map.player.AudioSettings.SoundVolume;
                            explosion_sound.Play();
                        }
                        int vandal_x = map.GetVandal().x;
                        int vandal_y = map.GetVandal().y;

                        Map.MapObject
                            obj = map.getObject(x - 1, y - 1);
                        if (obj is Zniszczalny) (obj as Zniszczalny).OnDestroy(map);
                        else if (obj.GetType().IsSubclassOf(typeof(Characters.Enemy)))
                            (obj as Characters.Enemy).Die(map);
                        obj = map.getObject(x - 1, y + 1);
                        if (obj is Zniszczalny) (obj as Zniszczalny).OnDestroy(map);
                        else if (obj.GetType().IsSubclassOf(typeof(Characters.Enemy)))
                            (obj as Characters.Enemy).Die(map);
                        obj = map.getObject(x - 1, y);
                        if (obj is Zniszczalny) (obj as Zniszczalny).OnDestroy(map);
                        else if (obj.GetType().IsSubclassOf(typeof(Characters.Enemy)))
                            (obj as Characters.Enemy).Die(map);
                        obj = map.getObject(x, y - 1);
                        if (obj is Zniszczalny) (obj as Zniszczalny).OnDestroy(map);
                        else if (obj.GetType().IsSubclassOf(typeof(Characters.Enemy)))
                            (obj as Characters.Enemy).Die(map);
                        obj = map.getObject(x, y + 1);
                        if (obj is Zniszczalny) (obj as Zniszczalny).OnDestroy(map);
                        else if (obj.GetType().IsSubclassOf(typeof(Characters.Enemy)))
                            (obj as Characters.Enemy).Die(map);
                        obj = map.getObject(x + 1, y);
                        if (obj is Zniszczalny) (obj as Zniszczalny).OnDestroy(map);
                        else if (obj.GetType().IsSubclassOf(typeof(Characters.Enemy)))
                            (obj as Characters.Enemy).Die(map);
                        obj = map.getObject(x + 1, y - 1);
                        if (obj is Zniszczalny) (obj as Zniszczalny).OnDestroy(map);
                        else if (obj.GetType().IsSubclassOf(typeof(Characters.Enemy)))
                            (obj as Characters.Enemy).Die(map);
                        obj = map.getObject(x + 1, y + 1);
                        if (obj is Zniszczalny) (obj as Zniszczalny).OnDestroy(map);
                        else if (obj.GetType().IsSubclassOf(typeof(Characters.Enemy)))
                            (obj as Characters.Enemy).Die(map);

                        //miejsce w ktorym rakieta sie zatrzymala
                        map.setObject(x, y, new NonDestroyableObjects.Puste(content, this.rectangle, x, y));

                    }
                }
                else
                {
                    map.setObject(collision_x, collision_y, this);
//.........这里部分代码省略.........
开发者ID:kuzawskak,项目名称:DungeonVandal-new,代码行数:101,代码来源:Racket.cs

示例8: Die

 /// <summary>
 /// Reakcja na zabicie
 /// Zostawia na swoim miejscu pole ameby
 /// </summary>
 /// <param name="map"></param>
 public void Die(Map.Map map)
 {
     map.setObject(x,y,new DestroyableObjects.Ameba(content, new Rectangle(x * this.rectangle.Width, y * this.rectangle.Height, this.rectangle.Width, this.rectangle.Height), x, y));
 }
开发者ID:kuzawskak,项目名称:DungeonVandal,代码行数:9,代码来源:Blob.cs

示例9: Update

        /// <summary>
        /// Aktualizacja stanu rakiety
        /// </summary>
        /// <param name="gametime">Czas gry</param>
        /// <param name="map">Mapa obiektów</param>
        public override void Update(GameTime gametime, Map.Map map)
        {
            if (gametime.TotalGameTime.Milliseconds % 20 == 0 && is_fired)
            {

                int collision_x = x;
                int collision_y = y;
                switch (direction)
                {
                    case Game.direction.down:
                        texture = content.Load<Texture2D>("Textures\\racket_down");
                        collision_x = x;
                        collision_y = y + 1;
                        break;
                    case Game.direction.up:
                        texture = content.Load<Texture2D>("Textures\\racket_up");
                        collision_x = x;
                        collision_y = y - 1;
                        break;
                    case Game.direction.left:
                        texture = content.Load<Texture2D>("Textures\\racket_left");
                        collision_x = x - 1;
                        collision_y = y;
                        break;
                    case Game.direction.right:
                        texture = content.Load<Texture2D>("Textures\\racket_right");
                        collision_x = x + 1;
                        collision_y = y;
                        break;
                }

                if (map.getObject(collision_x, collision_y).GetType() != typeof(NonDestroyableObjects.Puste) && map.getObject(collision_x, collision_y) != this)
                {
                    //explosion
                     SoundEffect explosion_sound = content.Load<SoundEffect>("Audio\\explosion_sound");
                     explosion_sound.Play();
                     int vandal_x = map.GetVandal().x;
                     int vandal_y = map.GetVandal().y;
                    //TODO: dodac sprawdzanie czy nie wykraczamy indeksow w mapie i czy obiekt nie jest niezniszczalny
                    //tak naprawde powinno sie to zmienic na wywolanie onDestroy dla kazdego z tych obiektow!!!!!!!!!!
                    if(x-1!=vandal_x&&y!=vandal_y&&map.getObject(x-1,y) is Zniszczalny)
                    map.setObject(x - 1, y, new NonDestroyableObjects.Puste(content, new Rectangle((x - 1) * rectangle.Width, y * rectangle.Height, rectangle.Width, rectangle.Height), x - 1, y));
                    if (x - 1 != vandal_x && y+1 != vandal_y && map.getObject(x - 1, y+1) is Zniszczalny)
                    map.setObject(x - 1, y + 1, new NonDestroyableObjects.Puste(content, new Rectangle((x - 1) * rectangle.Width, (y + 1) * rectangle.Height, rectangle.Width, rectangle.Height), x - 1, y + 1));
                    if (x - 1 != vandal_x && y-1 != vandal_y && map.getObject(x - 1, y-1) is Zniszczalny)
                    map.setObject(x - 1, y - 1, new NonDestroyableObjects.Puste(content, new Rectangle((x - 1) * rectangle.Width, (y - 1) * rectangle.Height, rectangle.Width, rectangle.Height), x - 1, y - 1));

                    if (x  != vandal_x && y-1 != vandal_y && map.getObject(x , y-1) is Zniszczalny)
                    map.setObject(x, y - 1, new NonDestroyableObjects.Puste(content, new Rectangle((x) * rectangle.Width, (y - 1) * rectangle.Height, rectangle.Width, rectangle.Height), x, y - 1));
                    if (x  != vandal_x && y+1 != vandal_y && map.getObject(x , y+1) is Zniszczalny)
                    map.setObject(x, y + 1, new NonDestroyableObjects.Puste(content, new Rectangle((x) * rectangle.Width, (y + 1) * rectangle.Height, rectangle.Width, rectangle.Height), x, y + 1));
                    if (x  != vandal_x && y != vandal_y && map.getObject(x , y) is Zniszczalny)
                    map.setObject(x, y, new NonDestroyableObjects.Puste(content, new Rectangle((x) * rectangle.Width, y * rectangle.Height, rectangle.Width, rectangle.Height), x, y));

                    if (x + 1 != vandal_x && y != vandal_y && map.getObject(x + 1, y) is Zniszczalny)
                    map.setObject(x + 1, y, new NonDestroyableObjects.Puste(content, new Rectangle((x + 1) * rectangle.Width, y * rectangle.Height, rectangle.Width, rectangle.Height), x + 1, y));
                    if (x + 1 != vandal_x && y+1 != vandal_y && map.getObject(x + 1, y+1) is Zniszczalny)
                    map.setObject(x + 1, y + 1, new NonDestroyableObjects.Puste(content, new Rectangle((x + 1) * rectangle.Width, (y + 1) * rectangle.Height, rectangle.Width, rectangle.Height), x + 1, y + 1));
                    if (x + 1 != vandal_x && y -1!= vandal_y && map.getObject(x + 1, y-1) is Zniszczalny)
                    map.setObject(x + 1, y - 1, new NonDestroyableObjects.Puste(content, new Rectangle((x + 1) * rectangle.Width, (y + 1) * rectangle.Height, rectangle.Width, rectangle.Height), x + 1, y - 1));

                   // if (x != vandal_x && y  != vandal_y && map.getObject(x , y ) is Zniszczalny)
                    map.setObject(x, y, new NonDestroyableObjects.Puste(content, this.rectangle, x, y));
                }
                else
                {
                    map.setObject(collision_x, collision_y, this);
                    map.setObject(x, y, new NonDestroyableObjects.Puste(content, this.rectangle, x, y));
                    this.x = collision_x;
                    this.y = collision_y;

                }
            }
        }
开发者ID:kuzawskak,项目名称:DungeonVandal,代码行数:79,代码来源:Racket.cs

示例10: MoveInDirection

        /// <summary>
        /// Poruszanie w wyznaczonym kierunku
        /// </summary>
        /// <param name="add_x">przyrost indeksu w poziomie</param>
        /// <param name="add_y">przyrost indeksu w pionie</param>
        /// <param name="map">mapa obiektow</param>
        public void MoveInDirection(int add_x, int add_y, Map.Map map)
        {
            int new_x = x + add_x;
            int new_y = y + add_y;
            collision_obj = map.getObject(new_x, new_y);
            if (collision_obj.IsAccesible)
            {
                if (collision_obj is Weapon.Weapon)
                {
                    (collision_obj as Weapon.Weapon).OnFound(map);
                }

                if (collision_obj is Zniszczalny)
                    (collision_obj as Zniszczalny).OnDestroy(map);

                map.setObject(new_x, new_y, this);
                if (!(collision_obj is Eteryczny))
                    map.setObject(x, y, new NonDestroyableObjects.Puste(content, new Rectangle(x * this.rectangle.Width, y * this.rectangle.Height, this.rectangle.Width, this.rectangle.Height), x, y));

                x = new_x;
                y = new_y;
            }
            else if (add_y == 0 && collision_obj is Przesuwalny && (collision_obj as Przesuwalny).Przesun(map, add_x))
            {
                map.setObject(x, y, new NonDestroyableObjects.Puste(content, new Rectangle(x * this.rectangle.Width, y * this.rectangle.Height, this.rectangle.Width, this.rectangle.Height), x, y));
                map.setObject(new_x, new_y, this);
                x = new_x;
                y = new_y;
            }
            else if (!map.GetVandal().is_immortal && collision_obj.GetType().IsSubclassOf(typeof(Characters.Enemy)))
            {
                this.is_alive = false;
            }
        }
开发者ID:kuzawskak,项目名称:DungeonVandal-new,代码行数:40,代码来源:Vandal.cs

示例11: LeftDynamite

        /// <summary>
        /// Upusc dynamit
        /// </summary>
        /// <param name="game_map">mapa obiektow</param>
        /// <param name="gametime">czas gry</param>
        public void LeftDynamite(Map.Map game_map, GameTime gametime)
        {
            int dyn_x = x - 1;
            int dyn_y = y;
            switch (view_direction)
            {
                case Game.direction.right:
                    dyn_x = x - 1;
                    dyn_y = y;
                    break;
                case Game.direction.left:
                    dyn_x = x + 1;
                    dyn_y = y;
                    break;
                case Game.direction.up:
                    dyn_x = x;
                    dyn_y = y + 1;
                    break;
                case Game.direction.down:
                    dyn_x = x;
                    dyn_y = y - 1;
                    break;

            }

            //nie zmieniamy pozycji Vandala (wstawiamy dynamit za Vandalem)
            collision_obj = game_map.getObject(dyn_x, dyn_y);
            if (collision_obj.GetType() == typeof(NonDestroyableObjects.Puste))
            {
                game_map.setObject(dyn_x, dyn_y, new Weapon.Dynamit(content, new Rectangle(dyn_x * this.rectangle.Width, dyn_y * this.rectangle.Height, this.rectangle.Width, this.rectangle.Height), dyn_x, dyn_y, gametime));
                game_map.addPlayersDynamites(-1);
            }
        }
开发者ID:kuzawskak,项目名称:DungeonVandal-new,代码行数:38,代码来源:Vandal.cs

示例12: AttackWithRacket

        /// <summary>
        /// Wystrzel rakiete
        /// </summary>
        /// <param name="game_map">mapa obiektow</param>
        public void AttackWithRacket(Map.Map game_map)
        {
            Map.MapObject collision_obj = null;
            switch (view_direction)
            {
                case Game.direction.down:
                    collision_obj = game_map.getObject(x, y + 1);
                    break;
                case Game.direction.up:
                    collision_obj = game_map.getObject(x, y - 1);
                    break;
                case Game.direction.right:
                    collision_obj = game_map.getObject(x + 1, y);
                    break;
                case Game.direction.left:
                    collision_obj = game_map.getObject(x - 1, y);
                    break;
            }

            if (collision_obj != null && (collision_obj.GetType() == typeof(NonDestroyableObjects.Puste) || collision_obj.IsAccesible))
            {

                Map.MapObject racket = new Weapon.Racket(content, collision_obj.rectangle, collision_obj.x, collision_obj.y, view_direction);
                game_map.setObject(collision_obj.x, collision_obj.y, racket);

                SoundEffect fire_racket_effect = content.Load<SoundEffect>("Audio\\fire_racket");
                if (!game_map.player.AudioSettings.IsMuted)
                {
                    SoundEffect.MasterVolume = (float)game_map.player.AudioSettings.SoundVolume;
                    fire_racket_effect.Play();
                }
            }
        }
开发者ID:kuzawskak,项目名称:DungeonVandal-new,代码行数:37,代码来源:Vandal.cs

示例13: MoveInDirection

        public void MoveInDirection(int add_x, int add_y, Map.Map map)
        {
            int new_x = x + add_x;
            int new_y = y + add_y;
            collision_obj = map.getObject(new_x, new_y);
            if (collision_obj.IsAccesible)
            {
                if (collision_obj is Weapon.Weapon)
                {
                    (collision_obj as Weapon.Weapon).OnFound(map);
                }

                if (collision_obj is Zniszczalny)
                    (collision_obj as Zniszczalny).OnDestroy(map);

                map.setObject(new_x, new_y, this);
                if (!(collision_obj is Eteryczny))
                    map.setObject(x, y, new NonDestroyableObjects.Puste(content, new Rectangle(x * this.rectangle.Width, y * this.rectangle.Height, this.rectangle.Width, this.rectangle.Height),x,y));

                x = new_x;
                y = new_y;
            }
        }
开发者ID:kuzawskak,项目名称:DungeonVandal,代码行数:23,代码来源:Vandal.cs

示例14: LeftDynamite

        /// <summary>
        /// Upusc dynamit
        /// </summary>
        /// <param name="game_map"></param>
        /// <param name="gametime"></param>
        public void LeftDynamite(Map.Map game_map, GameTime gametime)
        {
            current_direction = Game.direction.right;
            int new_x = x + 1;
            int new_y = y + 0;
            collision_obj = game_map.getObject(new_x, new_y);

            if (collision_obj is Zniszczalny)
                (collision_obj as Zniszczalny).OnDestroy(game_map);

            game_map.setObject(new_x, new_y, this);
            game_map.setObject(x, y, new Weapon.Dynamit(content, new Rectangle(x * this.rectangle.Width, y * this.rectangle.Height, this.rectangle.Width, this.rectangle.Height), x, y, gametime));

            x = new_x;
            y = new_y;

            game_map.addPlayersDynamites(-1);
        }
开发者ID:kuzawskak,项目名称:DungeonVandal,代码行数:23,代码来源:Vandal.cs

示例15: FireBomb

 public void FireBomb(Map.Map map)
 {
     map.setObject((int)(rectangle.X / rectangle.Width), (int)(rectangle.Y / rectangle.Height), new NonDestroyableObjects.Puste(content, this.Rectangle, (int)(rectangle.X / rectangle.Width), (int)(rectangle.Y / rectangle.Height)));
     // map.RemoveCharacter(this);
 }
开发者ID:kuzawskak,项目名称:DungeonVandal,代码行数:5,代码来源:GigantycznySzczur.cs


注:本文中的Map.setObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。