public void Spin(float delay, float acceleration, float speed) { if (_spinSettings.endSpin == SpinType.All) { _delayAmount = 0f; } else { _delayAmount = _index * delay; } _acceleration = acceleration <= 0 ? GameExtension.GetRandomValue(_spinSettings.acceleration) : acceleration; _timeCounter = 0f; _currentSpeed = speed <= 0f ? GameExtension.GetRandomValue(_spinSettings.startSpeed) : speed; _yOffset = 0f; _increaseSpeed = true; _inClamp = false; _inSpin = true; OnSpinStart?.Invoke(this._index); }
public void Spin() { if (!_inSpin) { horizontalLayout.enabled = false; _inSpin = true; _acceleration = settings.spinSettings.useSameAcceleration ? GameExtension.GetRandomValue(settings.spinSettings.acceleration) : 0f; _speed = settings.spinSettings.useSameSpeed ? GameExtension.GetRandomValue(settings.spinSettings.startSpeed) : 0f; _delayAmongReel = GameExtension.GetRandomValue(settings.spinSettings.delayAmongReels); if (settings.spinSettings.startSpin == SpinType.All) { foreach (var reel in reels) { reel.ResetShape(); reel.Spin(_delayAmongReel, _acceleration, _speed); } } else if (settings.spinSettings.startSpin == SpinType.Single) { //start spin the first reel reels[0].ResetShape(); reels[0].Spin(_delayAmongReel, _acceleration, _speed); //init delay variables _timeCounter = 0; _reelIndex = 1; _isSingleSpin = true; } } UIManager.Instance.UpdateSpinBtn(_inSpin); }