コード例 #1
0
ファイル: SquareScript.cs プロジェクト: IsakRein/BLOX
    public void LoadPreviousColor()
    {
        colorNum             = Manager.previousColorList[number];
        spriteRenderer.color = setColor[colorNum];

        foreach (Transform child in transform)
        {
            if (child.name == "CountDown(Clone)")
            {
                GameObject.Destroy(child.gameObject);
            }
        }

        if (Manager.selectedTheme == 7)
        {
            spriteRenderer.sprite = circle;
        }

        if (Manager.selectedTheme == 8)
        {
            spriteRenderer.sprite = Manager.cats[colorNum];
        }

        if (colorNum == setColor.Length - 1)
        {
            if (Manager.selectedTheme == 7)
            {
                spriteRenderer.sprite = deadCircle;
            }

            else
            {
                spriteRenderer.sprite = lineScript.deadSquare;
            }

            countDownPrefab = (GameObject)Resources.Load("Prefabs/CountDown", typeof(GameObject));
            countDown       = Instantiate(countDownPrefab, transform);
            countDown.transform.rotation = Quaternion.Euler(new Vector3(0, 0, 0));

            countDownCounter = Manager.previousDeadSquareCounterList[number];

            countDown.GetComponentInChildren <TextMeshProUGUI>().SetText(countDownCounter.ToString());
        }

        else
        {
            if (Manager.selectedTheme == 7)
            {
                spriteRenderer.sprite = circle;
            }

            else if (Manager.selectedTheme == 8)
            {
                spriteRenderer.sprite = Manager.cats[colorNum];
            }

            else
            {
                spriteRenderer.sprite = lineScript.regularSquare;
            }
        }

        if (colorNum == setColor.Length - 1)
        {
            lineScript.AddToDeadSquareCounterList(number, countDownCounter);
        }

        else
        {
            lineScript.AddToDeadSquareCounterList(number, 0);
        }

        UpdateColorlist();
    }