IEnumerator Crash()
        {
            //crash entries
            CrashBetEntryUtility.OnCrash();

            //destroy multiplier spawner and seconds spawner
            foreach (Spawner s in GameObject.Find("Canvas/Graph").GetComponentsInChildren <Spawner>())
            {
                Destroy(s.gameObject);
            }

            //hide arrow
            arrow.gameObject.SetActive(false);

            //handle rest of crash stuff
            lr.enabled = false;
            CrashBetHandler.DisableBetting();

            //count down until 0
            float timeTillRoundStart = 5f;

            while (timeTillRoundStart > 0)
            {
                timeTillRoundStart -= Time.deltaTime;
                graphDisplay.text   = "Crashed @ " + string.Format("{0:0.00}", multiplier) + "x\n" +
                                      string.Format("{0:0.00}", timeTillRoundStart) + "s until next round...";
                yield return(null);
            }

            //prepare for next round
            CrashBetHandler.ResetBetPanel();
            Destroy(this.gameObject);
        }
Exemple #2
0
        //static variable initializer
        void Awake()
        {
            et = entryTemplate;
            ct = container;

            instance = this;
        }
        public void WithdrawBet()
        {
            CrashBetEntryUtility.WithdrawEntry(betEntryIndex, bet, CrashGrapher.multiplier);

            //change add profit to vlads
            Client playerInfo = player.GetComponent <Client>();

            playerInfo.Vlads += Mathf.RoundToInt(bet * CrashGrapher.multiplier);
        }
        public void PlaceBet()
        {
            if (player == null)
            {
                return;
            }

            //make sure bet is valid
            Client playerInfo = player.GetComponent <Client>();

            if (bet <= playerInfo.Vlads)
            {
                disabledPanel.SetActive(true);

                //handle bet
                betEntryIndex = CrashBetEntryUtility.CreateEntry(playerInfo.Username, bet);
                allowWithdraw = true;

                playerInfo.Vlads -= bet;
            }
        }