void GetCollumAndRow() { EventDriver eventDriver = GameObject.FindObjectOfType <EventDriver>(); Debug.Log(eventDriver.FindMap()); if (eventDriver.FindMap() != null) { if (eventDriver.FindMap() == gameObject.GetComponent <MapLocation>()) { GridTiles playerLocation = eventDriver.FindPlayerLocaton(); GridTiles enemyLocation = eventDriver.FindPartyLocaton(); if (enemyLocation == null || playerLocation == null) { return; } newEnemyTag = enemyLocation.gameObject.name; newPlayerTag = playerLocation.gameObject.name; enemyGL = ""; int j = 0; for (int i = 2; i < newEnemyTag.Length; i++) { enemyGL += newEnemyTag[i].ToString(); j++; } playerGL = ""; j = 0; for (int i = 2; i < newPlayerTag.Length; i++) { playerGL += newPlayerTag[i].ToString(); j++; } for (int i = 0; i < enemyGL.Length; i++) { if (enemyGL[i].ToString() == "r") { rowEnemyStart = i + 1; collumEnemyEnd = i - 1; } } for (int i = 0; i < playerGL.Length; i++) { if (playerGL[i].ToString() == "r") { rowPlayerStart = i + 1; collumPlayerEnd = i - 1; } } eCollums = ""; Debug.Log(collumEnemyEnd); if (collumEnemyEnd > 0) { j = 0; for (int i = collumEnemyEnd; i >= 0; i--) { eCollums += enemyGL[j].ToString(); j++; } } else { eCollums = enemyGL[0].ToString(); } eRows = ""; for (int i = rowEnemyStart; i < enemyGL.Length; i++) { eRows += enemyGL[i].ToString(); j++; } pCollums = ""; if (collumPlayerEnd > 0) { int playerGLength = playerGL.Length; j = 0; for (int i = collumPlayerEnd; i >= 0; i--) { pCollums += playerGL[j].ToString(); j++; } } else { pCollums = playerGL[0].ToString(); } pRows = ""; j = 0; for (int i = rowPlayerStart; i < playerGL.Length; i++) { //if (i < 0 && i <= playerGL.Length) pRows += playerGL[i].ToString(); j++; } pcNum = int.Parse(pCollums); prNum = int.Parse(pRows); ecNum = int.Parse(eCollums); erNum = int.Parse(eRows); //enemy collum,row then player collum,row mapEventDriver.AssignInts(ecNum, erNum, pcNum, prNum); GetQuads(); } } }