48 lines
1.2 KiB
C#
48 lines
1.2 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace game
|
|
{
|
|
public abstract class ScratchCardMask : MonoBehaviour
|
|
{
|
|
//public Action<ScratchCardMask, float, bool> RevealProgressChanged;
|
|
|
|
public bool IsRevealed()
|
|
{
|
|
if (m_Threshold <= 0f) return true;
|
|
return GetRevealProgress() >= m_Threshold;
|
|
}
|
|
public void SetThreshold(float threshold)
|
|
{
|
|
m_Threshold = threshold;
|
|
}
|
|
|
|
[Header("Mask")]
|
|
[Range(0f, 1.0f)]
|
|
[SerializeField] protected float m_Threshold = 0.75f;
|
|
[SerializeField] protected float m_AlphaThreshold = 0.5f;
|
|
|
|
public abstract float GetRevealProgress();
|
|
|
|
//protected void OnRevealProgressChanged()
|
|
//{
|
|
// float progress = 0f;
|
|
// bool isRevealed = false;
|
|
|
|
// if (m_Threshold <= 0)
|
|
// {
|
|
// isRevealed = true;
|
|
// }
|
|
// else
|
|
// {
|
|
// progress = GetRevealProgress();
|
|
// isRevealed = progress >= m_Threshold;
|
|
// }
|
|
|
|
// //RevealProgressChanged?.Invoke(this, progress, isRevealed);
|
|
//}
|
|
}
|
|
}
|