Esempio n. 1
0
    // Start is called before the first frame update
    void Start()
    {
        screenWidth  = (float)Screen.width / 100;
        screenHeight = (float)Screen.height / 100;

        resultSpriteRenderer = GetComponent <SpriteRenderer>();

        resultSpriteRenderer.size = new Vector2(6.4f * screenHeight / 11.36f, screenHeight);

        RectTransform frame = scoreFrame.GetComponent <RectTransform>();

        // AudioManagerへのアタッチ
        if (!GameObject.Find("AudioManager"))
        {
            Instantiate(audioManagerPrefab, new Vector3(0.0f, 0.0f, 0.0f), Quaternion.identity).name = "AudioManager";
        }
        audioManager = GameObject.Find("AudioManager").GetComponent <AudioManager>();

        // SkinManagerへのアタッチ
        if (!GameObject.Find("SkinSupport"))
        {
            Instantiate(skinSupportPrefab, new Vector3(0.0f, 0.0f, 0.0f), Quaternion.identity).name = "SkinSupport";
        }
        skinSupport = GameObject.Find("SkinSupport").GetComponent <SkinSupport>();
        player.GetComponent <SpriteRenderer>().color = new Vector4(
            skinSupport.GetPlayerColor().r * 140 / 255.0f,
            skinSupport.GetPlayerColor().g * 140 / 255.0f,
            skinSupport.GetPlayerColor().b * 140 / 255.0f,
            1.0f);

        if (canvasOldScene = GameObject.Find("Canvas"))
        {
            score = canvasOldScene.GetComponentInChildren <Score>();
            Destroy(canvasOldScene);
        }
        else
        {
            scoreOther.gameObject.SetActive(true);
            score       = scoreOther;
            score.tag   = "Score";
            score.score = 100;
        }

        score.transform.SetParent(scoreDisplay.transform);

        scoreBest.scoreIndex = score.scoreIndex;

        canvasManager.SetScorePosition(-40.0f, frame.anchoredPosition.y - 15.0f);
        canvasManager.SetScoreSize(0.65f, 0.65f);

        //rank.LoadRankBinary();

        rank.LoadRank();

        if (rank.CheckIfRankIn(score.score))
        {
            inputer.gameObject.SetActive(true);
            // 入力処理
            rank.SetNewRankInfo("Player", score.score);
            rank.SortRank();
            //rank.SortRankBinary();
        }

        scoreBest.SetScore((float)rank.LoadChampionInfo().score / score.scoreIndex);

        canvasManager.SetScoreBestPosition(45.0f, frame.anchoredPosition.y - 175.0f);
        canvasManager.SetScoreBestSize(0.48f, 0.48f);

        // BGMの再生
        audioManager.PlayBGM(AudioManager.BGM.BGM_RESULT);

        hasCreatedSoul = false;

        fade.SetFadeState(Fade.FadeState.FADE_STATE_IN);
    }