//====================================================================== //STAGE SET CHANGING public void StageChange(GameManager.StageSet s) //NEED TO CALL THIS FUNCTION FROM GAMEMANAGER ON LEVEL SWITCH AND ALSO ON STARTUP { currentStage = Stages[(int)s]; if (onStageChange != null) { onStageChange(); } }
public void LevelSetup(GameManager.StageSet s) { CancelInvoke(); scrollSpeed = baseScrollSpeed; scrollingSpeed = scrollSpeed; foreach (Level x in levelRef) { if (x.stage == s) { foreach (GameObject y in activeOBJ) { Destroy(y); } foreach (GameObject y in currentOBJ) { Destroy(y); } foreach (GameObject y in currentTransOBJ) { Destroy(y); } activeOBJ.Clear(); currentOBJ.Clear(); currentTransOBJ.Clear(); foreach (GameObject y in x.StartingTiles) { GameObject temp = Instantiate(y, transform); activeOBJ.Add(temp); } foreach (GameObject y in x.LevelTiles) { GameObject temp = Instantiate(y, transform); currentOBJ.Add(temp); } foreach (GameObject y in x.TransLevelTiles) { GameObject temp = Instantiate(y, transform); currentTransOBJ.Add(temp); } foreach (GameObject y in x.TransitionTiles) { GameObject temp = Instantiate(y, transform); transOBJ.Add(temp); } for (int i = 0; i < activeOBJ.Count; i++) //places opening tiles { activeOBJ[i].transform.position = StartTilePositions[i]; } return; } } Debug.Log("NO LEVEL"); }