IEnumerator DelayVib()
    {
        yield return(new WaitForSeconds(0.1f));

        HDRumbleMain.PlayVibrationPreset(0, "P04_DampedFm1", collectIntensity * 4f, 1, collectIntensity * 2f);
        //   tpc.Vibrate(collectIntensity * 2f, collectDuration * 2f, 1);
    }
Esempio n. 2
0
    void Awake()
    {
        if (singleton != null)
        {
            enabled = false;
            Destroy(this);
            return;
        }

        singleton = this;
    }
 void BounceChara(Vector3 direct, bool usualVib)
 {
     direct = new Vector3(direct.x, 0f, direct.z);
     direct.Normalize();
     tpc.HitPushBack(-direct);
     if (usualVib)
     {
         //   tpc. Vibrate(0.3f, 1f, 0);
         HDRumbleMain.PlayVibrationPreset(playerI, "B06_Bump1", 1f, 0, 0.2f);
     }
     else
     {
         HDRumbleMain.PlayVibrationPreset(playerI, "D03_Thumpp1", 1f, 0, 0.2f);
     }
     sound.Stop();
     sound.PlayDelayed(0f);
 }
 void _PlayBlueBerryNoise(int pID)
 {
     berryIt = Random.Range(0, 4);
     if (berryIt == prevBerryIt)
     {
         berryIt += 1;
         if (berryIt == 4)
         {
             berryIt = 0;
         }
     }
     HDRumbleMain.PlayVibrationPreset(pID, "K04_FadingPatter1", 1f, 1, 0.2f);
     prevBerryIt = berryIt;
     audioSources[soundIterator].clip = blueBerrySounds[berryIt];
     audioSources[soundIterator].PlayDelayed(0f);
     soundIterator++;
     if (soundIterator > 5)
     {
         soundIterator = 0;
     }
 }
 void OnTriggerEnter(Collider other)
 {
     if (!PlayerManager.GetMainPlayer().inButtonCutscene&& other.gameObject.layer == 14 && ((buttonID == -1 && !activated) || (buttonID != -1 && PlayerPrefs.GetInt("Button" + buttonID.ToString(), 0) == 0)))
     {
         if (other.gameObject.GetComponent <AttackSettings>().activeAttack == true)
         {
             tpc  = PlayerManager.GetMainPlayer();
             camF = tpc.cam.GetComponent <CameraFollower>();
             if (cameraPosition != null || objectanimated != null)
             {
                 StartCoroutine("PlayCutscene");
             }
             if (buttonID != -1)
             {
                 PlayerPrefs.SetInt("Button" + buttonID.ToString(), 1);
             }
             //    PlayerPrefs.Save();
             if (lCol == null)
             {
                 lCol = other.gameObject.GetComponent <LeafCollision>();
             }
             if (lCol != null)
             {
                 lCol.buttonParticles.transform.SetParent(lCol.tpc.transform.parent);
                 lCol.buttonParticles.transform.position = other.ClosestPoint(this.transform.position);
                 lCol.buttonParticles.transform.LookAt(other.transform.position);
                 lCol.buttonEM.enabled = true;
                 lCol.buttonParticles.GetComponent <ParticleSystem>().Play();
                 StartCoroutine(lCol.tpc.DeactivateParticle(lCol.buttonParticles, lCol.buttonEM));
                 //    lCol.tpc.Vibrate(0.4f, 1f, 0);
                 HDRumbleMain.PlayVibrationPreset(0, "D06_Thumpp4", 1f, 0, 0.2f);
             }
             ActivateIt();
         }
     }
 }
    void OnTriggerEnter(Collider other)
    {
        if ((curAnim.inAttack || curAnim.inAttack2 || curAnim.inAttack3))
        {
            if (playerI == 0)
            {
                if (((collisionLayers & 1 << other.gameObject.layer) != 0))
                {
                    if (other.gameObject.GetComponent <ActivateButton>() == null && (other.gameObject.name != "LeafBox"))
                    {
                        if (Physics.Raycast(this.transform.position, tpc.transform.forward, out checkCol, 3f, collisionLayers) && !checkCol.collider.isTrigger && checkCol.normal.y <= 0.1f)
                        {
                            BounceChara(-checkCol.normal, true);
                        }
                    }
                }

                if (other.gameObject.name == "LeafBox")
                {
                    lbo = other.gameObject.GetComponentInParent <LeafBoxObstacle>();
                    if (tpc.leafNo >= lbo.boxType)
                    {
                        HDRumbleMain.PlayVibrationPreset(playerI, "D06_Thumpp4", 1f, 0, 0.2f);
                        lbo.DestroyBox();
                    }
                    else
                    {
                        if (lbo.boxType == 5)
                        {
                            if (PlayerPrefs.GetInt("WrongLeafBlockBlack", 0) == 0)
                            {
                                PlayerPrefs.SetInt("WrongLeafBlockBlack", 1);
                                tpc.ps.gameObject.GetComponentInChildren <TextTriggerMain>().SetText(8);
                            }
                        }
                        else
                        {
                            if (PlayerPrefs.GetInt("WrongLeafBlock", 0) == 0)
                            {
                                PlayerPrefs.SetInt("WrongLeafBlock", 1);
                                tpc.ps.gameObject.GetComponentInChildren <TextTriggerMain>().SetText(7);
                            }
                        }
                        lbo.Wrong();
                        LeafStarKnockback(other.transform.position);
                    }
                }
                if (other.gameObject.GetComponent <NPCCage>())
                {
                    LeafStarKnockback(other.transform.position);
                }
            }
            if (other.tag == "LeafHit" || other.tag == "TouchActivate")
            {
                if (other.gameObject.GetComponentInChildren <Animator>())
                {
                    other.gameObject.GetComponentInChildren <Animator>().SetBool("Activate", true);
                    if (other.tag == "LeafHit")
                    {
                        BerrySpawnManager.SpawnABerry(other.transform.position);
                    }
                }
            }
        }
    }