void CollectBerry(GameObject berry)
 {
     tpc.berryCount += 1;
     BerrySpawnManager.PlayBerryNoise(false);
     if (berry.transform.Find("BlobShadowProjector") != null)
     {
         berry.transform.Find("BlobShadowProjector").gameObject.SetActive(false);
     }
     StartCoroutine(MoveBerry(berry));
 }
Exemplo n.º 2
0
    IEnumerator BerryReward(int amount)
    {
        if (amount >= 5)
        {
            tpc.berryCount += 5;
        }
        else
        {
            tpc.berryCount += amount;
        }
        tpc.UpdateBerryHUDRed();
        BerrySpawnManager.PlayBerryNoise(false);
        amount -= 5;
        yield return(new WaitForSeconds(0.2f));

        if (amount > 0)
        {
            StartCoroutine(BerryReward(amount));
        }
    }
Exemplo n.º 3
0
    void OnTriggerStay(Collider other)
    {
        if ((other.gameObject.tag == "Player"))
        {
            //    Debug.Log(this.transform.parent.name + " " + canCollect +" "+ this.movingBerry);
            if (canCollect && !this.movingBerry)
            {
                if (collectibleType == "Berry")
                {
                    chara = other.gameObject.GetComponent <TPC>();
                    chara.berryPFX.PlayEffect(0, this.transform.position, null, Vector3.zero, false);
                    this.bagpack = chara.dayPack;
                    this.origPos = this.transform.position;
                    if (sphereCol != null)
                    {
                        sphereCol.enabled = false;
                    }
                    if (PlayerPrefs.GetInt("AllFlowers", 0) == 1)
                    {
                        value *= 2;
                    }
                    chara.berryCount += value;
                    CheckPSTrophies(value, chara);
                    BerrySpawnManager.PlayBerryNoise(false);
                    chara.UpdateBerryHUDRed();
                    this.movingBerry = true;
                    this.berryIt     = 0;
                    StartCoroutine(MoveBerry());
                }
                if (collectibleType == "BigBerry")
                {
                    chara = other.gameObject.GetComponent <TPC>();
                    chara.berryPFX.PlayEffect(0, this.transform.position, null, Vector3.zero, false);
                    this.bagpack = chara.dayPack;
                    this.origPos = this.transform.position;
                    if (sphereCol != null)
                    {
                        sphereCol.enabled = false;
                    }
                    value = 5;
                    if (PlayerPrefs.GetInt("AllFlowers", 0) == 1)
                    {
                        value = 10;
                    }
                    StartCoroutine(MultiCollect(value));
                    CheckPSTrophies(value, chara);
                    BerrySpawnManager.PlayBerryNoise(true);
                    this.movingBerry = true;
                    this.berryIt     = 0;
                    StartCoroutine(MoveBerry());
                }

                /*    if (collectibleType == "BlueBerry")
                 *  {
                 *      if (PlayerPrefs.GetInt("FirstBlueBerry", 0) == 0)
                 *      {
                 *          PlayerPrefs.SetInt("FirstBlueBerry", 1);
                 *          GameObject.FindWithTag("Pause").transform.Find("Event Text").gameObject.GetComponent<TextTriggerMain>().SetText(1);
                 *      }
                 *
                 *      chara = other.gameObject.GetComponent<TPC>();
                 *      chara.berryPFX.PlayEffect(1, this.transform.position, null, Vector3.zero, false);
                 *      this.bagpack = chara.dayPack;
                 *      this.origPos = this.transform.position;
                 *      if (sphereCol != null)
                 *          sphereCol.enabled = false;
                 *      chara.blueberryCount += value;
                 *      BerrySpawnManager.PlayBlueBerryNoise(other.gameObject.GetComponent<TPC>().pID);
                 *      chara.UpdateBerryHUDBlue();
                 *      this.movingBerry = true;
                 *      this.berryIt = 0;
                 *      StartCoroutine(MoveBerry());
                 *  }*/
            }
        }
    }
    /*
     * private void OnEnable()
     * {
     *  StartCoroutine("CheckDistance");
     * }
     */

    public void CollectBerry(GameObject berry, BerryType berryType, int amount, bool playFX, int initAmount)
    {
        if (amount <= 0)
        {
            amount     = 1;
            initAmount = 1;
        }
        if (berryType == BerryType.red || berryType == BerryType.redCircle)
        {
            if (playFX)
            {
                if (PlayerPrefs.GetInt("FirstRedBerry", 0) == 0)
                {
                    PlayerPrefs.SetInt("FirstRedBerry", 1);
                    textMain.SetText(0);
                }
                tpc.berryPFX.PlayEffect(0, berry.transform.position, null, Vector3.zero, false);

                if (amount == 1)
                {
                    BerrySpawnManager.PlayBerryNoise(false);
                }
                else
                {
                    BerrySpawnManager.PlayBerryNoise(true);
                }
            }
            tpc.berryCount++;
            if (PlayerPrefs.GetInt("AllFlowers", 0) == 1)
            {
                tpc.berryCount++;
                CheckPSTrophies(2);
            }
            else
            {
                CheckPSTrophies(1);
            }


            tpc.UpdateBerryHUDRed();
        }
        if (berryType == BerryType.blue)
        {
            if (playFX)
            {
                if (PlayerPrefs.GetInt("FirstBlueBerry") == 0)
                {
                    PlayerPrefs.SetInt("FirstBlueBerry", 1);
                    textMain.SetText(1);
                }
                tpc.berryPFX.PlayEffect(1, berry.transform.position, null, Vector3.zero, false);
            }

            tpc.blueberryCount += amount;
            tpc.UpdateBerryHUDBlue();

            //     tpc.ps.CheckBlues();
            PlayerPrefs.SetInt("BlueBerryTotal", PlayerPrefs.GetInt("BlueBerryTotal") + 1);

#if UNITY_PS4
            // check trophy
            if (PlayerPrefs.GetInt("BlueBerryTotal") >= 100)
            {
                PS4Manager.ps4TrophyManager.UnlockTrophy((int)PS4_TROPHIES.COLLECT_100_BLUE_BERRIES);
            }
            //
            if (PlayerPrefs.GetInt("BlueBerryTotal") >= 930)
            {
                PS4Manager.ps4TrophyManager.UnlockTrophy((int)PS4_TROPHIES.COLLECT_ALL_BLUE_BERRIES);
            }
#endif

#if UNITY_XBOXONE
            // check trophy
            if (PlayerPrefs.GetInt("BlueBerryTotal") >= 100)
            {
                // check friend trophy
                XONEAchievements.SubmitAchievement((int)XONEACHIEVS.BLUE_BERRIES_LOVER);
            }
            //
            if (PlayerPrefs.GetInt("BlueBerryTotal") >= 930)
            {
                // check friend trophy
                XONEAchievements.SubmitAchievement((int)XONEACHIEVS.BLUE_BERRIES_CHAMPION);
            }
#endif

            if (PlayerPrefs.GetInt("BlueBerryTotal") == 930)
            {
                PlayerPrefs.SetInt("AllBlueBerries", 1);
                textMain.SetText(13);
                BerrySpawnManager.PlayBerryNoise(true);

                tpc.berryCount += 1000;
                CheckPSTrophies(1000);
                tpc.UpdateBerryHUDRed();
            }
            else
            {
                BerrySpawnManager.PlayBlueBerryNoise(0);
            }
        }
        if (playFX)
        {
            berry.GetComponentInChildren <SphereCollider>().enabled = false;
            StartCoroutine(MoveBerry(berry, berryType, initAmount));
        }
    }