Ejemplo n.º 1
0
 public void DestorySIde(BaseDimension dimension, int xDoor, int yDoor)
 {
     for (var i = 0; i <= 3; i++)
     {
         dimension.Reset(xDoor, yDoor - i);
     }
 }
Ejemplo n.º 2
0
        public override void Update(int x, int y, BaseDimension dimension, bool isView)
        {
            switch (Id)
            {
            case 27:
                if (isView)
                {
                    return;
                }
                if (dimension.Rand.Next(0, 3) != 0)
                {
                    return;
                }
                var direction = dimension.Rand.Next(0, 2);
                switch (direction)
                {
                case 0:
                    AddTexture(x + 1, y, dimension);
                    break;

                case 1:
                    AddTexture(x + 1, y, dimension);
                    break;
                }
                break;

            case 32 when dimension.MapTile[x, y].IdSubTexture < 3:
                if (dimension.MapTile[x, y].TimeCount % 120 != 110)
                {
                    return;
                }
                dimension.MapTile[x, y].IdSubTexture++;
                break;
            }
        }
Ejemplo n.º 3
0
        public override List <Item> Destory(int x, int y, BaseDimension dimension, DynamicEntity entity)
        {
            List <Item> itemDrop = new List <Item>();
            var         procent  = Program.Game.Player.Carma / 100.0f;

            switch (Id)
            {
            case 27:
                if (Program.Game.Rand.Next(100) < (int)(80 * procent))
                {
                    itemDrop.Add(new Item(1, 50));
                }
                else if (Program.Game.Rand.Next(100) < (int)(90 * procent))
                {
                    itemDrop.Add(new Item(1, 19));
                }
                break;

            case 32 when dimension.MapTile[x, y].IdSubTexture == 3:
                var minValue = 2 + (int)(4 * procent);
                itemDrop.Add(new Item(dimension.Rand.Next(minValue, minValue + minValue / 2), 51));
                itemDrop.Add(new Item(dimension.Rand.Next(minValue, minValue + minValue * 2), 50));
                break;
            }
            return(itemDrop);
        }
Ejemplo n.º 4
0
        public override List <Item> Destory(int x, int y, BaseDimension dimension, DynamicEntity entity)
        {
            var yDoor = y;

            yDoor -= dimension.MapTile[x, y].IdSubTexture;
            DestorySIde(dimension, x, yDoor);
            return(base.Destory(x, y, dimension, entity));
        }
Ejemplo n.º 5
0
 public override bool BlockAdded(BaseDimension dimension, int x, int y)
 {
     if (dimension.MapTile[x, y - 1].Active)
     {
         return(false);
     }
     dimension.SetTexture(x, y - 1, Id, 1); return(true);
 }
Ejemplo n.º 6
0
 public override void Update(int x, int y, BaseDimension dimension, DynamicEntity entity)
 {
     if (dimension.MapTile[x, y + 1].Active)
     {
         return;
     }
     dimension.MapTile[x, y].Destory(x, y, entity);
 }
Ejemplo n.º 7
0
 public override void Spawn(BaseDimension dimension)
 {
     for (var i = 0; i < 2; i++)
     {
         for (var j = 0; j < 2; j++)
         {
             dimension.SetTexture(X + i, j + Y, 35);
         }
     }
 }
Ejemplo n.º 8
0
 public void Destory(BaseDimension dimension)
 {
     Program.Game.AddExplosion(Position);
     if (TypeBullet == 1)
     {
         dimension.SetTexture((
                                  int)Math.Floor(OldPosition.X / Tile.TILE_MAX_SIZE),
                              (int)Math.Floor(OldPosition.Y / Tile.TILE_MAX_SIZE), 1);
     }
 }
Ejemplo n.º 9
0
        /// <summary>
        /// Determines whether the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>.
        /// </summary>
        /// <param name="obj">The <see cref="T:System.Object"/> to compare with the current <see cref="T:System.Object"/>.</param>
        /// <returns>
        /// true if the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>; otherwise, false.
        /// </returns>
        /// <exception cref="T:System.NullReferenceException">
        /// The <paramref name="obj"/> parameter is null.
        /// </exception>
        public override bool Equals(object obj)
        {
            QualifiedDimension asQualifiedDimension;

            if ((asQualifiedDimension = obj as QualifiedDimension) == null)
            {
                return(false);
            }
            return(BaseDimension.Equals(asQualifiedDimension.BaseDimension) &&
                   Path.SequenceEqual(asQualifiedDimension.Path));
        }
