Linked Rotator with Pink Field
This commit is contained in:
@@ -13,17 +13,13 @@ public class RandomRotator : MonoBehaviour
|
||||
private int currentIndex = 0;
|
||||
private float lastTimeSwitched = 0;
|
||||
private int stopIndex = 0;
|
||||
public UIHandler uiHandler;
|
||||
|
||||
public void SetOptionsText(int index, string text)
|
||||
{
|
||||
textOptions[index].text = text;
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
StartRandom();
|
||||
}
|
||||
|
||||
private void ColorOption(int index)
|
||||
{
|
||||
for (int i = 0; i < options.Length; i++)
|
||||
@@ -39,16 +35,17 @@ public class RandomRotator : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
private float slowDown = 0.5f;
|
||||
private void Update()
|
||||
{
|
||||
if (started)
|
||||
{
|
||||
if (Time.time - lastTimeSwitched > 0.1f)
|
||||
if (Time.time - lastTimeSwitched > 0.2f)
|
||||
{
|
||||
lastTimeSwitched = Time.time;
|
||||
ColorOption(currentIndex);
|
||||
currentIndex++;
|
||||
if (currentIndex > options.Length - 1)
|
||||
if (currentIndex > options.Length)
|
||||
{
|
||||
currentIndex = 0;
|
||||
}
|
||||
@@ -56,7 +53,24 @@ public class RandomRotator : MonoBehaviour
|
||||
}
|
||||
else
|
||||
{
|
||||
ColorOption(stopIndex);
|
||||
if (currentIndex != stopIndex)
|
||||
{
|
||||
if (Time.time - lastTimeSwitched > slowDown)
|
||||
{
|
||||
slowDown += 0.2f;
|
||||
lastTimeSwitched = Time.time;
|
||||
ColorOption(currentIndex);
|
||||
currentIndex++;
|
||||
if (currentIndex > options.Length)
|
||||
{
|
||||
currentIndex = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ColorOption(stopIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user