add DifficultyChanger.cs

This commit is contained in:
kimura 2022-08-01 15:50:13 +09:00
parent 0a72e4f36a
commit 4f4607685d
3 changed files with 44 additions and 0 deletions

View File

@ -1860,6 +1860,7 @@ GameObject:
- component: {fileID: 1870432533}
- component: {fileID: 1870432536}
- component: {fileID: 1870432535}
- component: {fileID: 1870432537}
m_Layer: 0
m_Name: Manager
m_TagString: Untagged
@ -1944,6 +1945,18 @@ MonoBehaviour:
generateStageCount: 1
beginStageOffset: 0.5
partsToPartsOffset: 0
--- !u!114 &1870432537
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1870432532}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a554772b1d9244b29ee1ba77aae187a5, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &1932485204
MonoBehaviour:
m_ObjectHideFlags: 0

View File

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using UniRx;
using UnityEngine;
namespace MyGame.Scenes.MiniGame.Scripts
{
public class DifficultyChanger : MonoBehaviour
{
public IReadOnlyReactiveProperty<ScrollGameDifficulty> Difficulty => difficulty;
private readonly ReactiveProperty<ScrollGameDifficulty> difficulty = new();
private readonly CompositeDisposable changeDifficultyDisposable = new();
private ScrollGameStageDifficultyData difficultyData;
private void Start()
{
difficulty.AddTo(this);
changeDifficultyDisposable.AddTo(this);
}
public void SetData(ScrollGameStageDifficultyData data) => difficultyData = data;
public void UpdateTime(float elapsed)
{
difficulty.Value = difficultyData.GetDifficultySwitchTime(elapsed);
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: a554772b1d9244b29ee1ba77aae187a5
timeCreated: 1659335216