public void handleUserTouch(FTouch touch) { //Debug.Log ("User Global Touch x:" + touch.position.x + " y:" + touch.position.y); Vector2 touchPos = _level1.GlobalToLocal(touch.position); //Debug.Log ("User Local Touch x:" + touchPos.x + " y:" + touchPos.y); int colNumber = (int)touchPos.x / 64; int rowNumber = (int)touchPos.y / 64; Door doorTouched = null; for (int i = 0; i < _levelDoors.Count; i++) { Door door = _levelDoors[i]; if (door.startRow == rowNumber && door.startCol == colNumber) { doorTouched = door; break; } else if (door.doorIsHorizontal) { // horizontal door, so check ending tile (in same col) if (door.startRow + 1 == rowNumber && door.startCol == colNumber) { doorTouched = door; break; } } else { // vertical door, so check ending tile (in same row) if (door.startRow == rowNumber && door.startCol + 1 == colNumber) { doorTouched = door; break; } } } if (doorTouched != null) { doorTouched.SetDoorStatus(!doorTouched.doorIsOpen); } }