|
|
@ -23,22 +23,40 @@ public class Category : MonoBehaviour |
|
|
|
HideAllFeedback(); |
|
|
|
} |
|
|
|
|
|
|
|
public void ShowFeedbackGood(int streak) |
|
|
|
public int ShowFeedbackGood(int streak) |
|
|
|
{ |
|
|
|
ShowFeedback(_feedbackGood); |
|
|
|
int streakPayout = GetStreakPayout(streak); |
|
|
|
if (streakPayout > 0) |
|
|
|
ShowFeedback(_feedbackGood, duration:2f); |
|
|
|
else |
|
|
|
ShowFeedback(_feedbackGood); |
|
|
|
|
|
|
|
_streak.SetActive(true); |
|
|
|
_streak.GetComponent<TMPro.TMP_Text>().text = "10"; |
|
|
|
_streak.GetComponent<TMPro.TMP_Text>().color = Color.green; |
|
|
|
if (streak > 1) |
|
|
|
if (streakPayout > 0) |
|
|
|
{ |
|
|
|
_streak.GetComponent<TMPro.TMP_Text>().text += " x " + streak; |
|
|
|
_streak.SetActive(true); |
|
|
|
_streak.GetComponent<TMPro.TMP_Text>().text = ""; |
|
|
|
_streak.GetComponent<TMPro.TMP_Text>().color = Color.blue; |
|
|
|
_streak.GetComponent<TMPro.TMP_Text>().text = streak + " in a row\n+" + streakPayout + " bonus"; |
|
|
|
} |
|
|
|
|
|
|
|
return streakPayout; |
|
|
|
} |
|
|
|
|
|
|
|
int GetStreakPayout(int streak) |
|
|
|
{ |
|
|
|
if (streak == 3) |
|
|
|
return 1; |
|
|
|
else if (streak == 5) |
|
|
|
return 1; |
|
|
|
else if (streak > 5 && streak % 5 == 0) //every other 5
|
|
|
|
return 3; |
|
|
|
else |
|
|
|
return 0; |
|
|
|
} |
|
|
|
|
|
|
|
public void ShowFeedbackBad(string wrongAnswer) |
|
|
|
{ |
|
|
|
ShowFeedback(_feedbackBad); |
|
|
|
ShowFeedback(_feedbackBad, duration: 2f); |
|
|
|
|
|
|
|
if (SHOW_RIGHT_ANSWERS) |
|
|
|
{ |
|
|
@ -48,11 +66,11 @@ public class Category : MonoBehaviour |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void ShowFeedback(SpriteRenderer feedback, bool show = true) |
|
|
|
void ShowFeedback(SpriteRenderer feedback, bool show = true, float duration = 1f) |
|
|
|
{ |
|
|
|
feedback.enabled = show; |
|
|
|
CancelInvoke(); |
|
|
|
Invoke("HideAllFeedback", 1f); |
|
|
|
Invoke("HideAllFeedback", duration); |
|
|
|
} |
|
|
|
|
|
|
|
void HideAllFeedback() |
|
|
|