Example #1
0
        void Update()
        {
            if (loose)
            {
                return;
            }

            if (win)
            {
                player.Win();
                return;
            }

            if (timer > 0)
            {
                timer -= Time.deltaTime;
                if ((int)timer < currentTime)
                {
                    SetTimerText();
                }

                player.Move();
                player.Rotate();
                player.SetAnimatorParams();

                coinManager.CheckDistanceCoinsPlayer(player.position);

                if (coinManager.coinsTaken > currentCoinsTaken)
                {
                    currentCoinsTaken        = coinManager.coinsTaken;
                    coinsTakenCountText.text = "Taken coins: " + currentCoinsTaken;
                }

                CheckDistanceToFinish();
            }
            else
            {
                Loose();
            }
        }