summaryrefslogtreecommitdiff
path: root/Thronefall_v1.0/Decompile/Coinslot.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Thronefall_v1.0/Decompile/Coinslot.cs')
-rw-r--r--Thronefall_v1.0/Decompile/Coinslot.cs76
1 files changed, 76 insertions, 0 deletions
diff --git a/Thronefall_v1.0/Decompile/Coinslot.cs b/Thronefall_v1.0/Decompile/Coinslot.cs
new file mode 100644
index 0000000..4a505f1
--- /dev/null
+++ b/Thronefall_v1.0/Decompile/Coinslot.cs
@@ -0,0 +1,76 @@
+using MoreMountains.Feedbacks;
+using UnityEngine;
+
+public class Coinslot : MonoBehaviour
+{
+ public Transform fillTarget;
+
+ public AnimationCurve fillCurve;
+
+ public MMF_Player fullFeedback;
+
+ public MMF_Player deniedFeedback;
+
+ public MMF_Player appearFeedback;
+
+ public MMF_Player disappearFeedback;
+
+ public MMF_Player fullCompleteFeedback;
+
+ private float fill01;
+
+ public bool isFull => fill01 >= 1f;
+
+ public float CurrentFill01 => fill01;
+
+ public bool AddFill(float percentage, bool isLastCoin)
+ {
+ fill01 += percentage;
+ fillTarget.localScale = Vector3.one * fillCurve.Evaluate(Mathf.Clamp01(fill01));
+ if (isFull)
+ {
+ if (!isLastCoin)
+ {
+ fullFeedback.PlayFeedbacks();
+ }
+ else
+ {
+ fullCompleteFeedback.PlayFeedbacks();
+ }
+ return true;
+ }
+ return false;
+ }
+
+ public void SetEmpty()
+ {
+ fill01 = 0f;
+ fillTarget.localScale = Vector3.zero;
+ }
+
+ public void PlayDeny()
+ {
+ deniedFeedback.PlayFeedbacks();
+ }
+
+ public void Appear()
+ {
+ fullFeedback.StopFeedbacks();
+ deniedFeedback.StopFeedbacks();
+ appearFeedback.StopFeedbacks();
+ disappearFeedback.StopFeedbacks();
+ fill01 = 0f;
+ fillTarget.localScale = Vector3.zero;
+ base.transform.localScale = Vector3.zero;
+ appearFeedback.PlayFeedbacks();
+ }
+
+ public void Disappear()
+ {
+ fullFeedback.StopFeedbacks();
+ deniedFeedback.StopFeedbacks();
+ appearFeedback.StopFeedbacks();
+ disappearFeedback.StopFeedbacks();
+ disappearFeedback.PlayFeedbacks();
+ }
+}