setPitch() public method

public setPitch ( float pitch ) : RESULT
pitch float
return RESULT
    void FixedUpdate()
    {
        tempTime += Time.deltaTime;

        FootSound.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(gameObject));

        PlayerLook();
        PlayerMoveing();
        Jump();

        if (Input.GetAxis("Vertical") >= 0.01f || Input.GetAxis("Horizontal") >= 0.01f || Input.GetAxis("Vertical") <= -0.01f || Input.GetAxis("Horizontal") <= -0.01f)
        {
            if (rg.isGrounded == true)
            {
                isMoving = true;
            }
            else if (rg.isGrounded == false)
            {
                isMoving = false;
            }
        }
        else if (Input.GetAxis("Vertical") == 0 || Input.GetAxis("Horizontal") == 0)
        {
            isMoving = false;
        }

        if (Input.GetButton("Fire3"))
        {
            if (tempTime >= 0.4f)
            {
                tempTime -= 0.4f;
                FootPlay();
            }
        }

        if (tempTime >= 0.6f)
        {
            tempTime -= 0.6f;
            FootPlay();
        }

        if (isJumping && rg.isGrounded)
        {
            FootSound.setPitch(2);
            FootSound.start();
            isJumping = false;
            FootSound.setPitch(1);
        }
    }
Beispiel #2
0
    // Update is called once per frame
    void Update()
    {
        if (!agent.pathPending && agent.remainingDistance < 0.5f)
        {
            TravelToNextPoint();
        }
        PoliceAlarm.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(gameObject));
        //calculate Doppler Effect
        Vector3 directionOfListener     = (transform.position - Player.transform.position).normalized;
        float   speedRelativeToListener = agent.speed * Vector3.Dot(transform.forward, directionOfListener);

        dopplerPitch = (SPEED_OF_SOUND - speedRelativeToListener) / SPEED_OF_SOUND;
        PoliceAlarm.setPitch(dopplerPitch);
    }
Beispiel #3
0
 // Update is called once per frame
 void Update()
 {
     if (chainEventInstance != null)
     {
         if (timer > 0.0f)
         {
             chainEventInstance.setVolume(timer / period);
             chainEventInstance.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(transform.position));
             chainEventInstance.setPitch(maxPitch * (timer / period));
             timer -= Time.deltaTime;
             if (timer < 2.0f)
             {
                 musicManager.ChangeScene();
                 SceneManager.LoadScene("test2");
             }
         }
         else
         {
             chainEventInstance.stop(FMOD.Studio.STOP_MODE.IMMEDIATE);
             chainEventInstance.release();
             chainEventInstance = null;
         }
     }
 }
Beispiel #4
0
 public void SetPitch(float pitch)
 {
     instance.setPitch(pitch);
 }