きゅぶろぐ

きゅぶんずの ぶろぐができて べんりだな

Unity1Weekに参加して "SquareSquare" を公開しました!開発記録。

今回は動画を見せたいというのもあってツイートからの転載多めでお送りします。

Unity1Weekとは?

Unityを使って1週間でゲームを作るイベントです。
https://unityroom.com/unity1weeks

今回の試み

Enter Play Mode Options

ReloadDomain Offでやってみる。
めっちゃ早くて幸せ。

XDでUIを高速開発

AnimeTaskでアニメを付ける

var score = new ReactiveProperty<int>(0);
score.SubscribeTask(async (x, c) =>
{
    scoreCounter.text = $"{x}";
    await Easing.Create<OutBounce>(2f, 1f, 0.5f).ToLocalScale(scoreCounter, c);
});

アウトゲームのフローこんな感じに書けると嬉しい

private async UniTask MainFlow()
{
    while (true)
    {
        // タイトル画面
        {
            var (titleObject, titleUi) = OpenUi<TitleUiElements>(titlePrefab);
            titleUi.HighScore.text = $"HighScore : {_highScore}";

            var titleCanvasGroup = titleObject.AddComponent<CanvasGroup>();
            await Easing.Create<Linear>(0f, 1f, 0.5f).ToAction(x => titleCanvasGroup.alpha = x);

            while (true)
            {
                var clicked = await UniTask.WhenAny(
                    titleUi.StartButton.OnClickAsync(),
                    titleUi.LicenseButton.OnClickAsync()
                );

                if (clicked == 1)
                {
                    await ShowLicenseWindow();
                    continue;
                }

                break;
            }

            await Easing.Create<Linear>(1f, 0f, 0.5f).ToAction(x => titleCanvasGroup.alpha = x);
            Destroy(titleObject);
        }

        // InGame
        var score = await inGameFlow.StartMainFlow();
        var isNewRecord = score > _highScore;
        if (isNewRecord) _highScore = score;

        // リザルト画面
        {
            var (resultObject, resultUi) = OpenUi<ResultUiElements>(resultPrefab);
            resultUi.ScoreText.text = $"Score : {score}";
            resultUi.NewRecord.gameObject.SetActive(isNewRecord);

            var resultCanvasGroup = resultObject.AddComponent<CanvasGroup>();
            await Easing.Create<Linear>(0f, 1f, 0.5f).ToAction(x => resultCanvasGroup.alpha = x);
            await resultUi.ReturnButton.OnClickAsync();
            await Easing.Create<Linear>(1f, 0f, 0.5f).ToAction(x => resultCanvasGroup.alpha = x);
            Destroy(resultObject);
        }
    }
}