Ejemplo n.º 10
0
 public override void Update(int x, int y, BaseDimension dimension, DynamicEntity entity)
 {
     if (dimension.MapTile[x, y + 1].Active)
     {
         return;
     }
     if (entity is Player player)
     {
         player.GetDrop(x, y);
     }
 }
Ejemplo n.º 11
0
 public static bool GetActive(BaseDimension dimension, int x, int y)
 {
     if (x < 0 || x >= SizeGeneratior.WorldWidth)
     {
         return(false);
     }
     if (y < 0 || y >= SizeGeneratior.WorldHeight)
     {
         return(false);
     }
     return(dimension.MapTile[x, y].Active);
 }
Ejemplo n.º 12
0
        public override bool UseBlock(int x, int y, BaseDimension dimension, DynamicEntity entity)
        {
            var xDoor  = x;
            var yDoor  = y + (2 - dimension.MapTile[x, y].IdSubTexture);
            int idDoor = dimension.MapTile[xDoor, yDoor].IdTexture;

            for (var j = 0; j < 3; j++)
            {
                dimension.Reset(xDoor, yDoor - j);
            }
            dimension.AddDoor(idDoor, xDoor, yDoor, true);
            return(true);
        }
Ejemplo n.º 13
0
 public override void Spawn(BaseDimension dimension)
 {
     for (var i = 0; i < SIZEX; i++)
     {
         if (X + i + 1 >= SizeGeneratior.WorldWidth)
         {
             continue;
         }
         for (var j = 0; j < SIZEY; j++)
         {
             if (j != 0 || Math.Abs(Y - j - dimension.MapHeight[X + i + 1]) < 1)
             {
                 dimension.Reset(X + i, Y - j);
             }
         }
     }
     for (var i = -5; i < 5; i++)
     {
         for (var j = -5; j < 5; j++)
         {
             if (Tools.InRadious(X + 5 + i, Y + 5 + j, X + 5, Y + 5, 5 - 1, true))
             {
                 dimension.SetTexture(X + 5 + i, Y - 5 + j, 12);
             }
         }
     }
     dimension.MapTile[X + SIZEX / 2, Y - SIZEY / 2].IdPoster = 0;
     for (var i = 0; i < SIZEX - 1; i++)
     {
         for (var j = 1; j < SIZEY - 1; j++)
         {
             dimension.MapTile[X + i, Y - j].IdWall = 9;
         }
     }
     for (var i = 0; i < SIZEX; i++)
     {
         dimension.SetTexture(X + i, Y, 9);
         dimension.SetTexture(X + i, Y - (SIZEY - 1), 9);
     }
     for (var j = 4; j < SIZEY; j++)
     {
         dimension.SetTexture(X, Y - j, 9);
         dimension.SetTexture(X + (SIZEX - 1), Y - j, 9);
     }
     if (!Isplaying)
     {
         dimension.Zombies.Add(new Boss(new Vector2((X + 2) * Tile.TILE_MAX_SIZE, (Y - 10) * Tile.TILE_MAX_SIZE)));
     }
     dimension.SetTexture(X + 1, Y - (SIZEY - 2), 6);
     dimension.SetTexture(X + (SIZEX - 2), Y - (SIZEY - 2), 6);
 }
Ejemplo n.º 14
0
        public override List <Item> Destory(int x, int y, BaseDimension dimension, DynamicEntity entity)
        {
            if (Id == 19)
            {
                dimension.Reset(x - 1, y);
            }
            else
            {
                dimension.Reset(x + 1, y);
            }
            List <Item> drop = new List <Item> {
                new Item(1, 26)
            };

            return(drop);
        }
Ejemplo n.º 15
0
 public Tile(BaseDimension dimension)
 {
     _dimension   = dimension;
     IdWall       = -1;
     IdPoster     = -1;
     Blockheight  = 1;
     WaterType    = 0;
     Frame        = 0;
     IdSubTexture = 0;
     Active       = false;
     Light        = 0;
     IdTexture    = 0;
     Hp           = 0;
     TileDate     = null;
     TimeCount    = 0;
 }
Ejemplo n.º 16
0
        public override List <Item> Destory(int x, int y, BaseDimension dimension, DynamicEntity entity)
        {
            if (dimension.MapTile[x, y].IdSubTexture == 0)
            {
                dimension.Reset(x, y - 1);
            }
            else
            {
                dimension.Reset(x, y + 1);
            }
            List <Item> drop = new List <Item> {
                new Item(1, 27)
            };

            return(drop);
        }
