// Update is called once per frame void Update() { MoveSuitCases(); //timer if (!gameover) { timer -= Time.deltaTime; timerText.text = "Time: " + ((int)timer).ToString(); } if (timer < 0 && !gameover) { gameoverPanel.SetActive(true); gameoverPanel.transform.GetChild(1).GetChild(1).gameObject.SetActive(false); gameoverPanel.GetComponentInChildren <Text> ().text = " Try Again"; life.downLives(); } if (pausePanel.activeInHierarchy || gameoverPanel.activeInHierarchy) { gameover = true; } else { gameover = false; } if (transform.position == points [currentPoint].position) { currentPoint = 0; if (exe) { if (dragndrop5.commands [i].Equals(0)) { currentPoint = 1; } else if (dragndrop5.commands [i].Equals(1)) { currentPoint = 2; } else if (dragndrop5.commands [i].Equals(2)) { currentPoint = 3; } else if (dragndrop5.commands [i].Equals(3) && limit < 2) { i = labelPoint; limit++; } else if (dragndrop5.commands [i].Equals(4)) { labelPoint = i; } if (dragndrop5.commands [i + 1] != -2) { i++; } else { exe = false; limit = 0; } } } else { transform.position = Vector3.MoveTowards(transform.position, points [currentPoint].position, Speed * Time.deltaTime); } }