Terraria.HitTile.HitTileObject.Clear C# (CSharp) Method

Clear() public method

public Clear ( ) : void
return void
            public void Clear()
            {
                this.X = 0;
                this.Y = 0;
                this.damage = 0;
                this.type = 0;
                this.timeToLive = 0;
                if (HitTile.rand == null)
                    HitTile.rand = new Random((int)DateTime.Now.Ticks);
                this.crackStyle = HitTile.rand.Next(4);
                while (this.crackStyle == HitTile.lastCrack)
                    this.crackStyle = HitTile.rand.Next(4);
                HitTile.lastCrack = this.crackStyle;
            }
        }

Usage Example

Example #1
0
        public void Prune()
        {
            bool flag = false;

            for (int i = 0; i <= 10; i++)
            {
                HitTile.HitTileObject hitTileObject = this.data[i];
                if (hitTileObject.type != 0)
                {
                    Tile tile = Main.tile[hitTileObject.X, hitTileObject.Y];
                    if (hitTileObject.timeToLive > 1)
                    {
                        HitTile.HitTileObject hitTileObject1 = hitTileObject;
                        hitTileObject1.timeToLive = hitTileObject1.timeToLive - 1;
                        if (hitTileObject.type == 1)
                        {
                            if (!tile.active())
                            {
                                hitTileObject.Clear();
                                flag = true;
                            }
                        }
                        else if (tile.wall == 0)
                        {
                            hitTileObject.Clear();
                            flag = true;
                        }
                    }
                    else
                    {
                        hitTileObject.Clear();
                        flag = true;
                    }
                }
            }
            if (!flag)
            {
                return;
            }
            int num = 1;

            while (flag)
            {
                flag = false;
                for (int j = num; j < 10; j++)
                {
                    if (this.data[this.order[j]].type == 0 && this.data[this.order[j + 1]].type != 0)
                    {
                        int num1 = this.order[j];
                        this.order[j]     = this.order[j + 1];
                        this.order[j + 1] = num1;
                        flag = true;
                    }
                }
            }
        }
All Usage Examples Of Terraria.HitTile.HitTileObject::Clear
HitTile.HitTileObject