Ejemplo n.º 17
0
        public void AddTexture(int newX, int newY, BaseDimension dimension)
        {
            if (newX < 0 || newX >= SizeGeneratior.WorldWidth)
            {
                return;
            }
            if (dimension.MapTile[newX, newY].Active)
            {
                return;
            }
            if (!dimension.MapTile[newX, newY + 1].IsSolid())
            {
                return;
            }

            dimension.SetTexture(newX, newY, Id);
        }
Ejemplo n.º 18
0
        public override bool UseBlock(int x, int y, BaseDimension dimension, DynamicEntity entity)
        {
            var xDoor  = x;
            var yDoor  = y + (2 - dimension.MapTile[x, y].IdSubTexture);
            int iddoor = dimension.MapTile[xDoor, yDoor].IdTexture;

            if (dimension.MapTile[xDoor, yDoor].IdTexture == dimension.MapTile[xDoor - 1, yDoor].IdTexture)
            {
                xDoor -= 1;
            }
            for (var i = 0; i < 2; i++)
            {
                for (var j = 0; j < 3; j++)
                {
                    dimension.Reset(xDoor + i, yDoor - j);
                }
            }
            dimension.AddDoor(iddoor - 1, xDoor, yDoor, false);
            return(true);
        }
Ejemplo n.º 19
0
 public virtual List <Item> Destory(int x, int y, BaseDimension dimension, DynamicEntity entity) => new List <Item>
 {
     new Item(1, Id)
 };
Ejemplo n.º 20
0
 public virtual bool UseBlock(int x, int y, BaseDimension dimension, DynamicEntity entity) => false;
Ejemplo n.º 21
0
 public virtual void Update(int x, int y, BaseDimension dimension, bool isView)
 {
 }
Ejemplo n.º 22
0
 public virtual void Update(int x, int y, BaseDimension dimension, DynamicEntity entity)
 {
 }
Ejemplo n.º 23
0
 public override bool UseBlock(int x, int y, BaseDimension dimension, DynamicEntity entity)
 {
     ((Player)entity).TeleportToShowMap();
     return(true);
 }
Ejemplo n.º 24
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="other"></param>
 protected BaseDimension(BaseDimension other)
     : base(other)
 {
 }
Ejemplo n.º 25
0
 public override void Render(ITileDatecs tileDate, Render render, Texture2D texture, BaseDimension dimension, Vector2 pos, int x, int y, int frame, int subTexture, ColorScheme color)
 {
     if (dimension.MapTile[x, y].IdTexture == dimension.MapTile[x - 1, y].IdTexture)
     {
         frame += 1;
     }
     base.Render(tileDate, render, texture, dimension, pos, x, y, frame, subTexture, color);
 }
Ejemplo n.º 26
0
 public virtual void Render(ITileDatecs tileDate, Render render, Texture2D texture, BaseDimension dimension, Vector2 pos, int x, int y, int frame, int subTexture, ColorScheme color)
 {
     lock (Locked)
     {
         render.Draw(texture, new Rectangle((int)pos.X, (int)pos.Y, 16, 16), new Rectangle(16 * frame, 16 * subTexture, 16, 16), color);
     }
 }
Ejemplo n.º 27
0
 public virtual void Spawn(BaseDimension dimension)
 {
 }
Ejemplo n.º 28
0
 public virtual bool BlockAdded(BaseDimension dimension, int x, int y) => true;
Ejemplo n.º 29
0
        public override void Render(ITileDatecs tileDate, Render render, Texture2D texture, BaseDimension dimension, Vector2 pos, int x, int y, int frame, int subTexture, ColorScheme color)
        {
            TreeDate treeDate = (TreeDate)tileDate;

            if (dimension.MapTile[x, y].IdTexture == 16)
            {
                render.Draw(texture, new Rectangle((int)pos.X - 25, (int)pos.Y - 42, 64, 64), new Rectangle(64 * frame, 64 * treeDate.TypeTree, 64, 64), color);
            }
            else if (dimension.MapTile[x, y].IdTexture == 38)
            {
                render.Draw(texture, new Rectangle((int)pos.X, (int)pos.Y, 16, 16), new Rectangle(16 * subTexture, 16 * treeDate.TypeTree, 16, 16), color);
            }
            else
            {
                base.Render(tileDate, render, texture, dimension, pos, x, y, frame, subTexture, color);
            }
        }
Ejemplo n.º 30
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="other"></param>
 protected BaseDimension(BaseDimension other)
     : base(other)
 {
 }
Ejemplo n.º 31
0
 public override bool UseBlock(int x, int y, BaseDimension dimension, DynamicEntity entity) => true;