void PlayerMove(int x, int y) { //generate new level if (posX + x < 0 || posY + y < 0 || posX + x >= mapCols || posY + y >= mapRows) { if (posY + y < 0) { levelY -= 1; Teleport(posX, mapRows - (posY) - 1); } else if (posX + x < 0) { levelX -= 1; Teleport(mapCols - (posX) - 1, posY); } else if (posY + y >= mapRows) { levelY += 1; Teleport(posX, 0); } else if (posX + x >= mapCols) { levelX += 1; Teleport(0, posY); } camera.transform.position = new Vector3(transform.position.x, transform.position.y, camera.transform.position.z); levelControllerScript.GetLGScript().ChangeLevel(levelX, levelY); Debug.Log("Moving to level " + levelX + ", " + levelY); } else { Move(x, y); int elapsedTime = 100 * (100 / 20); foreach (GameObject npc in levelControllerScript.GetNpcList()) { npc.GetComponent <LivingThingScript> ().GiveAp(elapsedTime, 100); npc.GetComponent <LivingThingScript> ().AIMove(); } } if (cameraMode == CameraMode.locked) { camera.transform.position = new Vector3(transform.position.x, transform.position.y, camera.transform.position.z); } }