예제 #1
0
    public void SetValues(int id, string name, bool isMainPlayer)
    {
        print("Score Panel Checked Values - " + playerid);
        playerName = name;
        UpdateId(id);

        if (!isMainPlayer)
        {
            if (mainPlayer != null)
            {
                mainPlayer.GetComponent <RectTransform> ().SetAsLastSibling();
            }
            //GameObject.Find ("PowerUps").GetComponent<RectTransform>().SetAsFirstSibling();
        }
        else
        {
            /*gameObject.GetComponent<LayoutElement> ().minHeight = bigSize;*/
            gameObject.GetComponent <RectTransform> ().SetAsLastSibling();
            //GameObject.Find ("PowerUps").GetComponent<RectTransform>().SetAsFirstSibling();
            gameObject.gameObject.name = "Score Panel Main Player";
            mainPlayer = this;
        }

        Invoke("UpdateGfxAgain", 0.5f);
    }
예제 #2
0
    public void addScore(string message, int addedScore)
    {
        scores.Add(new ScoreEntry()
        {
            message = message, addedScore = addedScore
        });

        if (!scorePanel.GetComponent <Animator>().GetBool("newScore"))
        {
            startScoreAnimation();
        }
    }
예제 #3
0
    void Update()
    {
        if (countDown <= 0 && stop == false && making == false)
        {
            StartCoroutine(SpawnBlock(round));
            countDown = timeBetweenWaves;
        }

        if (waveStart != GameObject.Find("UserData").GetComponent <PlayerStats>().waveIndex&& stop == true && enemies.Count == 0)
        {
            Debug.Log("Cambiando de juego");
            //changeScene = true;
            StartCoroutine(ChangeScene());
        }



        countDown -= Time.deltaTime;

        countDown = Mathf.Clamp(countDown, 0f, Mathf.Infinity);

        roundPanel.GetComponent <Text>().text  = GameObject.Find("UserData").GetComponent <PlayerStats>().waveIndex.ToString();
        healthPanel.GetComponent <Text>().text = PlayerStats.life.ToString();
        MoneyPanel.GetComponent <Text>().text  = PlayerStats.money.ToString();
        ScorePanel.GetComponent <Text>().text  = PlayerStats.score.ToString();
    }
예제 #4
0
    public void getScrollEntrys()
    {
        //Destroy Objects that exists, because of a possible Call before
        foreach (Transform childTransform in ScrollContain.transform)
        {
            Destroy(childTransform.gameObject);
        }

        int j = 1;

        for (int i = 0; i < LeaderboardController.Instance.onlineHighscore.Length - 1; i++)
        {
            GameObject ScorePanel;
            ScorePanel = Instantiate(ScrollEntry) as GameObject;
            ScorePanel.transform.parent     = ScrollContain.transform;
            ScorePanel.transform.localScale = ScrollContain.transform.localScale;
            Transform ThisScoreName = ScorePanel.transform.Find("ScoreText");
            Text      ScoreName     = ThisScoreName.GetComponent <Text> ();
            //
            Transform ThisScorePoints = ScorePanel.transform.Find("ScorePoints");
            Text      ScorePoints     = ThisScorePoints.GetComponent <Text> ();
            //
            Transform ThisScorePosition = ScorePanel.transform.Find("ScorePosition");
            Text      ScorePosition     = ThisScorePosition.GetComponent <Text> ();

            //first position is green
            if (j == 1)
            {
                ScorePanel.GetComponent <Image> ().color = new Color32(0xFF, 0xFF, 0xFF, 0xE0);
                Color32 c = new Color32(0x4C, 0x47, 0x47, 0xFF);
                ScoreName.color     = c;
                ScorePoints.color   = c;
                ScorePosition.color = c;
            }
            ScorePosition.text = j + ". ";
            string helpString = "";

            helpString = helpString + LeaderboardController.Instance.onlineHighscore [i] + " ";
            i++;

            ScoreName.text = helpString;

            //
            ScorePoints.text = LeaderboardController.Instance.onlineHighscore [i];

            if (LeaderboardController.Instance.onlineHighscore [i] == "9999")
            {
                ScoreName.color     = Color.red;
                ScorePoints.color   = Color.red;
                ScorePosition.color = Color.red;
                yourPosition        = j;
            }
            j++;
        }
    }
예제 #5
0
    public void getScrollEntrys()
    {
        int position = 1;

        //Destroy Objects that exists, because of a possible Call before
        foreach (Transform childTransform in ScrollContain.transform)
        {
            Destroy(childTransform.gameObject);
        }

        for (int i = 0; i < LeaderboardController.Instance.onlineHighscore.Length - 1; i++)
        {
            GameObject ScorePanel;
            ScorePanel = Instantiate(ScrollEntry) as GameObject;
            ScorePanel.transform.SetParent(ScrollContain.transform);
            //ScorePanel.transform.localScale = ScrollContain.transform.localScale;

            Transform ThisScoreName = ScorePanel.transform.Find("Name");
            Text      ScoreName     = ThisScoreName.GetComponent <Text> ();
            //
            Transform ThisScorePoints = ScorePanel.transform.Find("Score");
            Text      ScorePoints     = ThisScorePoints.GetComponent <Text> ();
            //
            Transform ThisScorePosition = ScorePanel.transform.Find("Position");
            Text      ScorePosition     = ThisScorePosition.GetComponent <Text> ();

            Transform ThisScoreLevel = ScorePanel.transform.Find("Level");
            Text      ScoreLevel     = ThisScoreLevel.GetComponent <Text>();


            string helpString = "";
            ThisScorePosition.GetComponent <Text>().text = (position).ToString();
            position++;
            helpString = helpString + LeaderboardController.Instance.onlineHighscore [i];
            i++;
            ScoreName.text = helpString;

            ScorePoints.text = FormatTime(float.Parse(LeaderboardController.Instance.onlineHighscore[i]));
            i++;
            ScoreLevel.text = LeaderboardController.Instance.onlineHighscore[i];

            ThisScoreLevel.gameObject.SetActive(false);

            if (ScoreLevel.text.Equals("Quarto"))
            {
                ScorePanel.GetComponent <RawImage>().color = new Color32(180, 90, 100, 255);
            }
            else if (ScoreLevel.text.Equals("Banheiro"))
            {
                ScorePanel.GetComponent <RawImage>().color = new Color32(74, 126, 192, 255);
            }
            else if (ScoreLevel.text.Equals("Cozinha"))
            {
                ScorePanel.GetComponent <RawImage>().color = new Color32(23, 149, 100, 255);
            }
            else if (ScoreLevel.text.Equals("Sala"))
            {
                ScorePanel.GetComponent <RawImage>().color = new Color32(183, 182, 94, 255);
            }
            else if (ScoreLevel.text.Equals("Geral"))
            {
                ScorePanel.GetComponent <RawImage>().color = new Color32(255, 255, 255, 255);
            }
        }
    }