convert unity script to phaser js typescript // cellTile
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class cellTile
{
	public enum CONTAINS
	{
		nothing,
		monster,
		sword,
		heart,
		coin,
		exit,
		food,
		trap,
		chest,
		starterNode,
		lootBag,
		biomStop,
		npc,
		lever,
		minigame,
		questObject,
		barrel,
		slot
	}

	public enum BIOMTYPE
	{
		none,
		castle
	}

	private int _hp = 1;

	public GameObject iconSpriteObj;

	public GameObject selfObject;

	public GameObject container;

	public tk2dSprite selfSprite;

	public tk2dSprite incognitaSprite;

	public baseObject bsObjScript;

	public string sprOpenedTileID;

	public string sprClosedTileID;

	public int id;

	public int row;

	public int column;

	public CONTAINS _contains;

	public bool filled;

	public bool opened;

	public bool blocked;

	public bool passible;

	public bool canPass;

	public bool consumable;

	public bool openedFromAmbush;

	public cellTile parentCell;

	public tk2dSprite crackSprite;

	public BoxCollider bCollider;

	public BIOMTYPE biomType;

	private int _F;

	private int _G;

	private int _H;

	public List<GameObject> markPrefab = new List<GameObject>();

	public int hp
	{
		get
		{
			return _hp;
		}
		set
		{
			_hp = value;
			if (hp <= 0)
			{
				Open();
				if (crackSprite != null && crackSprite.gameObject.active)
				{
					crackSprite.gameObject.active = false;
				}
			}
			else
			{
				Harm();
			}
		}
	}

	public int F
	{
		get
		{
			return _F;
		}
		set
		{
			_F = value;
		}
	}

	public int G
	{
		get
		{
			return _G;
		}
		set
		{
			_G = value;
		}
	}

	public int H
	{
		get
		{
			return _H;
		}
		set
		{
			_H = value;
		}
	}

	public cellTile(GameObject selfObject, int id, int row, int column, BIOMTYPE biomType)
	{
		canPass = true;
		this.selfObject = selfObject;
		this.id = id;
		this.row = row;
		this.column = column;
		selfSprite = selfObject.transform.Find("tileSprite").GetComponent<tk2dSprite>();
		incognitaSprite = selfObject.transform.Find("incognitaSprite").GetComponent<tk2dSprite>();
		this.selfObject.name = "cell_" + this.id;
		float num = Random.Range(0.6f, 0.9f);
		selfSprite.color = new Color(num, num, num, 1f);
		this.selfObject.transform.eulerAngles = new Vector3(0f, 0f, Random.Range(0, 4) * 90);
		this.biomType = biomType;
		selfSprite.scale = new Vector3(1.2f, 1.2f, 1.2f);
		incognitaSprite.scale = new Vector3(1.2f, 1.2f, 1.2f);
		tk2dSprite component = selfObject.transform.Find("shadow").GetComponent<tk2dSprite>();
		component.scale = new Vector3(1.2f, 1.2f, 1.2f);
		BoxCollider boxCollider = this.selfObject.AddComponent<BoxCollider>();
		Vector3 vector = (boxCollider.extents = selfSprite.GetBounds().extents);
		bCollider = boxCollider;
		bCollider.enabled = false;
		int num2 = 0;
		int num3 = Random.Range(0, 101);
		if (num3 > 55)
		{
			num2 = 1;
		}
		if (num3 > 85)
		{
			num2 = 2;
		}
		sprOpenedTileID = "biom_" + (int)biomType + "_floor_" + num2;
		num2 = 0;
		num3 = Random.Range(0, 101);
		if (num3 > 55)
		{
			num2 = 1;
		}
		if (num3 > 85)
		{
			num2 = 2;
		}
		sprClosedTileID = "biom_" + (int)biomType + "_cell_" + num2;
		selfSprite.spriteId = selfSprite.GetSpriteIdByName(sprClosedTileID);
	}

	public cellTile(GameObject selfObject, int id, int row, int column, BIOMTYPE biomType, int nullVal)
	{
		canPass = true;
		this.selfObject = selfObject;
		this.id = id;
		this.row = row;
		this.column = column;
		selfSprite = selfObject.transform.Find("tileSprite").GetComponent<tk2dSprite>();
		incognitaSprite = selfObject.transform.Find("incognitaSprite").GetComponent<tk2dSprite>();
		this.selfObject.name = "arenaBlock_" + this.id;
		float num = Random.Range(0.6f, 0.9f);
		selfSprite.color = new Color(num, num, num, 1f);
		this.selfObject.transform.eulerAngles = new Vector3(0f, 0f, Random.Range(0, 4) * 90);
		this.biomType = biomType;
		selfSprite.scale = new Vector3(1.2f, 1.2f, 1.2f);
		incognitaSprite.scale = new Vector3(1.2f, 1.2f, 1.2f);
		tk2dSprite component = selfObject.transform.Find("shadow").GetComponent<tk2dSprite>();
		component.scale = new Vector3(1.2f, 1.2f, 1.2f);
		BoxCollider boxCollider = this.selfObject.AddComponent<BoxCollider>();
		Vector3 vector = (boxCollider.extents = selfSprite.GetBounds().extents);
		bCollider = boxCollider;
		bCollider.enabled = true;
		int num2 = 0;
		int num3 = Random.Range(0, 101);
		if (num3 > 55)
		{
			num2 = 1;
		}
		if (num3 > 85)
		{
			num2 = 2;
		}
		sprOpenedTileID = "biom_" + (int)biomType + "_floor_" + num2;
		num2 = 0;
		num3 = Random.Range(0, 101);
		if (num3 > 55)
		{
			num2 = 1;
		}
		if (num3 > 85)
		{
			num2 = 2;
		}
		sprClosedTileID = "biom_" + (int)biomType + "_cell_" + num2;
		selfSprite.spriteId = selfSprite.GetSpriteIdByName(sprOpenedTileID);
		opened = true;
		blocked = false;
		passible = true;
		selfObject.transform.position += new Vector3(0f, 0f, 5f);
		selfObject.transform.Find("shadow").gameObject.active = false;
		incognitaSprite.gameObject.active = false;
	}

	private void Harm()
	{
		if (!(crackSprite == null))
		{
			crackSprite.gameObject.active = true;
			switch (hp)
			{
			case 3:
				crackSprite.spriteId = crackSprite.GetSpriteIdByName("crack_1");
				break;
			case 2:
				crackSprite.spriteId = crackSprite.GetSpriteIdByName("crack_2");
				break;
			case 1:
				crackSprite.spriteId = crackSprite.GetSpriteIdByName("crack_3");
				break;
			}
		}
	}

	public void passibleHandlerArcherException()
	{
		if (_contains != CONTAINS.biomStop)
		{
			if (column > 0 && dungeonManager.use.TileList[id - 1].opened)
			{
				passibleHandler();
			}
			if (column < dungeonGenerator.use.columns - 1 && dungeonManager.use.TileList[id + 1].opened)
			{
				passibleHandler();
			}
			if (row < dungeonGenerator.use.rows - 1 && dungeonManager.use.TileList[id + dungeonGenerator.use.rows - 1].opened)
			{
				passibleHandler();
			}
			if (row > 0 && dungeonManager.use.TileList[id - dungeonGenerator.use.rows + 1].opened)
			{
				passibleHandler();
			}
		}
	}

	public void passibleHandler()
	{
		if (_contains == CONTAINS.biomStop)
		{
			return;
		}
		if (column > 0)
		{
			dungeonGenerator.use.StartCoroutine(tween.use.alpha(dungeonManager.use.TileList[id - 1].incognitaSprite, 0.15f, 0.2f));
			dungeonManager.use.TileList[id - 1].passible = true;
			passible = true;
			bCollider.enabled = true;
			dungeonManager.use.TileList[id - 1].bCollider.enabled = true;
			if (dungeonManager.use.TileList[id - 1].openedFromAmbush)
			{
				dungeonManager.use.TileList[id - 1].openedFromAmbush = false;
				dungeonManager.use.TileList[id - 1].passibleHandler();
			}
		}
		if (column < dungeonGenerator.use.columns - 1)
		{
			dungeonGenerator.use.StartCoroutine(tween.use.alpha(dungeonManager.use.TileList[id + 1].incognitaSprite, 0.15f, 0.2f));
			dungeonManager.use.TileList[id + 1].passible = true;
			passible = true;
			bCollider.enabled = true;
			dungeonManager.use.TileList[id + 1].bCollider.enabled = true;
			if (dungeonManager.use.TileList[id + 1].openedFromAmbush)
			{
				dungeonManager.use.TileList[id + 1].openedFromAmbush = false;
				dungeonManager.use.TileList[id + 1].passibleHandler();
			}
		}
		if (row < dungeonGenerator.use.rows - 1)
		{
			dungeonGenerator.use.StartCoroutine(tween.use.alpha(dungeonManager.use.TileList[id + dungeonGenerator.use.rows - 1].incognitaSprite, 0.15f, 0.2f));
			dungeonManager.use.TileList[id + dungeonGenerator.use.rows - 1].passible = true;
			passible = true;
			bCollider.enabled = true;
			dungeonManager.use.TileList[id + dungeonGenerator.use.rows - 1].bCollider.enabled = true;
			if (dungeonManager.use.TileList[id + dungeonGenerator.use.rows - 1].openedFromAmbush)
			{
				dungeonManager.use.TileList[id + dungeonGenerator.use.rows - 1].openedFromAmbush = false;
				dungeonManager.use.TileList[id + dungeonGenerator.use.rows - 1].passibleHandler();
			}
		}
		if (row > 0)
		{
			dungeonGenerator.use.StartCoroutine(tween.use.alpha(dungeonManager.use.TileList[id - dungeonGenerator.use.rows + 1].incognitaSprite, 0.15f, 0.2f));
			dungeonManager.use.TileList[id - dungeonGenerator.use.rows + 1].passible = true;
			passible = true;
			bCollider.enabled = true;
			dungeonManager.use.TileList[id - dungeonGenerator.use.rows + 1].bCollider.enabled = true;
			if (dungeonManager.use.TileList[id - dungeonGenerator.use.rows + 1].openedFromAmbush)
			{
				dungeonManager.use.TileList[id - dungeonGenerator.use.rows + 1].openedFromAmbush = false;
				dungeonManager.use.TileList[id - dungeonGenerator.use.rows + 1].passibleHandler();
			}
		}
	}

	public bool isExit()
	{
		if (column > 0 && dungeonManager.use.TileList[id - 1]._contains == CONTAINS.exit)
		{
			return true;
		}
		if (column < dungeonGenerator.use.columns - 1 && dungeonManager.use.TileList[id + 1]._contains == CONTAINS.exit)
		{
			return true;
		}
		if (row < dungeonGenerator.use.rows - 1 && dungeonManager.use.TileList[id + dungeonGenerator.use.rows - 1]._contains == CONTAINS.exit)
		{
			return true;
		}
		if (row > 0 && dungeonManager.use.TileList[id - dungeonGenerator.use.rows + 1]._contains == CONTAINS.exit)
		{
			return true;
		}
		return false;
	}

	public void toughBlock()
	{
		hp = 4;
		sprClosedTileID = "biom_" + (int)biomType + "_cell_" + 3;
		selfSprite.spriteId = selfSprite.GetSpriteIdByName(sprClosedTileID);
		GameObject original = Resources.Load("sprObj") as GameObject;
		GameObject gameObject = Object.Instantiate(original, selfObject.transform.position, Quaternion.identity) as GameObject;
		gameObject.name = "crackSPrite";
		gameObject.transform.position -= new Vector3(0f, 0f, 0.5f);
		crackSprite = gameObject.GetComponent<tk2dSprite>();
		crackSprite.SwitchCollectionAndSprite(dungeonManager.use.sprDatas[1], 14);
		gameObject.transform.parent = selfObject.transform;
		gameObject.active = false;
	}

	public void Open()
	{
		dungeonManager.use.openCellsCashed++;
		if (iconSpriteObj != null)
		{
			Object.Destroy(iconSpriteObj);
		}
		string[] array = new string[2] { "block1", "block2" };
		dungeonGenerator.use.StartCoroutine(soundManager.Instance.playSound(res.music[array[Random.Range(0, 2)]]));
		gameState.Instance.cellsOpened++;
		selfSprite.spriteId = selfSprite.GetSpriteIdByName(sprOpenedTileID);
		dungeonManager.use.dustEffectPool.Spawn(new Vector3(selfObject.transform.position.x, selfObject.transform.position.y, -8.5f), Quaternion.identity);
		if (gameState.Instance.hScript != null)
		{
			gameState.Instance.hScript.moveEventWrapper();
		}
		if (_contains == CONTAINS.nothing)
		{
			playerManager.use.openTilesList.Add(this);
		}
		opened = true;
		selfSprite.spriteId = selfSprite.GetSpriteIdByName(sprOpenedTileID);
		selfObject.transform.position += new Vector3(0f, 0f, 5f);
		selfObject.transform.Find("shadow").gameObject.active = false;
		incognitaSprite.gameObject.active = false;
		if (container != null)
		{
			container.SetActiveRecursively(state: true);
			if (_contains != CONTAINS.monster)
			{
				container.GetComponent<baseObject>().baseINI(isMonster: false);
			}
			else
			{
				container.GetComponent<baseObject>().baseINI(isMonster: true);
			}
			container.GetComponent<baseObject>().isActive = true;
			if (_contains == CONTAINS.monster)
			{
				monster component = container.GetComponent<monster>();
				if (Random.Range(0, 101) < 4)
				{
					guiController.use.createLootInfo(1, "badMood", component.gameObject.transform.position, "- ");
					gameState.Instance.moodButton.moodVal--;
				}
				component.ShadowHandler(id);
				dungeonManager.use.activeMobs.Add(id, component);
				canPass = false;
				component._monsterEvents();
				monsterBlock();
			}
			else if (_contains != CONTAINS.trap && _contains == CONTAINS.npc)
			{
				npc component2 = container.GetComponent<npc>();
				component2.npcAction();
			}
		}
		passibleHandler();
	}

	public void OpenAmbush()
	{
		string[] array = new string[2] { "block1", "block2" };
		dungeonGenerator.use.StartCoroutine(soundManager.Instance.playSound(res.music[array[Random.Range(0, 2)]]));
		gameState.Instance.cellsOpened++;
		dungeonManager.use.openCellsCashed++;
		selfSprite.spriteId = selfSprite.GetSpriteIdByName(sprOpenedTileID);
		dungeonManager.use.dustEffectPool.Spawn(new Vector3(selfObject.transform.position.x, selfObject.transform.position.y, -8.5f), Quaternion.identity);
		selfObject.GetComponent<BoxCollider>().enabled = true;
		if (_contains == CONTAINS.nothing)
		{
			playerManager.use.openTilesList.Add(this);
		}
		opened = true;
		selfSprite.spriteId = selfSprite.GetSpriteIdByName(sprOpenedTileID);
		selfObject.transform.position += new Vector3(0f, 0f, 5f);
		selfObject.transform.Find("shadow").gameObject.active = false;
		incognitaSprite.gameObject.active = false;
		if (container != null)
		{
			container.SetActiveRecursively(state: true);
			if (_contains != CONTAINS.monster)
			{
				container.GetComponent<baseObject>().baseINI(isMonster: false);
			}
			else
			{
				container.GetComponent<baseObject>().baseINI(isMonster: true);
			}
			container.GetComponent<baseObject>().isActive = true;
			if (_contains == CONTAINS.monster)
			{
				monster component = container.GetComponent<monster>();
				component.ShadowHandler(id);
				if (!dungeonManager.use.activeMobs.ContainsKey(id))
				{
					dungeonManager.use.activeMobs.Add(id, component);
				}
				canPass = false;
				component._monsterEvents();
			}
			else if (_contains != CONTAINS.trap && _contains == CONTAINS.npc)
			{
				npc component2 = container.GetComponent<npc>();
				component2.npcAction();
			}
		}
		if (_contains == CONTAINS.chest && canPass)
		{
			passibleHandler();
		}
	}

	public void monsterBlock()
	{
		monster component = container.GetComponent<monster>();
		if (!component.isPerished && !component.heroInvisible && component.weaponType != monster.WEAPONTYPE.ranged && component.monsterName != monster.MONSTERNAME.sheep && !component.dizzed)
		{
			if (column > 0)
			{
				dungeonManager.use.TileList[id - 1].blockedFunc(component);
			}
			if (column < dungeonGenerator.use.columns - 1)
			{
				dungeonManager.use.TileList[id + 1].blockedFunc(component);
			}
			if (row < dungeonGenerator.use.rows - 1)
			{
				dungeonManager.use.TileList[id + dungeonGenerator.use.rows - 1].blockedFunc(component);
			}
			if (row > 0)
			{
				dungeonManager.use.TileList[id - dungeonGenerator.use.rows + 1].blockedFunc(component);
			}
			if (row < dungeonGenerator.use.rows - 1 && column > 0)
			{
				dungeonManager.use.TileList[id + dungeonGenerator.use.rows - 2].blockedFunc(component);
			}
			if (row < dungeonGenerator.use.rows - 1 && column < dungeonGenerator.use.columns - 1)
			{
				dungeonManager.use.TileList[id + dungeonGenerator.use.rows].blockedFunc(component);
			}
			if (row > 0 && column < dungeonGenerator.use.columns && column > 0)
			{
				dungeonManager.use.TileList[id - dungeonGenerator.use.rows].blockedFunc(component);
			}
			if (row > 0 && column < dungeonGenerator.use.columns - 1)
			{
				dungeonManager.use.TileList[id - dungeonGenerator.use.rows + 2].blockedFunc(component);
			}
		}
	}

	public void blockedFunc(monster s)
	{
		if (_contains == CONTAINS.monster && container.GetComponent<monster>().weaponType == monster.WEAPONTYPE.ranged)
		{
			monster component = container.GetComponent<monster>();
			component.blockingMonsters.Add(s);
		}
		else if (opened || blocked)
		{
			return;
		}
		if (!s.heroInvisible)
		{
			blocked = true;
			s.blockedArea.Add(this);
			GameObject gameObject = Object.Instantiate(dungeonGenerator.use.markPrefab, new Vector3(selfObject.transform.position.x, selfObject.transform.position.y, 80f), Quaternion.identity) as GameObject;
			tk2dSprite component2 = gameObject.transform.Find("Sprite").GetComponent<tk2dSprite>();
			dungeonManager.use.StartCoroutine(crossAnim(component2));
			s.markPrefabs.Add(gameObject);
		}
	}

	public IEnumerator crossAnim(tk2dSprite spr)
	{
		spr.scale = new Vector2(0f, 0f);
		yield return dungeonManager.use.StartCoroutine(tween.use.ScaleSprite(spr, 340f, 0.2f, tween.OBJSTATE.None));
		yield return dungeonManager.use.StartCoroutine(tween.use.ScaleSprite(spr, 320f, 0.1f, tween.OBJSTATE.None));
	}

	public void deblockedFunc()
	{
		blocked = false;
	}

	public IEnumerator checkRanged()
	{
		while (!Input.GetMouseButtonDown(0))
		{
			yield return 0;
		}
		OpenAmbush();
	}

	public void AddSpirit()
	{
		filled = true;
		_contains = CONTAINS.npc;
		GameObject gameObject = null;
		string[] array = new string[3] { "spirit_shield", "spirit_fire", "spirit_healer" };
		gameObject = res.enemies[array[Random.Range(0, array.Length)]];
		container = Object.Instantiate(gameObject, new Vector3(selfObject.transform.position.x, selfObject.transform.position.y, 50f + (float)(row * 2)), Quaternion.identity) as GameObject;
		container.GetComponent<baseObject>().parentTile = this;
		container.name = "spirit_ " + id;
		bsObjScript = container.GetComponent<baseObject>();
		container.SetActiveRecursively(state: false);
	}

	private string returnMonsterType(int num)
	{
		string result = "start";
		if (num <= 7)
		{
			result = "start";
		}
		else if (num <= 15)
		{
			result = "mid";
		}
		else if (num <= 30)
		{
			result = "mid2";
		}
		else if (num <= 45)
		{
			result = "mid3";
		}
		else if ((float)num <= float.PositiveInfinity)
		{
			result = "high";
		}
		return result;
	}

	public void AddMonster()
	{
		filled = true;
		_contains = CONTAINS.monster;
		GameObject gameObject = null;
		string[] array = gameState.Instance.enemyBiomList[returnMonsterType(gameState.Instance.tempDungeonNum)];
		gameObject = res.enemies[array[Random.Range(0, array.Length)]];
		monster component = gameObject.GetComponent<monster>();
		if (component.weaponType == monster.WEAPONTYPE.ranged)
		{
			if (dungeonGenerator.use.allowedRangedUnits <= 0)
			{
				AddMonster();
				return;
			}
			dungeonGenerator.use.allowedRangedUnits = Mathf.Clamp(--dungeonGenerator.use.allowedRangedUnits, 0, 4);
		}
		container = Object.Instantiate(gameObject, new Vector3(selfObject.transform.position.x, selfObject.transform.position.y, 50f + (float)(row * 2)), Quaternion.identity) as GameObject;
		container.GetComponent<baseObject>().parentTile = this;
		container.name = "mMan_ " + id;
		monster component2 = container.GetComponent<monster>();
		component2.ini(id);
		bsObjScript = container.GetComponent<baseObject>();
		if (component2.weaponType == monster.WEAPONTYPE.ranged)
		{
			dungeonGenerator.use.StartCoroutine(checkRanged());
		}
		container.SetActiveRecursively(state: false);
		dungeonManager.use.allMobs.Add(container.GetComponent<monster>());
	}

	public void AddMonsterBarrel()
	{
		filled = true;
		_contains = CONTAINS.monster;
		GameObject gameObject = null;
		string[] array = gameState.Instance.enemyBiomList[returnMonsterType(gameState.Instance.tempDungeonNum)];
		gameObject = res.enemies[array[Random.Range(0, array.Length)]];
		monster component = gameObject.GetComponent<monster>();
		if (component.weaponType == monster.WEAPONTYPE.ranged)
		{
			if (dungeonGenerator.use.allowedRangedUnits <= 0)
			{
				AddMonster();
				return;
			}
			dungeonGenerator.use.allowedRangedUnits = Mathf.Clamp(--dungeonGenerator.use.allowedRangedUnits, 0, 4);
		}
		container = Object.Instantiate(gameObject, new Vector3(selfObject.transform.position.x, selfObject.transform.position.y, 50f + (float)(row * 2)), Quaternion.identity) as GameObject;
		container.GetComponent<baseObject>().parentTile = this;
		container.name = "mMan_ " + id;
		monster component2 = container.GetComponent<monster>();
		component2.ini(id);
		bsObjScript = container.GetComponent<baseObject>();
		if (component2.weaponType == monster.WEAPONTYPE.ranged)
		{
			dungeonGenerator.use.StartCoroutine(checkRanged());
		}
		container.SetActiveRecursively(state: false);
		dungeonManager.use.allMobs.Add(container.GetComponent<monster>());
		dungeonManager.use.activeMobs.Add(id, container.GetComponent<monster>());
	}

	public void AddMonster(bool hasKey)
	{
		filled = true;
		_contains = CONTAINS.monster;
		GameObject gameObject = null;
		string[] array = gameState.Instance.enemyBiomList[returnMonsterType(gameState.Instance.tempDungeonNum)];
		gameObject = res.enemies[array[Random.Range(0, array.Length)]];
		monster component = gameObject.GetComponent<monster>();
		if (component.weaponType == monster.WEAPONTYPE.ranged)
		{
			if (dungeonGenerator.use.allowedRangedUnits <= 0)
			{
				AddMonster(hasKey);
				return;
			}
			dungeonGenerator.use.allowedRangedUnits = Mathf.Clamp(--dungeonGenerator.use.allowedRangedUnits, 0, 4);
		}
		container = Object.Instantiate(gameObject, new Vector3(selfObject.transform.position.x, selfObject.transform.position.y, 50f + (float)(row * 2)), Quaternion.identity) as GameObject;
		container.GetComponent<baseObject>().parentTile = this;
		container.name = "mMan_ " + id;
		monster component2 = container.GetComponent<monster>();
		component2.ini(id);
		if (component2.weaponType == monster.WEAPONTYPE.ranged)
		{
			dungeonGenerator.use.StartCoroutine(checkRanged());
		}
		bsObjScript = container.GetComponent<baseObject>();
		container.SetActiveRecursively(state: false);
		container.GetComponent<monster>().hasKey = hasKey;
		if (hasKey)
		{
			Debug.Log("KEY");
		}
		dungeonManager.use.allMobs.Add(container.GetComponent<monster>());
	}

	public void AddBoss()
	{
		filled = true;
		_contains = CONTAINS.monster;
		GameObject gameObject = null;
		string[] array = new string[2] { "goblinKing", "ogreKing" };
		gameObject = res.enemiesUnique[array[Random.Range(0, array.Length)]];
		container = Object.Instantiate(gameObject, new Vector3(selfObject.transform.position.x, selfObject.transform.position.y, 50f + (float)(row * 2)), Quaternion.identity) as GameObject;
		container.GetComponent<baseObject>().parentTile = this;
		container.name = "mMan_ " + id;
		container.GetComponent<monster>().ini(id);
		bsObjScript = container.GetComponent<baseObject>();
		container.SetActiveRecursively(state: false);
		dungeonManager.use.allMobs.Add(container.GetComponent<monster>());
	}

	public void AddExit()
	{
		filled = true;
		_contains = CONTAINS.exit;
		container = Object.Instantiate(dungeonGenerator.use.exitPrefab, new Vector3(selfObject.transform.position.x, selfObject.transform.position.y, 100f), Quaternion.identity) as GameObject;
		container.GetComponent<baseObject>().parentTile = this;
		bsObjScript = container.GetComponent<baseObject>();
		container.SetActiveRecursively(state: true);
		dungeonManager.use.exitCellTemp = this;
	}

	public void AddSword()
	{
		consumable = true;
		filled = true;
		_contains = CONTAINS.sword;
		container = Object.Instantiate(dungeonGenerator.use.attackPrefab, new Vector3(selfObject.transform.position.x, selfObject.transform.position.y, 51 + row * 2), Quaternion.identity) as GameObject;
		container.GetComponent<baseObject>().parentTile = this;
		bsObjScript = container.GetComponent<baseObject>();
		container.SetActiveRecursively(state: false);
	}

	public void AddHeart()
	{
		consumable = true;
		filled = true;
		_contains = CONTAINS.heart;
		container = Object.Instantiate(dungeonGenerator.use.heartPrefab, new Vector3(selfObject.transform.position.x, selfObject.transform.position.y, 51 + row * 2), Quaternion.identity) as GameObject;
		container.GetComponent<baseObject>().parentTile = this;
		bsObjScript = container.GetComponent<baseObject>();
		container.SetActiveRecursively(state: false);
	}

	public void AddStop()
	{
		consumable = true;
		filled = true;
		_contains = CONTAINS.biomStop;
		container = Object.Instantiate(dungeonGenerator.use.biomStopPrefab, new Vector3(selfObject.transform.position.x, selfObject.transform.position.y, 51 + row * 2), Quaternion.identity) as GameObject;
		container.GetComponent<baseObject>().parentTile = this;
		bsObjScript = container.GetComponent<baseObject>();
		container.SetActiveRecursively(state: false);
	}

	public void AddWeapon()
	{
		consumable = true;
		filled = true;
		_contains = CONTAINS.lootBag;
		container = Object.Instantiate(dungeonGenerator.use.weaponPrefab, new Vector3(selfObject.transform.position.x, selfObject.transform.position.y, 51 + row * 2), Quaternion.identity) as GameObject;
		container.GetComponent<baseObject>().parentTile = this;
		bsObjScript = container.GetComponent<baseObject>();
		container.SetActiveRecursively(state: false);
	}

	public void AddGold()
	{
		consumable = true;
		filled = true;
		_contains = CONTAINS.coin;
		container = Object.Instantiate(dungeonGenerator.use.goldPrefab, new Vector3(selfObject.transform.position.x, selfObject.transform.position.y, 51 + row * 2), Quaternion.identity) as GameObject;
		container.GetComponent<baseObject>().parentTile = this;
		bsObjScript = container.GetComponent<baseObject>();
		container.SetActiveRecursively(state: false);
	}

	public void AddFood()
	{
		consumable = true;
		filled = true;
		_contains = CONTAINS.food;
		container = Object.Instantiate(dungeonGenerator.use.foodPrefab, new Vector3(selfObject.transform.position.x, selfObject.transform.position.y, 51 + row * 2), Quaternion.identity) as GameObject;
		container.GetComponent<baseObject>().parentTile = this;
		bsObjScript = container.GetComponent<baseObject>();
		container.SetActiveRecursively(state: false);
	}

	public void AddBanner()
	{
		filled = true;
		_contains = CONTAINS.lootBag;
		container = Object.Instantiate(dungeonGenerator.use.bannerPrefab, new Vector3(selfObject.transform.position.x, selfObject.transform.position.y, 51 + row * 2), Quaternion.identity) as GameObject;
		container.GetComponent<baseObject>().parentTile = this;
		bsObjScript = container.GetComponent<baseObject>();
		container.SetActiveRecursively(state: false);
	}

	public void AddTrap()
	{
		filled = true;
		_contains = CONTAINS.trap;
		container = Object.Instantiate(dungeonGenerator.use.trapPrefab, new Vector3(selfObject.transform.position.x, selfObject.transform.position.y, 51 + row * 2), Quaternion.identity) as GameObject;
		container.GetComponent<baseObject>().parentTile = this;
		bsObjScript = container.GetComponent<baseObject>();
		container.SetActiveRecursively(state: false);
	}

	public void AddSlt()
	{
		filled = true;
		_contains = CONTAINS.slot;
		container = Object.Instantiate(dungeonGenerator.use.slotPrefab, new Vector3(selfObject.transform.position.x, selfObject.transform.position.y, 51 + row * 2), Quaternion.identity) as GameObject;
		container.GetComponent<baseObject>().parentTile = this;
		bsObjScript = container.GetComponent<baseObject>();
		container.SetActiveRecursively(state: false);
	}

	public void AddChest()
	{
		filled = true;
		_contains = CONTAINS.chest;
		container = Object.Instantiate(dungeonGenerator.use.chestPrefab, new Vector3(selfObject.transform.position.x, selfObject.transform.position.y, 51 + row * 2), Quaternion.identity) as GameObject;
		container.GetComponent<baseObject>().parentTile = this;
		bsObjScript = container.GetComponent<baseObject>();
		container.SetActiveRecursively(state: false);
		dungeonGenerator.use._chest = container.GetComponent<chest>();
	}

	public GameObject AddGates()
	{
		GameObject gameObject = Object.Instantiate(dungeonGenerator.use.gatesPrefab, new Vector3(selfObject.transform.position.x, selfObject.transform.position.y, (float)(51 + row * 2) - 2f), Quaternion.identity) as GameObject;
		dungeonGenerator.use._chest._gates = gameObject.GetComponent<gates>();
		gameObject.SetActiveRecursively(state: false);
		return gameObject;
	}

	public void AddLootBag()
	{
		filled = true;
		_contains = CONTAINS.lootBag;
		container = Object.Instantiate(dungeonGenerator.use.lootBagPrefab, new Vector3(selfObject.transform.position.x, selfObject.transform.position.y, 51 + row * 2), Quaternion.identity) as GameObject;
		container.GetComponent<baseObject>().parentTile = this;
		bsObjScript = container.GetComponent<baseObject>();
		container.SetActiveRecursively(state: false);
	}

	public void AddSpellBook()
	{
		filled = true;
		_contains = CONTAINS.lootBag;
		container = Object.Instantiate(dungeonGenerator.use.spellBookPrefab, new Vector3(selfObject.transform.position.x, selfObject.transform.position.y, 51 + row * 2), Quaternion.identity) as GameObject;
		container.GetComponent<baseObject>().parentTile = this;
		bsObjScript = container.GetComponent<baseObject>();
		container.SetActiveRecursively(state: false);
	}

	public void AddAntidot()
	{
		filled = true;
		_contains = CONTAINS.barrel;
		container = Object.Instantiate(dungeonGenerator.use.antidotPrefab, new Vector3(selfObject.transform.position.x, selfObject.transform.position.y, 51 + row * 2), Quaternion.identity) as GameObject;
		container.GetComponent<baseObject>().parentTile = this;
		bsObjScript = container.GetComponent<baseObject>();
		container.SetActiveRecursively(state: false);
	}

	public void AddPot()
	{
		filled = true;
		_contains = CONTAINS.barrel;
		container = Object.Instantiate(dungeonGenerator.use.potPrefab, new Vector3(selfObject.transform.position.x, selfObject.transform.position.y, 51 + row * 2), Quaternion.identity) as GameObject;
		container.GetComponent<baseObject>().parentTile = this;
		bsObjScript = container.GetComponent<baseObject>();
		container.SetActiveRecursively(state: false);
	}

	public void AddAnvil()
	{
		filled = true;
		_contains = CONTAINS.minigame;
		container = Object.Instantiate(dungeonGenerator.use.anvilPrefab, new Vector3(selfObject.transform.position.x, selfObject.transform.position.y, 51 + row * 2), Quaternion.identity) as GameObject;
		container.GetComponent<baseObject>().parentTile = this;
		bsObjScript = container.GetComponent<baseObject>();
		container.SetActiveRecursively(state: false);
	}

	public void AddFish()
	{
		filled = true;
		_contains = CONTAINS.minigame;
		container = Object.Instantiate(dungeonGenerator.use.fishPrefab, new Vector3(selfObject.transform.position.x, selfObject.transform.position.y + 30f, 51 + row * 2), Quaternion.identity) as GameObject;
		container.GetComponent<baseObject>().parentTile = this;
		bsObjScript = container.GetComponent<baseObject>();
		container.SetActiveRecursively(state: false);
	}

	public void AddRostrum()
	{
		filled = true;
		_contains = CONTAINS.questObject;
		container = Object.Instantiate(dungeonGenerator.use.rostrumPrefab, new Vector3(selfObject.transform.position.x, selfObject.transform.position.y + 30f, 51 + row * 2), Quaternion.identity) as GameObject;
		container.GetComponent<baseObject>().parentTile = this;
		bsObjScript = container.GetComponent<baseObject>();
		container.SetActiveRecursively(state: false);
	}

	public void AddPesant()
	{
		filled = true;
		_contains = CONTAINS.questObject;
		GameObject original = res.enemiesUnique["pesant"];
		container = Object.Instantiate(original, new Vector3(selfObject.transform.position.x, selfObject.transform.position.y, 50f + (float)(row * 2)), Quaternion.identity) as GameObject;
		container.GetComponent<baseObject>().parentTile = this;
		bsObjScript = container.GetComponent<baseObject>();
		container.SetActiveRecursively(state: false);
	}

	public void AddLever()
	{
		filled = true;
		_contains = CONTAINS.lever;
		container = Object.Instantiate(dungeonGenerator.use.leverPrefab, new Vector3(selfObject.transform.position.x, selfObject.transform.position.y, 51 + row * 2), Quaternion.identity) as GameObject;
		container.GetComponent<baseObject>().parentTile = this;
		bsObjScript = container.GetComponent<baseObject>();
		container.SetActiveRecursively(state: false);
	}

	public void AddMonsterPit()
	{
		filled = true;
		_contains = CONTAINS.lever;
		container = Object.Instantiate(dungeonGenerator.use.monsterPitPrefab, new Vector3(selfObject.transform.position.x, selfObject.transform.position.y, 51 + row * 2), Quaternion.identity) as GameObject;
		container.GetComponent<baseObject>().parentTile = this;
		bsObjScript = container.GetComponent<baseObject>();
		container.SetActiveRecursively(state: false);
	}

	public void AddShop()
	{
		filled = true;
		_contains = CONTAINS.lever;
		container = Object.Instantiate(dungeonGenerator.use.shopPrefab, new Vector3(selfObject.transform.position.x, selfObject.transform.position.y, 51 + row * 2), Quaternion.identity) as GameObject;
		container.GetComponent<baseObject>().parentTile = this;
		bsObjScript = container.GetComponent<baseObject>();
		container.SetActiveRecursively(state: false);
	}

	public void AddPlayerStatue()
	{
		filled = true;
		_contains = CONTAINS.lever;
		container = Object.Instantiate(dungeonGenerator.use.statuePrefab, new Vector3(selfObject.transform.position.x, selfObject.transform.position.y, 51 + row * 2), Quaternion.identity) as GameObject;
		container.GetComponent<baseObject>().parentTile = this;
		bsObjScript = container.GetComponent<baseObject>();
		container.SetActiveRecursively(state: false);
	}

	public void AddArenaChest()
	{
		filled = true;
		_contains = CONTAINS.lootBag;
		container = Object.Instantiate(dungeonGenerator.use.rewardChestPrefab, new Vector3(selfObject.transform.position.x, selfObject.transform.position.y, 51 + row * 2), Quaternion.identity) as GameObject;
		container.GetComponent<baseObject>().parentTile = this;
		bsObjScript = container.GetComponent<baseObject>();
	}

	public void AddArenaMonster()
	{
		filled = true;
		_contains = CONTAINS.monster;
		GameObject gameObject = null;
		string[] array = gameState.Instance.enemyBiomList[returnMonsterType(gameState.Instance.tempDungeonNum)];
		gameObject = res.enemies[array[Random.Range(0, array.Length)]];
		monster component = gameObject.GetComponent<monster>();
		if (component.weaponType == monster.WEAPONTYPE.ranged && dungeonGenerator.use.allowedRangedUnits <= 0)
		{
			AddMonster();
			return;
		}
		container = Object.Instantiate(gameObject, new Vector3(selfObject.transform.position.x, selfObject.transform.position.y, 50f + (float)(row * 2)), Quaternion.identity) as GameObject;
		container.GetComponent<baseObject>().parentTile = this;
		container.name = "mMan_ " + id;
		monster component2 = container.GetComponent<monster>();
		component2.ini(id);
		component2.checkIconState();
		bsObjScript = container.GetComponent<baseObject>();
		component2.isArena = true;
		dungeonManager.use.arenaMobs.Add(id, component2);
	}
}