I'm developing a slot game in Unity. For every spin, I send a spin request to server and get the results from server and set final position of symbols on screen. I want to keep wheels rolling till server response is handled.
Currently, It rolls in a given period and for a specified number of turn. Is there any means of achieving this?
LTDescr action = LeanTween.value(gameObject, 0f, 1f, duration).setOnUpdate((float dt) =>
{
float curr = h * dt;
int currTile = (int)(curr / _tileSize.y);
float delta = curr - prev;
for (int i = 0; i < count; i++)
{
CSSymbol s = _symbols[i];
Vector3 v = s.transform.localPosition;
v.y -= delta;
if (v.y - min.y <= 0.01f) // Symbols that get down of screen should be moved back to starting point
{
v.y = max.y + (v.y - min.y);
CSSymbolType type = CSSymbolType.SymbolNone;
if (i < count - 1 && currTile > lastRoll)
{
// Last roll
type = _reelRandom.SmartRandomSymbol(); // set resulting symbol list
}
else
{
type = _reelRandom.RandomSymbol(); // get random symbol type
}
s.SetType(type);
}
s.transform.localPosition = v; // set new symbol
}
prev = curr;
}).setEaseInOutSine().setDelay((float)_column * delay);