Exemplo n.º 1
0
    IEnumerator SelectBallsRoutine()
    {
        LottoPicks.Clear();
        lightsmanager.startLights();
        lightsmanager.setBlinkSpeed(0.075f);
        yield return(new WaitForSecondsRealtime(10f));

        for (int cnt = 0; cnt < 6; cnt++)
        {
            lightsmanager.setBlinkSpeed(0.075f);
            //Debug.Log ("Number of Picks: " + cnt);
            float waitTime = MyTools.getRandomNumber(CumProDensFunct, minOpenTime, maxOpenTime);
            //Debug.Log ("wait " + waitTime);
            //System.DateTime start = System.DateTime.Now;
            yield return(new WaitForSecondsRealtime(waitTime));

            //System.DateTime end = System.DateTime.Now;
            //Debug.Log (end.Subtract (start).TotalSeconds);
            if (BottomLid)
            {
                lightsmanager.setBlinkSpeed(0.75f);
                BottomLid.openLid();
                while (PickedBallID == 0)
                {
                    yield return(null);
                }
                if (PickedBallID != 0)
                {
                    //Debug.Log ("Loto picked " + PickedBallID);
                    LottoPicks.Add(PickedBallID);
                    PickedBallID = 0;
                }
            }
            else
            {
                //Debug.Log ("Bottom Lid is empty!");
            }
        }

        // stop rotators
        sweeperManager.StopSweeping(4f);
        lightsmanager.stopLights();
        //Debug.Log ("Guess Success: " + calculateSuccess ());
        int nSucc = calcNguess();

        loadsave.UpdateScore(nSucc, LottoPicks);
        HiscoreList.RefreshNameList();


        // save stats
        //statManager.updateStats(LottoPicks, nSucc);
        yield return(new WaitForSecondsRealtime(14f));

        ResultBar.setBarImage(nSucc);         //  .fillAmount = (float)nSucc / (float)LottoPicks.Count;
        setNewGameState(GameState.Results);
    }