コード例 #1
0
    IEnumerator SceneFade(float seconds, float speed)
    {
        float titleVolume = 0;

        CampaignSelectionManager.Instanse.titleRect.SetParent(sceneryRect, false);

        Vector2 localPoint;

        RectTransformUtility.ScreenPointToLocalPointInRectangle(sceneryRect,
                                                                new Vector2(Screen.width / 2, Screen.height), DarkestDungeonManager.Instanse.MainUICamera, out localPoint);
        CampaignSelectionManager.Instanse.titleRect.localPosition = localPoint;

        if (DarkestSoundManager.TitleMusicInstanse != null)
        {
            DarkestSoundManager.TitleMusicInstanse.getVolume(out titleVolume);

            for (float nextVolume = titleVolume; nextVolume >= 0; nextVolume -= Time.deltaTime * 3f)
            {
                DarkestSoundManager.TitleMusicInstanse.setVolume(nextVolume);
                yield return(null);
            }
        }

        DarkestSoundManager.StopTitleMusic();
        DarkestSoundManager.PlayOneShot("event:/general/title_screen/start_game");

        while (true)
        {
            if (seconds <= 0)
            {
                break;
            }
            else
            {
                seconds -= Time.deltaTime;
            }

            Vector2 offsetMax = sceneryRect.offsetMax;
            offsetMax.y          += Time.deltaTime * speed;
            sceneryRect.offsetMax = offsetMax;
            Vector2 offsetMin = sceneryRect.offsetMin;
            offsetMin.y          += Time.deltaTime * speed;
            sceneryRect.offsetMin = offsetMin;
            yield return(0);
        }

        PhotonNetwork.LoadLevel("DungeonMultiplayer");
        yield break;
    }