public GameObject getTrap(Transform trans) { int val; if (RandomVariable.getRandomTrap() != 0) { return(null); } do { val = RandomVariable.getRandomValue(0, trapPrefab.Length); if (val >= DEFAULT_ENABLETRAP.GetLength(1)) { return(null); } } while (!DEFAULT_ENABLETRAP[GameAttribute.Instance.level, val] && val < DEFAULT_ENABLETRAP.GetLength(1)); return(Instantiate(trapPrefab[val], trans.position, Quaternion.identity) as GameObject); }