Esempio n. 1
0
    public async Task GameOver(int gameScore, int totalTime, int trophyScore)
    {
        gameEnded = true;
        leaderboard.SetActive(true);
        submitUI.SetActive(true);

        while (!nameEntered)
        {
            await Task.Delay(500);
        }

        if (enteredName == null || enteredName == "")
        {
            Debug.LogError($"The entered name {name} is null or empty.");
        }

        leaderBoard.highScores = "";
        if (gameScore >= trophyScore)
        {
            leaderBoard.AddScore(enteredName, gameScore, totalTime, "Awesome");
        }
        else
        {
            leaderBoard.AddScore(enteredName, gameScore, totalTime);
        }

        await ShowHighscores(10000);
    }
 void Start()
 {
     if (PlayerPrefs.GetInt("Name") == 1)
     {
         dl.AddScore(PlayerNameInputField.text, 40);
     }
 }
Esempio n. 3
0
    void OnGUI()
    {
        scoreList = _MyLeaderBoard.ToListHighToLow();

        //Font Size
        GUI.skin.label.fontSize = 48;

        if (gs == GameState.ended)
        {
            if (_MyLeaderBoard.publicCode == "")
            {
                Debug.LogError("You forgot to set the public Code variable");
            }
            if (_MyLeaderBoard.privateCode == "")
            {
                Debug.LogError("You forgot to set the private Code variable");
            }

            _MyLeaderBoard.AddScore(_PlayerName, _Score);
            print("upload");
            gs = GameState.waiting;
        }

        if (gs == GameState.leaderboard)
        {
            if (scoreList == null)
            {
                GUILayout.Label("(Loading...)");
                //gs = GameState.waiting;
            }
            else
            {
                int maxToDisplay = 10;
                int count        = 0;

                float totalHeight = Screen.height * 0.66f;
                float heightEach  = totalHeight / maxToDisplay;
                textStyle.fontSize = (int)(heightEach * 0.6f);
                float areaWidth = 350;

                foreach (dreamloLeaderBoard.Score currentScore in scoreList)
                {
                    count++;

                    GUILayout.BeginArea(new Rect((Screen.width - 350) / 2, ((Screen.height - totalHeight) / 2) + count * heightEach, 350, heightEach));
                    GUILayout.BeginHorizontal("box");
                    GUILayout.Label(count + ") ", textStyle, GUILayout.MinWidth(areaWidth * 0.2f));
                    GUILayout.Label(currentScore.playerName, textStyle, GUILayout.MinWidth(areaWidth * 0.5f));
                    GUILayout.Label(currentScore.score.ToString(), textStyle, GUILayout.MinWidth(areaWidth * 0.3f));
                    GUILayout.EndHorizontal();
                    GUILayout.EndArea();

                    if (count >= maxToDisplay)
                    {
                        break;
                    }
                }
            }
        }
    }
Esempio n. 4
0
    public void Submit()
    {
        if (s1.GetComponent <Text>().text == "10")
        {
            score += 20;
        }
        if (s2.GetComponent <Text>().text == "10")
        {
            score += 20;
        }
        if (s3.GetComponent <Text>().text == "45")
        {
            score += 20;
        }
        if (s4.GetComponent <Text>().text == "10")
        {
            score += 20;
        }
        if (s5.GetComponent <Text>().text == "30")
        {
            score += 20;
        }

        if (yn.GetComponent <Toggle>().isOn == true)
        {
            y = 1;
        }

        nama = namaBox.GetComponent <Text>().text;

        board.AddScore(nama, score, y);
        mgr.finish = true;
        mgr.SceneChange(1);
    }
Esempio n. 5
0
    public async Task GameOver(int gameScore, int totalTime, int trophyScore)
    {
        gameEnded = true;
        leaderboard.SetActive(true);
        submitUI.SetActive(true);

        while (!nameEntered)
        {
            await Task.Delay(500);
        }

        if (enteredName == null || enteredName == "")
        {
            Debug.LogError($"The entered name {name} is null or empty.");
        }

        leaderBoard.highScores = "";
        leaderBoard.AddScore(enteredName, gameScore, totalTime);

        await ShowHighscores(10000);

        // TODO: Estimate a good trophy score
        if (gameScore >= trophyScore)
        {
            // TODO: Return trophy/proof of beating trophy score
        }
    }
