Пример #1
0
 private void OnTriggerEnter(Collider other)
 {
     if (!isPressed && other.gameObject.name == "Player")
     {
         isPressed = true;
         soundLocations.PostEventAndAddLocation(this.gameObject, buttonSound, attenuationRTPCName);
         soundLocations.PostEventAndAddLocation(myDoor.gameObject, doorSound, attenuationRTPCName);
     }
 }
Пример #2
0
    // Update is called once per frame
    void Update()
    {
        if (synthSound.Name == "Synth_Trigger")
        {
            if (!masterShutOff)
            {
                if (isOn)
                {
                    counter += (triggerTimer * Time.deltaTime);
                    if (counter >= 1.0f)
                    {
                        float randNum = Random.Range(0.0f, 100.0f);
                        if (!(randNum > 85))
                        {
                            if (randNum >= 0 && randNum <= 10)//10%
                            {
                                AkSoundEngine.SetRTPCValue(frequencyName, pitches[0, Random.Range(0, 5)], this.gameObject);
                            }
                            else if (randNum >= 11 && randNum <= 40)//29%
                            {
                                AkSoundEngine.SetRTPCValue(frequencyName, pitches[1, Random.Range(0, 5)], this.gameObject);
                            }
                            else if (randNum >= 41 && randNum <= 50)//9%
                            {
                                AkSoundEngine.SetRTPCValue(frequencyName, pitches[3, Random.Range(0, 5)], this.gameObject);
                            }
                            else if (randNum >= 51 && randNum <= 70)//19%
                            {
                                AkSoundEngine.SetRTPCValue(frequencyName, pitches[4, Random.Range(0, 5)], this.gameObject);
                            }
                            else if (randNum >= 71 && randNum <= 85)//14%
                            {
                                AkSoundEngine.SetRTPCValue(frequencyName, pitches[2, Random.Range(0, 5)], this.gameObject);
                            }

                            AkSoundEngine.SetRTPCValue(amplitudeName, Random.Range(50.0f, 85.0f), this.gameObject);
                            AkSoundEngine.SetRTPCValue(delayGainName, Random.Range(40.0f, 60.0f), this.gameObject);
                            AkSoundEngine.SetRTPCValue(delayTimeName, Random.Range(0.10f, maxDelayTime), this.gameObject);
                            soundLocations.PostEventAndAddLocation(this.gameObject, synthSound, attenuationName);
                        }

                        counter -= 1.0f;
                    }
                }
            }
        }
        else if (synthSound.Name == "Radio_Event")
        {
            if (!masterShutOff)
            {
                if (isOn & !musicPlaying)
                {
                    soundLocations.PostEventAndAddLocation(this.gameObject, synthSound, attenuationName);
                }
            }
        }
    }
Пример #3
0
    // Update is called once per frame
    void Update()
    {
        Vector3 direction = transforms[currentPoint].position - transform.position;

        direction.Normalize();
        controller.Move(direction * enemySpeed * Time.deltaTime);
        if (Vector3.Magnitude(transforms[currentPoint].position - transform.position) < 1.0f)
        {
            currentPoint++;
            if (currentPoint == transforms.Length)
            {
                currentPoint = 0;
            }
        }
        if (walking)
        {
            walkCount += Time.deltaTime * (enemySpeed / 10f);

            if (walkCount > footstepRate)
            {
                soundLocations.PostEventAndAddLocation(this.gameObject, footstepSound, attenuationRTPCName);
                //soundLocations.PlayEnemySound(transform.position);
                //footstepSound.Post(gameObject);
                walkCount = 0.0f;
            }
        }
    }
Пример #4
0
 private void OnCollisionEnter(Collision collision)
 {
     if (!collision.collider.CompareTag("Bullet"))
     {
         soundLocations.PostEventAndAddLocation(this.gameObject, bulletEvent, "Attenuatuion_RTPC");
         Destroy(gameObject);
     }
 }
Пример #5
0
 private void OnCollisionEnter(Collision collision)
 {
     if (thrown)
     {
         soundLocations.PostEventAndAddLocation(this.gameObject, brickSound, attenuationRTPCName);
         //soundLocations.AddBrickSound(transform.position);
         //AkSoundEngine.PostEvent("Drop_Brick", gameObject);
     }
 }
Пример #6
0
    public void Fire()
    {
        bulletFired = true;
        shotDead    = false;
        myBullet    = Instantiate(bulletPrefab, spawnPoint.position, Quaternion.identity).GetComponent <BulletScript>();
        Vector3 velocity = -gameObject.transform.right;

        velocity.Normalize();
        myBullet.SetVelocity(velocity);

        soundLocations.PostEventAndAddLocation(this.gameObject, shootEvent, "Attenuation_RTPC");
    }
Пример #7
0
    // Update is called once per frame
    void Update()
    {
        if (currentLives > 0)
        {
            if (sceneChanged && firstUpdate)
            {
                GameObject spawn = GameObject.FindGameObjectWithTag("Spawn Point");
                controller.enabled = false;
                gameObject.transform.SetPositionAndRotation(spawn.transform.position, spawn.transform.rotation);
                controller.enabled = true;
                sceneChanged       = false;
                firstUpdate        = false;
            }

            if (sceneChanged)
            {
                firstUpdate = true;
            }


            HandleMovement();
            if (walking && controller.isGrounded)
            {
                walkCount += Time.deltaTime * (playerSpeed / 10.0f);

                if (walkCount > footstepRate)
                {
                    soundLocations.PostEventAndAddLocation(this.gameObject, footstepSound, "");
                    walkCount = 0.0f;
                }
            }


            if (Input.GetMouseButtonDown(0))
            {
                RayCheck();
            }

            if (Input.GetMouseButtonDown(1))
            {
                ThrowItem();
            }

            if (Input.GetKeyDown(KeyCode.L))
            {
                AkSoundEngine.StopAll();
                musicPlaying = false;
                SceneManager.LoadScene("BossScene");
                sceneChanged = true;
            }
        }
        else if (currentLives <= 0)
        {
            if (!deathPosted)
            {
                deathPosted = true;
                AkSoundEngine.SetState("Dead_or_Alive", "Dead");
                objectiveText.text = "Objective: Press R to restart or press escape to quit";
            }

            if (Input.GetKeyDown(KeyCode.R))
            {
                RestartGame();
            }

            if (Input.GetKeyDown(KeyCode.Escape))
            {
                QuitGame();
            }
        }
    }