public void Hurt(float damages, Coordinates position, Level level)
        {
            var dmg = level.GetTileData(position, "damages", 0f) + damages;

            if (dmg > MaxDamages)
            {
                level.SetTile(position, ReplacementTile);
                level.ClearTileDataAt(position);
                AttachedTile.Tag <DroppableTile>()?.Drop(position, level);
            }
            else
            {
                level.SetTileData(position, "damages", dmg);
            }
        }
示例#2
0
 public void Break(Coordinates position, Level level)
 {
     level.SetTile(position, ReplacementTile);
     level.ClearTileDataAt(position);
     AttachedTile.Tag <DroppableTile>()?.Drop(position, level);
 }