コード例 #1
0
 public void ChangeProgress(float NewProgress)
 {
     //Setting the stars active based on the amount of progress.
     transform.localScale = new Vector2(NewProgress, transform.localScale.y);
     progress             = NewProgress;
     if (progress > (1f / 3f))
     {
         Star1.SetActive(true);
     }
     else
     {
         Star1.SetActive(false);
     }
     if (progress > (2f / 3f))
     {
         Star2.SetActive(true);
     }
     else
     {
         Star2.SetActive(false);
     }
     if (progress == 1f)
     {
         Star3.SetActive(true);
     }
     else
     {
         Star3.SetActive(false);
     }
 }
コード例 #2
0
    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;
        }
    }
コード例 #3
0
    // Use this for initialization
    void Start()         //Mise en Place de la Scene.
    {
        End   = GameObject.Find("End");
        Star1 = GameObject.Find("1 Star");
        Star2 = GameObject.Find("2 Star");
        Star3 = GameObject.Find("3 Star");
        Star1.SetActive(false);
        Star2.SetActive(false);
        Star3.SetActive(false);
        Fermeture = GameObject.Find("Fermeture");
        Bienjoue  = GameObject.Find("BienJoué");
        genial    = GameObject.Find("Génial");
        excellent = GameObject.Find("Excellent");
        score     = GameObject.Find("Score");
        Fermeture.SetActive(false);
        Bienjoue.SetActive(false);
        genial.SetActive(false);
        excellent.SetActive(false);
        next = GameObject.Find("Next Level").GetComponent <Button>();

        score.GetComponent <Text>().text = "Score: " + GameManager.Score.ToString();

        switch (GameManager.Stars)
        {
        case 0:
            GameObject.Find("Main Camera").GetComponent <AudioSource>().clip = bad;
            GameObject.Find("Main Camera").GetComponent <AudioSource>().Play();
            Fermeture.SetActive(true);
            next.interactable = false;
            break;

        case 1:
            GameObject.Find("Main Camera").GetComponent <AudioSource>().clip = applause;
            GameObject.Find("Main Camera").GetComponent <AudioSource>().Play();
            Bienjoue.SetActive(true);
            Star1.SetActive(true);
            break;

        case 2:
            GameObject.Find("Main Camera").GetComponent <AudioSource>().clip = applause;
            GameObject.Find("Main Camera").GetComponent <AudioSource>().Play();
            genial.SetActive(true);
            Star1.SetActive(true);
            Star2.SetActive(true);
            break;

        case 3:
            GameObject.Find("Main Camera").GetComponent <AudioSource>().clip = applause;
            GameObject.Find("Main Camera").GetComponent <AudioSource>().Play();
            excellent.SetActive(true);
            Star1.SetActive(true);
            GameObject.Find("Canvas").GetComponent <AudioSource>().PlayOneShot(good);
            Star2.SetActive(true);
            Star3.SetActive(true);
            break;
        }
    }
コード例 #4
0
 void Start()
 {
     transform = GetComponent <RectTransform> ();
     width     = transform.rect.width;
     frame     = GameObject.Find("Frame").GetComponent <RectTransform> ();
     Star1     = GameObject.Find("Star1");
     Star1.SetActive(false);
     Star2 = GameObject.Find("Star2");
     Star2.SetActive(false);
     Star3 = GameObject.Find("Star3");
     Star3.SetActive(false);
 }
コード例 #5
0
ファイル: GameScenePopup.cs プロジェクト: mdanishs/quizville
    public void OnContinueClicked()
    {
        HidePopup();
        StartCoroutine(DeActivate(1f, () => { if (ContinueClicked != null)
                                              {
                                                  ContinueClicked();
                                              }
                                  }));
        AudioManager.Instance.PlaySound(AudioManager.SFX.CLICK);

        StarsPanel.SetActive(false);
        Star1.SetActive(false);
        Star2.SetActive(false);
        Star3.SetActive(false);
    }
コード例 #6
0
 void OutputStar()
 {
     if (PlayerPrefs.GetInt("Score") < 6)
     {
     }
     if (PlayerPrefs.GetInt("Score") > 6 && PlayerPrefs.GetInt("Score") < 12)
     {
         Star1.SetActive(true);
     }
     if (PlayerPrefs.GetInt("Score") > 12 && PlayerPrefs.GetInt("Score") < 20)
     {
         Star1.SetActive(true);
         Star2.SetActive(true);
     }
     if (PlayerPrefs.GetInt("Score") > 20)
     {
         Star1.SetActive(true);
         Star2.SetActive(true);
         Star3.SetActive(true);
     }
 }
コード例 #7
0
ファイル: GameScenePopup.cs プロジェクト: mdanishs/quizville
    IEnumerator ShowStars(int starsCount)
    {
        yield return(new WaitForSeconds(1f));

        if (starsCount >= 1)
        {
            Star1.SetActive(true);
            AudioManager.Instance.PlaySound(AudioManager.SFX.STAR);
            yield return(new WaitForSeconds(0.5f));
        }

        if (starsCount >= 2)
        {
            Star2.SetActive(true);
            AudioManager.Instance.PlaySound(AudioManager.SFX.STAR);
            yield return(new WaitForSeconds(0.5f));
        }

        if (starsCount >= 3)
        {
            Star3.SetActive(true);
            AudioManager.Instance.PlaySound(AudioManager.SFX.STAR);
        }
    }
コード例 #8
0
 public void Configure(int StarAchieved)
 {
     Star1.SetActive(StarAchieved >= 1);
     Star2.SetActive(StarAchieved >= 2);
     Star3.SetActive(StarAchieved >= 3);
 }
コード例 #9
0
    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);
        }
    }