public void moveLeft() { if (transform.position.x > -5 && !gameOver) { transform.position = transform.position - (new Vector3(0.05f, 0, 0)); //Change line positions here //Tip: Just subtract "new Vector3 (0.05f, 0 ,0)" to every point List <Vector3> linePositions = Player_Level5_nadine.getLinePositions(); for (int i = 0; i < linePositions.Count; i++) { linePositions[i] = linePositions[i] - new Vector3(0.05f, 0, 0); } Player_Level5_nadine.setLinePositions(linePositions); } }
void detector() { if (!gameOver) { RaycastHit hit; List <Vector3> linePositions = Player_Level5_nadine.getLinePositions(); if (Physics.Linecast(linePositions [1], linePositions [2], out hit)) { if (hit.collider.tag == "Target") { gameOver = true; FinishTime = Time.realtimeSinceStartup; timeInLevel = (int)FinishTime - (int)StartTime; calculateScore(); //score now has its right value //timeInLevel, score, clicks, log & level ready } if (hit.collider.tag == "Obstacle") { //linePositions [2] = hit.point; } } } }