void OnTriggerEnter2D(Collider2D other) { //Color _objectsColour = other.GetComponent<SpriteRenderer>().color; if (gameObject.tag == other.tag) { int numOfGemsEarned = 0; // if(currentColor == _objectsColour) // numOfGemsEarned++; if (gameObject.tag == other.tag) { numOfGemsEarned++; } FreezePlayerShape(other.transform); //Trigger Level Complete LevelManager.instance.IncrementCurrentLevel(); //Add On Score LevelManager.instance.IncremementScore(); LevelHolderBehaviour lhScript = transform.parent.root.GetComponent <LevelHolderBehaviour>(); lhScript.StartMoving(1); } else { //Destroy(other.gameObject); } }
public void BringInNextLevel() { for (int i = 0; i < levels[0].transform.childCount; i++) { levels[0].transform.GetChild(i).parent = null; } levels[0].SetActive(false); levels.RemoveAt(0); playerShapes.RemoveAt(0); levels[0].SetActive(true); LevelHolderBehaviour lhScript = levels[0].GetComponent <LevelHolderBehaviour>(); lhScript.StartMoving(0); InputManager.instance.currentPlayer = playerShapes[0]; LevelManager.instance.movesAvailableForLevel = 1; DetermineLevelType(); }