Esempio n. 1
0
        /// <summary>
        /// 停止摇奖(开奖)
        /// </summary>
        /// <param name="target">传入-1直接停止选中消失,不为-1为正常开奖</param>
        public void StopTrun(int target = -1, CschGameManager.NoParamDelegate OnFinish = null)
        {
            if (target == -1)
            {
                isTurn = false;
                Selected.gameObject.SetActive(false);
            }
            else
            {
                if (OnFinish != null)
                {
                    DrawFinishDelegate = OnFinish;
                }

                if (CurTurnCount < _minTurnCount)
                {
                    _saveTarget = target;
                    return;
                }

                _increasingDis = Random.Range(MinStopDistance, MinStopDistance + 5);


                _stopDistance   = target <= _curItemsIndex ? target + Items.Length - _curItemsIndex : target - _curItemsIndex;
                _stopDistance  += _stopDistance < _increasingDis ? Items.Length : 0;
                _increasingTime = (MaxTime - CurTimeSpace) / _increasingDis;
                _isReadyStop    = true;

                //操控仪表指针、方向盘变化
                CarSpeedPoint.GetInstance().CarPointStatus = CarSpeedPoint.Status.speedDown;
                CarSpeedPoint.GetInstance().allowShake     = true;
                SteeringWheel.GetInstance().DoRotate(true);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 开始摇奖
        /// </summary>
        public void StartTrun()
        {
            isTurn        = true;
            _minTurnCount = Random.Range(2, 4);
            CurTurnCount  = 0;
            Selected.gameObject.SetActive(true);
            startIndex       = _curItemsIndex;
            CurTimeSpace     = MinTime;
            _increasingTime  = 0f;
            _isReadyStop     = false;
            _curStopDistance = 0;
            _increasingDis   = 0;

            //操控仪表指针、方向盘变化
            CarSpeedPoint.GetInstance().CarPointStatus = CarSpeedPoint.Status.speedUp;
            Facade.Instance <MusicManager>().Play("CarEngine");
            SteeringWheel.GetInstance().DoRotate();
        }
Esempio n. 3
0
 void Awake()
 {
     instance = this;
 }