IEnumerator Wait() { if (gameObject.name == "lCollider") { if (isAvailable == true && collision == false) { ObsSpwnr.SpawnObstacle(this.transform.position); GM.canSpawn = false; } else { ObsSpwnr.MoveAreaChecker(GM.objIndex); } } else if (gameObject.name == "sCollider") { if (isAvailable == true && collision == false) { ObsSpwnr.SpawnObstacle(this.transform.position); GM.canSpawn = false; } else { ObsSpwnr.MoveAreaChecker(GM.objIndex); } } else if (gameObject.name == "ItemCube") { if (isAvailable == true && collision == false) { GM.itemCube.position = this.transform.position; GM.canSpawn = false; } else { ObsSpwnr.MoveAreaChecker(GM.objIndex); } } yield return(new WaitForSeconds(.5f)); }