public void ChangeStars() { //Get the amount of stars of the current level and display them starsToDisplay = currentLevel.currentStars; switch (starsToDisplay) { case 0: Star0.SetActive(true); break; case 1: Star0.SetActive(false); Star1.SetActive(true); break; case 2: Star1.SetActive(false); Star2.SetActive(true); break; case 3: Star2.SetActive(false); Star3.SetActive(true); break; } }
public void countPoints() { Time.timeScale = 0; //Pausa spelet och tiden int numSaved = 0; Points += timeFactor * countdownScript.getTimeLeft(); victims = GameObject.FindGameObjectsWithTag("Victim"); foreach (GameObject victim in victims) { victimParam = victim.GetComponent <Parameters>(); Dictionary <string, object> ParamDic = victimParam.getParamHash(); if ((string)ParamDic["SetPrio"] == "unset") { Points -= unSetTriagePenelty; } else if ((string)ParamDic["SetPrio"] == ParamDic["prio"].ToString().ToLower()) { Debug.Log("Correct"); numSaved += 1; Points += correctTriagePoint; } else if ((string)ParamDic["SetPrio"] != ParamDic["prio"].ToString().ToLower()) { Debug.Log("incorrect"); Points -= incorrectTriagePenelty; } if ((bool)ParamDic["Bleeding"] == true) { Debug.Log("Bleeding"); Points -= incorrectTriagePenelty; } //Debug.Log(ParamDic["prio"]+" : "+ParamDic["SetPrio"]); } foreach (GameObject item in GameOverList) { item.SetActive(true); } //Behöver göras dynamisk när vi har fler levels if (Points <= 0) { PointRatio = 0; } else { PointRatio = Points; //Kvot för nuv. poäng genom tot. möjliga poäng * 100 } PointsTxt.text = PointRatio.ToString(); LevelTxt.text = "1"; int starCapPoint = victims.Length * correctTriagePoint; Debug.Log(PointRatio + " : " + starCapPoint); if (PointRatio > starCapPoint * 0.25f) { Star1.SetActive(true); } if (PointRatio > starCapPoint * 0.5f) { Star2.SetActive(true); } if (PointRatio >= starCapPoint) { Star3.SetActive(true); } }