Esempio n. 6
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.layer == LayerMask.NameToLayer("Player") || other.gameObject.layer == LayerMask.NameToLayer("PlayerImmunity"))
        {
            Time.timeScale = 0f;

            if (GameManager.Exist())
            {
                if (GameManager.instance.GetLevelsManager().GetMode())
                {
                    OptionsManager     optionsMng     = GameManager.instance.GetOptionsManager();
                    SpeedrunManager    speedRunMng    = LevelManager.instance.GetSpeedrunManager();
                    dreamloLeaderBoard leaderBoardMng = GameManager.instance.GetLeaderboard();
                    leaderBoardMng.AddScore(optionsMng.GetUserName(), speedRunMng.GetTimer());
                }

                GameManager.instance.GetSoundManager().StopMusic();
            }
            PlayerInputManager.SetCanReadInput(false);
            LevelManager.instance.GetUIGameplayManager().ToggleMenu(MenuType.EndGame);

            LevelManager.OnPlayerEndLevel?.Invoke();
            soundCtrl.PlayClip();
        }
    }
Esempio n. 7
0
 private void GameEnd()
 {
     EventSystem.current.SetSelectedGameObject(null);
     isGameEnd = true;
     leaderBoard.AddScore(PlayerName, score);
     Debug.Log("Game Finito");
 }
Esempio n. 8
0
    public void Submit()
    {
        _playerInitials = UIManager.inst.getInitials();
        PlayerPrefs.SetString("PlayerInitials", _playerInitials);

        //_playerUniqueName = SystemInfo.deviceUniqueIdentifier;
        // this doesn't work in some case
        // for example, in WebGL it generates NA as the identifier
        // this is why we do this
        if (PlayerPrefs.HasKey("UniqueIdentifier"))
        {
            _playerUniqueName = PlayerPrefs.GetString("UniqueIdentifier");
        }
        else
        {
            _playerUniqueName = System.Guid.NewGuid().ToString();
            PlayerPrefs.SetString("UniqueIdentifier", _playerUniqueName);
        }

        if (leaderboardFilter.Length > 0)
        {
            _playerUniqueName = leaderboardFilter + "_" + _playerInitials + "_" + _playerUniqueName;
        }
        _leaderboard.AddScore(_playerUniqueName, _finalScore, _finalDuraton, _playerInitials);

        UIManager.inst.showLoadingLeaderboards();
        setState(GameState.Leaderboard);

        StartCoroutine(updateLeaderboardCo());
    }
Esempio n. 9
0
    void ChangeLevel(int LevelCompleted)
    {
        var textWinRect = _textWin.GetComponent <RectTransform>();

        textWinRect.anchoredPosition = new Vector3(-6.3f, 81.2f, 0.0f);
        switch (LevelCompleted)
        {
        case 1:
            Level1Complete = true;
            break;

        case 2:
            Level2Complete = true;
            _textWin.text  = "P I Z Z A\nT I M E\nV I C T O R Y\nGo to the red door!\nPress \"E\" once there.";
            break;

        case 3:
            Level3Complete = true;
            leaderBoard.AddScore(vMainMenuController.playerName, TotalNumberPizzasPickedUp, (int)vTrackingTimer.times.Aggregate((curr, next) => curr + next));
            _textWin.text = string.Format("P I Z Z A\nT I M E\nV I C T O R Y\nTimes uploaded to leaderboard with username {0}.", vMainMenuController.playerName);
            break;

        default:
            break;
        }
        _audioSource.PlayOneShot(_audioClips[2]);
        Destroy(gameObject, _audioClips[2].length);
    }
Esempio n. 10
0
    IEnumerator CheckHighScore()
    {
        GameObject lbName  = GameObject.Find("/Canvas/LBName");
        GameObject lbScore = GameObject.Find("/Canvas/LBScore");

        dl.AddScore("abb", 1);

        List <dreamloLeaderBoard.Score> scoreList = dl.ToListHighToLow();

        while (scoreList.Count == 0)
        {
            yield return(new WaitForSeconds(1.0f));

            scoreList = dl.ToListHighToLow();
        }

        lbPlace = 1;
        foreach (dreamloLeaderBoard.Score currentScore in scoreList)
        {
            lbNameString  += "\n" + lbPlace + ": " + currentScore.playerName;
            lbScoreString += "\n" + currentScore.score.ToString();
            lbPlace++;
        }
        Text myLBName = lbName.GetComponent <Text>();

        myLBName.text = lbNameString;
        Text myLBScore = lbScore.GetComponent <Text>();

        myLBScore.text = lbScoreString;
    }
Esempio n. 11
0
    public int updateScore(int score)
    {
        Debug.Log("Atualizando pontuação no hanking");

        leaderBoard.AddScore(this.playerName, score);

        return(1);
    }
Esempio n. 12
0
    public void Submit()
    {
        int    score = mgr.score;
        string nama  = namaBox.GetComponent <Text>().text;

        board.AddScore(nama, score);

        mgr.firstTime = false;
        mgr.SceneChange(1);
    }
Esempio n. 13
0
 public void OnConfirmName()
 {
     SoundManager.PlaySound(selectSound);
     leaderBoard.AddScore(nameInput.text, Utils.TimeToScore(elapsedTime));
     PlayerPrefs.SetString("Name", nameInput.text);
     endingText.gameObject.SetActive(false);
     board.SetActive(true);
     buttons.SetActive(true);
     gameState = GameState.Leaderboard;
     GameObject.Find("Own").GetComponent <Text> ().text = "Your time: " + string.Format("{0:F1}", elapsedTime) + "s";
 }
 /// <summary>
 /// Saves high score to server
 /// </summary>
 public void SubmitHighScore()
 {
     if (dl.publicCode != "" && dl.privateCode != "")
     {
         if (PlayerPrefs.GetInt("score") != 0)
         {
             AudioManager.Instance.PlaySFX("SelectSmall");
             dl.AddScore(this.player.playerName, PlayerPrefs.GetInt("score"));
         }
     }
 }
Esempio n. 15
0
    public void getName()
    {
        playerName = name.text;

        dreamloLeaderBoard.Score sc = new dreamloLeaderBoard.Score();
        sc.playerName = playerName;
        sc.score      = GameObject.FindGameObjectWithTag("Player").GetComponent <BeeManager>().CurrentScore;
        scoreList.Add(sc);
        overWriteSc();

        dl.AddScore(playerName, GameObject.FindGameObjectWithTag("Player").GetComponent <BeeManager>().CurrentScore);
    }
Esempio n. 16
0
    void OnGUI()
    {
        if (gs == gameState.ended)
        {
            playerName = PlayerPrefs.GetString("Name");
            totalScore = GameManager.TotalScore;

            if (_MyLeaderBoard.publicCode == "")
            {
                Debug.LogError("You forgot to set the public Code variable");
            }
            if (_MyLeaderBoard.privateCode == "")
            {
                Debug.LogError("You forgot to set the private Code variable");
            }

            _MyLeaderBoard.AddScore(playerName, totalScore);

            print("Leaderboards");
            print(playerName + totalScore);
            gs = gameState.leaderboard;
        }

        if (gs == gameState.leaderboard)
        {
            GUILayout.Label("High Scores:");
            List <dreamloLeaderBoard.Score> scoreList = _MyLeaderBoard.ToListHighToLow();

            if (scoreList == null)
            {
                GUILayout.Label("(Loading...)");
            }
            else
            {
                int maxToDisplay = 15;
                int count        = 0;
                foreach (dreamloLeaderBoard.Score currentScore in scoreList)
                {
                    count++;
                    GUILayout.BeginHorizontal();
                    GUILayout.Label(currentScore.playerName);
                    GUILayout.Label(currentScore.score.ToString());
                    GUILayout.EndHorizontal();

                    if (count >= maxToDisplay)
                    {
                        break;
                    }
                }
            }
        }
    }
Esempio n. 17
0
    public void PlayerNameOK()
    {
        string name = nameField.text;

        PlayerPrefs.SetString("playerName", name);
        AddScore.SetActive(false);
        endButtons.SetActive(true);
        if (addScore)
        {
            DL.AddScore(name, score);
            addScore = false;
        }
    }
Esempio n. 18
0
    public void UploadScore(Action onDataAvailable)
    {
        if (dreamlo.publicCode == "")
        {
            Debug.LogError("Dreamlo: publicCode missing");
        }
        if (dreamlo.privateCode == "")
        {
            Debug.LogError("Dreamlo: privateCode missing");
        }

        dreamlo.AddScore(playerName, gameScore, onDataAvailable);
    }
Esempio n. 19
0
    public void addScoreToLeaderboard()
    {
        InputField input = GameObject.Find("NameInput").GetComponent <InputField> ();
        string     name  = input.text;

        if (name.Length != 0)
        {
            leaderboard.AddScore(name, score);
            input.text = "";
            StartCoroutine(waitAndLoadScore());
            StartCoroutine(waitAndPopulateLeaderboard());
        }
    }
Esempio n. 20
0
    void OnEnable()
    {
        dl = FindObjectOfType <dreamloLeaderBoard>();
        dl.AddScore(PlayerPrefs.GetString("Name"), PlayerPrefs.GetInt("highscore"));
        for (int i = 0; i < highScoreTexts.Length; i++)

        {
            highScoreTexts[i].text = i + 1 + ". Fetching...";
        }

        foreach (string name in easterEggNames)
        {
            if (PlayerPrefs.GetString("Name").Equals(name))
            {
                gameOverText.color = specialColor;
            }
        }
    }
Esempio n. 21
0
    public void addScore()
    {
        submit.SetActive(false);
        dl.AddScore(pseudo.text, hud.score);
        dreamloLeaderBoard.Score score = new dreamloLeaderBoard.Score();
        score.playerName = pseudo.text;
        score.score      = hud.score;
        scoreList.Add(score);

        //Reorder
        scoreList.Sort((x, y) => y.score.CompareTo(x.score));
        //Clean board
        foreach (Transform child in scorePanel.transform)
        {
            Destroy(child.gameObject);
        }
        populateBoard();
        Debug.Log("submit");
    }
Esempio n. 22
0
    //Informar o Hiscore
    public void SubmitHiScore()

    {
        this.dl = dreamloLeaderBoard.GetSceneDreamloLeaderboard();
        if (dl.publicCode == "")
        {
            Debug.LogError("You forgot to set the publicCode variable");
        }
        if (dl.privateCode == "")
        {
            Debug.LogError("You forgot to set the privateCode variable");
        }
        GameObject.FindWithTag("NewHiScoreButton").GetComponent <Button>().interactable  = false;
        GameObject.FindWithTag("NewHiScoreButton").GetComponentInChildren <Text>().text  = "Done!";
        GameObject.FindWithTag("HiScoreTxtBox").GetComponent <InputField>().interactable = false;


        dl.AddScore(this.playerName, fusions, GameObject.FindWithTag("GameController").GetComponent <Counter>().difficultyAdd);
    }
    System.Collections.IEnumerator AddScoreRoutine()
    {
        dl.AddScore(playerName.text, score);
        //yield return new WaitForSeconds(2.1f);
        //dl.LoadScores();
        used = true;
        yield return(new WaitForSeconds(2.1f));

        scoreList = dl.ToListHighToLow();
        yield return(new WaitForSeconds(2.1f));

        DisplayScores();
        addScoreBtnText.text = "Saved";
        yield return(new WaitForSeconds(2.1f));

        scoreList = dl.ToListHighToLow();
        yield return(new WaitForSeconds(2.1f));

        DisplayScores();
    }
Esempio n. 24
0
    public void SubmitScore()
    {
        if (ls == leaderboardState.leaderboard)
        {
            return;
        }
        int score = player.mantisDestroyedCount;
        int time  = (int)player.timeAlive;

        value = input.text;
        if (value.Length == 0)
        {
            return;
        }
        submitScore.interactable = false;
        input.interactable       = false;
        dl.AddScore(value, score, time);
        restartOnLoad = true;
        ls            = leaderboardState.leaderboard;
        Debug.Log("Submitted score " + score + " as " + value);
    }
Esempio n. 25
0
    public void SetScore(){

       
        var totaldtravel =  PrefsManager.instance.getDistanceTravelled();
        var newdist =  totaldtravel + DistanceController.distanceTravelled;
        if(newdist > 15500){

            var ty1 = 15500 - newdist;
            PrefsManager.instance.resetTravelledCards();
            PrefsManager.instance.SetDistanceTravelled(ty1);
        
        }else{
        
            PrefsManager.instance.SetDistanceTravelled(newdist);
        
        }
            PrefsManager.instance.totalDistance =  PrefsManager.instance.getDistanceTravelled();


       // dreamloRef.AddScore(PrefsManager.instance.getUserName(), DistanceController.distanceTravelled);


        //Debug.Log("new data on tavel distance :--===" + PrefsManager.instance.totalDistance);
       // if (DistanceController.distanceTravelled <= 0 || DistanceController.distanceTravelled <= PrefsManager.instance.getHighScore() ) return;
        
          

        var usr =  new User();
        usr.userName = PrefsManager.instance.getUserName();
        usr.userScore = DistanceController.distanceTravelled;
        usr.userid =  PrefsManager.instance.getUserID();
        PrefsManager.instance.SetHighScore(usr.userScore);

        dreamloRef.AddScore(PrefsManager.instance.getUserName(), DistanceController.distanceTravelled);



        RestClient.Post("https://tlsttree-b30cb.firebaseio.com/.json", usr);

    }
Esempio n. 26
0
    IEnumerator savescore()
    {
        WWW www = new WWW(dl.dreamloWebserviceURL + "5bae2eb1613a88061429d460" + "/pipe-get/" + WWW.EscapeURL("bY0dqpzLrCvwt2iO3aOg"));

        yield return(www);

        string s = www.text;

        char[] dollarSign = "$".ToCharArray();
        char[] stick      = "|".ToCharArray();


        string[] all            = s.Split(stick[0]);
        string   gameInfoString = all[3];

        string[] splittedGameInfo = gameInfoString.Split(dollarSign[0]);

        switch (splittedGameInfo[1].ToString().ToLower())
        {
        case "true":
            break;

        case "false":
            PlayerPrefs.SetInt("sidsteKlub", klub.value);
            // add the score...
            if (dl.publicCode == "")
            {
                Debug.LogError("You forgot to set the publicCode variable");
            }
            if (dl.privateCode == "")
            {
                Debug.LogError("You forgot to set the privateCode variable");
            }

            dl.AddScore(GOInput.text + "$" + klub.value + "$" + PlayerPrefs.GetString("PlayerID"), Points);     // add the score
            dl.LoadScores();
            StartCoroutine(DumbWaitHAckAgain());
            break;
        }
    }
Esempio n. 27
0
    public void Cease(int count)
    {
        endTime  = Time.time;
        elapsed  = (Mathf.FloorToInt((endTime - startTime) * 10)) / 10f; // Get 1 decimal place.
        finished = true;
        float ratio      = (elapsed / count) * 100f;
        int   boardScore = 5000 - Mathf.FloorToInt(ratio);

        if (boardScore < 0)
        {
            boardScore = 1;
        }
        Debug.Log("New score: " + boardScore);
        ratio = Mathf.FloorToInt(ratio) / 100f; // Get 2 decimal places.
        string customName = pilot.ID + Splitter + pilot.Unique;

        if (Application.platform != RuntimePlatform.WebGLPlayer)
        {
            leaderboard.AddScore(customName, boardScore, Mathf.FloorToInt(ratio * 100), pilot.Unique);
        }
        records.AddRecord(ratio);
        records.Parse();
    }
Esempio n. 28
0
 public void SubmitScore()
 {
     dl.AddScore(playerNameInput.text, lapCount);
 }
Esempio n. 29
0
 public void PublishScoreToGlobalRating(string name)
 {
     globalRating.AddScore(name, Score);
     Debug.Log("Результат добавлен в общий рейтинг:" + name + " " + Score);
 }
    /**
     * Update is called once per frame.
     */
    void Update()
    {
        OVRInput.Update();

        // Display the number of cycles left in the therapy.
        ScoreText.GetComponent <Text>().text = "Cycles Left: " + (numOfCycles - cycleCounter).ToString();

        // Set game over to true once the therapy rounds are completed.
        if (cycleCounter == numOfCycles)
        {
            gameOver = true;
        }

        if (!gameOver)
        {
            leader.SetActive(false);

            // If there are stones left, bring towards the player on inhale.
            if (canSummon && Input.GetKey(KeyCode.Space) || OVRInput.Get(OVRInput.RawButton.RIndexTrigger) || flag == 1)
            {
                if (count == stones.Count)
                {
                    Debug.Log("No more stones left");
                }
                else
                {
                    cont = stones[count].GetComponent <ParabolaController>();
                    isMovingTowardsPlayer = true;
                    //vfx[count].transform.GetChild(0).gameObject.SetActive(false);

                    if (stoneHandUpdate)
                    {
                        CanvasText.GetComponent <Text>().text = "Inhale Target Time: " + inhaleTime.ToString();
                        coroutineInhale = StartCoroutine(countDownInhale(inhaleTime));

                        stoneHandDistance  = Vector3.Distance(stones[count].transform.position, transform.position);
                        stoneHandDistance -= 0.4f;
                        stoneHandUpdate    = false;
                    }
                    if (Vector3.Distance(stones[count].transform.position, transform.position) > 0.45f)
                    {
                        stones[count].transform.position = Vector3.MoveTowards(stones[count].transform.position, transform.position + transform.forward * 0.4f - transform.up * 0.1f, Time.deltaTime * (stoneHandDistance / inhaleTime));
                    }
                }
            }

            // called if player stops inhaling before stone reaches the player

            //else if (move && flag!=1 && Vector3.Distance(stones[count].transform.position, transform.position) > 0.2f)
            else if (isMovingTowardsPlayer && !Input.GetKey(KeyCode.Space) && Vector3.Distance(stones[count].transform.position, transform.position) > 0.45f)
            {
                stones[count].GetComponent <Rigidbody>().useGravity = true;
                StopCoroutine(coroutineInhale);
                //vfx[count].SetActive(false);
                count++;
                isMovingTowardsPlayer = false;

                stoneHandUpdate = true;

                cycleCounter++;
            }


            // for the stone to always be in front of the camera
            if (Vector3.Distance(stones[count].transform.position, this.transform.position) <= 0.45f)
            {
                stones[count].transform.position = transform.position + transform.forward * 0.4f - transform.up * 0.1f;

                //stones[count].transform.rotation = new Quaternion(0.0f, transform.rotation.y, 0.0f, transform.rotation.w);
            }


            // When stone has arrived
            if ((Input.GetKey(KeyCode.D) || OVRInput.Get(OVRInput.RawButton.A) || flag == 3) && Vector3.Distance(stones[count].transform.position, this.transform.position) <= 0.45f && fruitCount < fru.Count && s.stay)
            {
                vfx[count].SetActive(true);
                //vfx[count].transform.GetChild(0).gameObject.SetActive(true);

                isMovingTowardsPlayer = false;
                canShoot  = true;
                canSummon = false;

                GameObject.Find("Trails").GetComponent <ParticleSystem>().Play();
                GameObject point1 = new GameObject();
                GameObject point2 = new GameObject();
                GameObject point3 = new GameObject();
                GameObject root   = new GameObject();
                point1.name               = "child1";
                point2.name               = "child2";
                point3.name               = "child3";
                root.name                 = "parent";
                point1.transform.parent   = root.transform;
                point2.transform.parent   = root.transform;
                point3.transform.parent   = root.transform;
                point1.transform.position = stones[count].transform.position;
                point3.transform.position = s.go.transform.position;
                point2.transform.position = new Vector3((point1.transform.position.x + point3.transform.position.x) / 2, point3.transform.position.y + 0.3f, (point1.transform.position.z + point3.transform.position.z) / 2);



                if (!cont.enabled)
                {
                    cont.enabled = true;
                }
                if (stoneFruitUpdate)
                {
                    CanvasText.GetComponent <Text>().text = "Exhale Target Time: " + exhaleTime.ToString();
                    coroutineExhale = StartCoroutine(countDownExhale(exhaleTime));

                    stoneFruitDistance  = Vector3.Distance(stones[count].transform.position, s.go.transform.position);
                    stoneFruitDistance -= 1f;
                    cont.Speed          = stoneFruitDistance / exhaleTime;

                    stoneFruitUpdate = false;
                }
                cont.ParabolaRoot = root;
                cont.Autostart    = true;
                cont.Animation    = true;
                cont.Speed        = stoneFruitDistance / exhaleTime;
            }


            // when player stops exhaling before stone hits the fruit
            //else if (canShoot && flag!=3 && Vector3.Distance(stones[count].transform.position, transform.position) >= 1f)
            // For keyboard playability, uncomment else if below and comment out the else if on line 221.
            //else if (canShoot && !Input.GetKey(KeyCode.D) && Vector3.Distance(stones[count].transform.position, transform.position) >= 1f)
            else if (canShoot && flag != 3 && Vector3.Distance(stones[count].transform.position, transform.position) >= 1f)
            {
                stones[count].GetComponent <Rigidbody>().useGravity = true;
                vfx[count].SetActive(false);
                count++;
                StopCoroutine(coroutineExhale);


                cont.enabled     = false;
                canSummon        = true;
                canShoot         = false;
                stoneHandUpdate  = true;
                stoneFruitUpdate = true;

                cycleCounter++;
            }


            //When stone has hit the fruit
            if (s.go && count < stones.Count && stones[count] && Vector3.Distance(stones[count].transform.position, s.go.transform.position) < 1f && fruitCount < fru.Count)
            {
                var particleEffect = stones[count].transform.GetChild(0);
                stones[count].transform.GetChild(0).transform.parent = null;

                stones[count].GetComponent <Rigidbody>().useGravity = true;
                playPluck = true;
                CanvasText.GetComponent <Text>().text = "Inhale Target Time: " + inhaleTime.ToString();
                Destroy(stones[count]);
                //toDestory.Add(vfx[count]);
                for (int i = 0; i < 3; i++)
                {
                    GameObject.Find("stoneVFX").transform.GetChild(i).gameObject.GetComponent <ParticleSystem>().Stop();
                }
                StartCoroutine(destory(vfx[count]));
                count++;
                s.go.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.None;
                s.go.GetComponent <Rigidbody>().isKinematic = false;
                s.go.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezeRotationY | RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationZ;
                s.go.GetComponent <Rigidbody>().useGravity  = true;

                ParticleSystem points = s.go.transform.GetChild(1).gameObject.GetComponent <ParticleSystem>();
                points.Play();

                score += 5;

                fruitCount++;

                canShoot         = false;
                canSummon        = true;
                stoneHandUpdate  = true;
                stoneFruitUpdate = true;

                cycleCounter++;
            }
        }
        else
        {
            ScoreText.GetComponent <Text>().text      = "";
            CanvasText.GetComponent <Text>().text     = "";
            FinalScoreText.GetComponent <Text>().text = "Final Score: " + score + "/" + (numOfCycles * 5);

            leader.SetActive(true);

            if (fwLeaderBoard.publicCode == "")
            {
                Debug.LogError("You forgot to set the publicCode variable");
            }
            if (fwLeaderBoard.privateCode == "")
            {
                Debug.LogError("You forgot to set the privateCode variable");
            }

            fwLeaderBoard.AddScore(userName, (int)(100 * score / (numOfCycles * 5)));
            //fwLeaderBoard.GetScores();

            List <dreamloLeaderBoard.Score> scoreList = fwLeaderBoard.ToListHighToLow();


            if (scoreList == null)
            {
                Debug.Log("(loading...)");
            }
            else
            {
                int maxToDisplay = 6;
                int countScr     = 0;
                foreach (dreamloLeaderBoard.Score currentScore in scoreList)
                {
                    countScr++;

                    //Debug.Log(currentScore.score.ToString());
                    topRankList.text  += countScr + "\n";
                    topScoreList.text += currentScore.score.ToString() + "%\n";
                    topNameList.text  += currentScore.playerName.Replace("+", " ") + "\n";

                    if (countScr >= maxToDisplay)
                    {
                        break;
                    }
                }
            }
        }
    }