Ejemplo n.º 1
0
        IEnumerator GameLoop()
        {
            //forever loop unless game is stopped
            while (enableGameLoop)
            {
                //count down until 0
                float timeTillRoundStart = 7.5f;

                while (timeTillRoundStart > 0)
                {
                    timeTillRoundStart -= Time.deltaTime;
                    MultiplierText.text = "Start Betting!\n" + string.Format("{0:0.00}", timeTillRoundStart) + "s until next round...";
                    yield return(null);
                }

                //disable bettin and enable withdraw
                CrashBetHandler.DisableBetting();
                CrashBetHandler.EnableWithdraw();

                //start the round
                string gameSeed = RandomHashUtil.GenerateHash();

                //reset marker values
                SecondsMarker.ResetValues();
                MultiplierMarker.ResetValues();

                //instantiate marker spawners
                RectTransform sms = Instantiate(SecondsMakerSpawner);
                sms.SetParent(GameObject.Find("Canvas/Graph").transform);
                sms.anchoredPosition3D = Vector3.zero;
                sms.localScale         = Vector3.one;
                RectTransform mms = Instantiate(MultiplierMarkerSpawner);
                mms.SetParent(GameObject.Find("Canvas/Graph").transform);
                mms.anchoredPosition3D = Vector3.zero;
                mms.localScale         = Vector3.one;

                //instantiate crash arrow
                Transform cr = Instantiate(CrashArrow);
                cr.GetComponent <CrashGrapher>().seed = gameSeed;

                //wait until the grapher is killed
                yield return(new WaitUntil(() => cr == null));
            }
        }
Ejemplo n.º 2
0
        Vector3 GetPointPosition(float i)
        {
            //100 pixels is one unit in world space
            Vector3 point = Vector3.zero;

            //set coords
            point.x = i * SecondsMarker.getDistance();
            point.y = Mathf.Pow(.1f * i, 2) * MultiplierMarker.getLerpedDistance();
            point.z = 0;
            point  += OriginOffset * 100;

            //force y to be non-negative
            point.y = Mathf.Max(point.y, graphStartY * 100);

            //convert to world space
            point /= 100;

            return(point);
        }