Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        totalPlayerNoise = 0;

        switch (currFloorType)
        {
        case currentFloorType.Wood:
            AudioTriggers.SetSwitch("Floor", "Wood", this.gameObject);
            break;

        case currentFloorType.Carpet:
            AudioTriggers.SetSwitch("Floor", "Carpet", this.gameObject);
            break;

        case currentFloorType.Glass:
            AudioTriggers.SetSwitch("Floor", "Glass", this.gameObject);
            break;

        default:
            break;
        }

        float headMoveDist = Vector3.Magnitude(playerHead.position - prevPlayerPos);

        if (headMoveDist >= playerHeadNoiseSpeedCutoff)
        {
            if (!trackindDetectableMovement)
            {
                trackindDetectableMovement     = true;
                startHeadDetectableMovementPos = playerHead.position;
            }

            if (Vector3.Magnitude(playerHead.position - startHeadDetectableMovementPos) > detectableMovementStepDist)
            {
                float wwiseSpeed = Utility.SuperLerp(0, 1, 0, 0.05f, headMoveDist);
                //Debug.Log("making player head sound from speed: " + headMoveDist);
                //AudioTriggers.PostEvent("Play_Footstep", this.gameObject);
                //AudioTriggers.PostEvent("Play_Creaks", creakObject);
                totalPlayerNoise += headMoveDist;
            }
        }
        else if (trackindDetectableMovement)
        {
            trackindDetectableMovement = false;
        }
        prevPlayerPos = playerHead.position;

        float candleMoveDist = Vector3.Magnitude(candle.position - prevCandlePos);

        if (candleMoveDist >= candleNoiseSpeedCutoff)
        {
            //Debug.Log("making candle sound from speed: " + candleMoveDist);
            totalPlayerNoise += candleMoveDist;
        }
        prevCandlePos = candle.position;

        if (!lampOn)
        {
            if (Witch == null)
            {
                return;
            }

            Witch.updateNoiseLevel(totalPlayerNoise);

            float witchDistance = Vector3.Magnitude(transform.position - Witch.transform.position);
            if (totalPlayerNoise == 0)
            {
                witchIdleAnim = GameObject.Find("WitchModel").GetComponent <Animator> ();
                witchIdleAnim.SetBool("witchAngry", false);
                AudioTriggers.SetState("Witch", "Idle");
                AudioTriggers.SetRTPC("witchDist", witchDistance);
            }
            else if (witchDistance >= angryDistCutoff)
            {
                AudioTriggers.SetState("Witch", "Hunting");
                AudioTriggers.SetRTPC("witchDist", witchDistance);
            }
            else
            {
                witchAngryAnim = GameObject.Find("WitchModel").GetComponent <Animator> ();
                witchAngryAnim.SetBool("witchAngry", true);
                AudioTriggers.SetState("Witch", "Attack");
                AudioTriggers.PostEvent("Play_Witch_Scream", Witch.gameObject);
                AudioTriggers.SetRTPC("witchDist", witchDistance);
            }
        }
        else
        {
        }

        prevTotalPlayerNoise = totalPlayerNoise;
    }
Ejemplo n.º 2
0
 public void GameOver()
 {
     AudioTriggers.SetState("Witch", "GameOver");
 }