-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflipFlop.cs
29 lines (25 loc) · 934 Bytes
/
flipFlop.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using UnityEngine;
public class flipFlop : MonoBehaviour
{
public GameObject eventReceiver;
public bool Tracker = false;
public string Option1;
public string Option2;
public void toggle()
{
Tracker = !Tracker; // Set Tracker to the opposite of its current state
// Check if eventReceiver is not null
if (eventReceiver != null)
{
// Get the AnimationAction component on eventReceiver
AnimatorCast animatorCast = eventReceiver.GetComponent<AnimatorCast>();
// Check if AnimationAction is not null
if (animatorCast != null)
{
// Call the Rollcall method and pass the appropriate string argument based on Tracker's value
string optionToPass = Tracker ? Option1 : Option2;
animatorCast.RollCall(optionToPass);
}
}
}
}