Created
November 10, 2022 11:58
-
-
Save saitocastel1900/136722a8cf47a5d8202db310ec180aa6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using UniRx; | |
using UnityEngine; | |
namespace Gauge | |
{ | |
public class Model | |
{ | |
public IReadOnlyReactiveProperty<int> Value => _value; | |
private IntReactiveProperty _value { set; get; } | |
public event Action OnCallback; | |
/// <summary> | |
/// コンストラクタ | |
/// </summary> | |
/// <param name="value"></param> | |
public Model(int value=0) | |
{ | |
_value=new IntReactiveProperty(value); | |
} | |
/// <summary> | |
/// スコアを更新(加算) | |
/// </summary> | |
/// <param name="value"></param> | |
public void UpdateCount(int value) | |
{ | |
_value.Value = Mathf.Clamp(value, 0, 10); | |
if (_value.Value >= 10) OnCallback?.Invoke(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment