Esempio n. 1
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "finish")
        {
            TinySauce.OnGameFinished(PlayerPrefs.GetInt("Level").ToString(), true, 0);
            finish           = true;
            move.finish_bool = true;
            GameObject.Find("Computer").GetComponent <move>().PlaySound("sound2", 0.7f);
            stars.SetActive(true);
            //PlayerPrefs.SetInt("scene", int.Parse(SceneManager.GetActiveScene().name));

            int currentLevel = PlayerPrefs.GetInt("Level");
            currentLevel++;
            PlayerPrefs.SetInt("Level", currentLevel);
            Invoke("LoadNewLevel", 2f);
        }
        else
        {
            move.score += 1;
            slider.GetComponent <Slider>().value = move.score;
            GameObject.Find("Score_New").GetComponent <Text>().text = move.score.ToString();
            GameObject.Find("Computer").GetComponent <move>().PlaySound("sound1", 0.7f);

            int random = Random.Range(0, 2);
            if (random == 1)
            {
                other.transform.parent.gameObject.GetComponent <Animator>().Play("cube_break");
            }
            else
            {
                other.transform.parent.gameObject.GetComponent <Animator>().Play("cube_break2");
            }
        }
    }
Esempio n. 2
0
    void LevelUp()
    {
        int stars = PlayerPrefs.GetInt("level" + currentLevel.ToString() + "stars", 0);
        int currStars;

        if (attempts == 1)
        {
            currStars = 3;
        }
        else if (attempts <= 3)
        {
            currStars = 2;
        }
        else
        {
            currStars = 1;
        }

        TinySauce.OnGameFinished(true, currStars, levelNumber: currentLevel.ToString());

        if (currStars > stars)
        {
            PlayerPrefs.SetInt("level" + currentLevel.ToString() + "stars", currStars);
        }

        kickEnabled = false;
        StopAllCoroutines();
        animator.SetBool("levelComplete", true);
    }
Esempio n. 3
0
    void VoodooFinish(bool isLevelComplete = true)
    {
#if VOODOO_LEVEL
        TinySauce.OnGameFinished("" + Level, isLevelComplete, Score);
#elif VOODOO_NO_LEVEL
        TinySauce.OnGameFinished("game", isLevelComplete, Score);
#endif
    }
Esempio n. 4
0
    public void RestartLevel()
    {
        int dCollected = playerNref.DiamondCollected;

        TinySauce.OnGameFinished(levelNumber: clt.ToString(), false, dCollected);

        Level = SceneManager.GetActiveScene();
        SceneManager.LoadScene(Level.name);
    }
Esempio n. 5
0
 private void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject.tag == "enemy" || collision.gameObject.tag == "sea")
     {
         //SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
         TinySauce.OnGameFinished(PlayerPrefs.GetInt("Level").ToString(), false, 0);
         levelGenerator.LoadSameLevel();
         GameObject.FindGameObjectWithTag("slider").GetComponent <Slider>().value = 0;
     }
 }
Esempio n. 6
0
 public void restartPressed()
 {
     if (level_complete)
     {
         TinySauce.OnGameFinished(cur_level.ToString(), level_complete, enemyCount);
         PlayerPrefs.SetInt("cur_level", cur_level + 1);
         SceneManager.LoadScene(0);
     }
     else
     {
         TinySauce.OnGameFinished(cur_level.ToString(), level_complete, enemyCount);
         SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
     }
 }
Esempio n. 7
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.name == "Character")
     {
         //MainPanel.SetActive(true);
         GamePanel.SetActive(false);
         Right.GetComponent <MoveRight>().ispressed = false;
         Left.GetComponent <MoveLeft>().ispressed   = false;
         PlayerPrefs.SetInt("state", 0);
         PlayerPrefs.SetFloat("realPoints", PlayerPrefs.GetFloat("points"));
         TinySauce.OnGameFinished(PlayerPrefs.GetFloat("realPoints"));
         characterFunction();
     }
 }
Esempio n. 8
0
    public void ShowNextui()
    {
        if (!NLuiShown)
        {
            NextlevelUI.SetActive(true);
            int dCollected = playerNref.DiamondCollected * playerNref.Rewardstore;


            TinySauce.OnGameFinished(levelNumber: clt.ToString(), true, dCollected);


            NLuiShown = true;

            // PlayerPrefs.SetInt("")
        }
    }
Esempio n. 9
0
    public void GameOverFunk()
    {
        isGameOver     = true;
        Time.timeScale = 1;

        GameManager.instance.GameOverFunc();


        Invoke("WaitForStatsCounting", 2);
        _cameraAnimation.Play();

        TextRenderer();
        SetRecord();

        TinySauce.OnGameFinished(Score.instance.GetScore());
    }
Esempio n. 10
0
    public void gameOver()
    {
        TinySauce.OnGameFinished(score);

        if (score > PlayerPrefs.GetInt("score"))
        {
            PlayerPrefs.SetInt("score", score);
        }
        EasyMobileProManager.reportScore(score);


        isGameOver = true;
        SoundManager._inst.playSFXCorot(EnumsData.SFXEnum.lose, .1f);
        SoundManager._inst.playSFXCorot(EnumsData.SFXEnum.monsterLaugh, .6f);
        Time.timeScale = 0.4f;
        PlayerController._inst.onPlayerDie();
        MasterUI._inst.onGameOver();
        //Invoke("reloadScene", 2.2f);
    }
Esempio n. 11
0
    public void LevelComplete()
    {
        foreach (var item in activateStuff)
        {
            item.SetActive(true);
        }


        //while build enable this statement
        if (SceneManager.GetActiveScene().buildIndex < 1)
        {
            StartCoroutine(LoadLevelAfterDelay(currentSceneIndex + 1));
            TinySauce.OnGameFinished(levelNumber: (currentSceneIndex + 1).ToString(), 1);
        }
        else
        {
            StartCoroutine(LoadLevelAfterDelay(0));
            TinySauce.OnGameFinished(levelNumber: (currentSceneIndex + 1).ToString(), 0);
        }
    }
Esempio n. 12
0
 private void SavePlayerProgress()
 {
     RememberPlayer();
     SaveData();
     TinySauce.OnGameFinished(_playerData.Level.ToString(), _playerData.LevelProgress);
 }
Esempio n. 13
0
 public void GoNextLevel()
 {
     Debug.Log("wdaskasd");
     TinySauce.OnGameFinished(SceneManager.GetActiveScene().buildIndex.ToString(), 0);
 }
Esempio n. 14
0
 private void CollidedWall()
 {
     DeactiveScripts();
     TinySauce.OnGameFinished(SceneManager.GetActiveScene().buildIndex.ToString(), 0);
 }
Esempio n. 15
0
 public void Send_FinishEvent()
 {
     TinySauce.OnGameFinished(true, 999999, "(!)_FINISH_EVENT_DEBUG_(!)");
     DisplayFeedbackText("Finish event sent successfully.");
 }
Esempio n. 16
0
    void Update()
    {
        // if(Input.touchCount > 0 && startFlag == 0)
        if (Input.GetMouseButton(0) && startFlag == 0)
        {
            startFlag = 1;
            // this.gameObject.transform.GetChild(10).transform.localPosition = new Vector3(-0.026f,0.93f,-0.32f);
            // this.gameObject.transform.GetChild(10).transform.localEulerAngles = new Vector3(0f,180f,0f);
        }

        if (finishFlag == 0 && top.finishFlag == 0)
        {
            if (startFlag == 1)
            {
                rb.velocity        = new Vector3(Mathf.Clamp(rb.velocity.x, -5f, 5f), rb.velocity.y, rb.velocity.z);
                rb.angularVelocity = Vector3.zero;
                rb.velocity        = new Vector3(rb.velocity.x, 0f, fwdSpeed);
                anim.SetBool("start", true);
            }
            if (Input.touchCount > 0)
            {
                Touch touch = Input.GetTouch(0);
                if (touch.phase == TouchPhase.Began)
                {
                    startPos = touch.position;
                }
                if (touch.phase == TouchPhase.Moved)
                {
                    if (Mathf.Sqrt((touch.position.x * startPos.x) + (touch.position.y * startPos.y)) > 0.05f && Input.GetAxis("Mouse X") != 0f)
                    {
                        rb.AddForce(Vector3.right * sideSpeed * Input.GetAxis("Mouse X"));
                        sideTilt = Mathf.SmoothDamp(sideTilt, -20f * Input.GetAxis("Mouse X"), ref sideTiltVelocity, 8f * Time.deltaTime);
                        sideTilt = Mathf.Clamp(sideTilt, -8.5f, 8.5f);
                    }
                    else
                    {
                        sideTilt    = Mathf.SmoothDamp(sideTilt, 0f, ref sideTiltVelocity, 10f * Time.deltaTime);
                        rb.velocity = new Vector3(Mathf.SmoothDamp(rb.velocity.x, 0f, ref sideVel, 8f * Time.deltaTime), 0f, rb.velocity.z);
                    }
                }
                else
                {
                    sideTilt    = Mathf.SmoothDamp(sideTilt, 0f, ref sideTiltVelocity, 10f * Time.deltaTime);
                    rb.velocity = new Vector3(Mathf.SmoothDamp(rb.velocity.x, 0f, ref sideVel, 8f * Time.deltaTime), 0f, rb.velocity.z);
                }
            }
            else
            {
                sideTilt    = Mathf.SmoothDamp(sideTilt, 0f, ref sideTiltVelocity, 10f * Time.deltaTime);
                rb.velocity = new Vector3(Mathf.SmoothDamp(rb.velocity.x, 0f, ref sideVel, 8f * Time.deltaTime), 0f, rb.velocity.z);
            }
            //rb.rotation = Quaternion.Euler(new Vector3(sideTilt,90-sideTilt ,0f));
            rb.rotation = Quaternion.Euler(new Vector3(0f, -sideTilt, -sideTilt));
        }
        else if (finishFlag == 1 && top.finishFlag == 0)
        {
            TinySauce.OnGameFinished((SceneManager.GetActiveScene().buildIndex + 1).ToString(), 1);
            rb.velocity = Vector3.SmoothDamp(rb.velocity, Vector3.zero, ref refvel, smoothZero);
            anim.speed  = Mathf.SmoothDamp(anim.speed, 0f, ref refAnim, 1f);
            if (offsetFlag == 0)
            {
                followCam.smoothSpeed = 1f;
                followCam.smoothFov   = 1f;
                followCam.offset      = new Vector3(followCam.offset.x, followCam.offset.y, followCam.offset.z - 3f);
                followCam.fov        += 5f;
                offsetFlag            = 1;
            }
        }
        else if (top.finishFlag == 1)
        {
            rb.velocity    = Vector3.zero;
            rb.constraints = rbConstraints;
        }
        if (rb.velocity.z >= -1f && rb.velocity.z <= 1f && activeFlag == 0 && top.finishFlag == 0 && startFlag == 1)
        {
            levelCleared.SetActive(true);
            Instantiate(confetti, transform.position + new Vector3(0f, 3f, 0f), Quaternion.identity);
            activeFlag = 1;
        }
        //  transform.eulerAngles = new Vector3(transform.eulerAngles.x,transform.eulerAngles.x + sideTilt + 90,transform.eulerAngles.z + sideTilt);
    }