/**
     * triggers sound on collision with player
     */
    private void OnCollisionEnter(Collision c)
    {
        float  impactForce = c.relativeVelocity.magnitude;
        Closet closet      = Closet.GetInstance();

        if (impactForce > maxImpact)
        {
            impactForce = maxImpact;
        }
        source.volume = impactForce / maxImpact;
        if (c.collider.tag == "Player")
        {
            source.Play();
            if (closet != null && closet.onClosetSound != null)
            {
                closet.onClosetSound(soundType, source.volume * volumeDamper);
            }
        }
        else if (!GetComponent <ClothRenderer>() && c.collider.tag == "DynamicObject")
        {
            source.Play();
            if (closet != null && closet.onClosetSound != null)
            {
                closet.onClosetSound(soundType, source.volume * volumeDamper);
            }
        }
    }
Esempio n. 2
0
 private void Start()
 {
     Closet.GetInstance().onClosetSound  += OnClosetSound;
     Closet.GetInstance().onPlayerHidden += OnPlayerHidden;
     StartCoroutine("UpdateAudioCapture");
     gameTime = totalGameTime;
 }
    // Use this for initialization
    void Start()
    {
        Closet.GetInstance().onPlayerHidden   += nowHiding;
        Closet.GetInstance().onPlayerUnhidden += notHiding;

        OpenDoor();
    }
    void Update()
    {
        // update hiding status
        ovrController.GetCameraOrientation(ref orientation);
        ovrController.GetCameraPosition(ref position);

        //isHiding = Quaternion.LookRotation(orientation) + Quaternion.LookRotation(dirHide.normalized);
        //isHiding = ((orientation + dirHide.normalized)/2).;
        isHiding = Quaternion.Angle(orientation, dirHide) < angleDifference;
        if (isHiding && !hasHiddenBefore)
        {
            hasHiddenBefore = true;
        }

        coatRight.localPosition =
            (isHiding)?Vector3.MoveTowards(coatRight.localPosition, Vector3.Lerp(Vector3.zero, cRight, angleDifferencePercentage), hideSpeed)
                                :cRight;
        coatLeft.localPosition = -coatRight.localPosition;

        // move coat parts accordingl
        if (isHiding && !calledHiding)
        {
            if (Closet.GetInstance().onPlayerHidden != null)
            {
                Closet.GetInstance().onPlayerHidden();
            }
            audio.clip = coatClip;
            audio.loop = false;
            audio.Play();
            calledHiding = true;
        }
        else if (!isHiding && calledHiding)
        {
            if (Closet.GetInstance().onPlayerUnhidden != null)
            {
                Closet.GetInstance().onPlayerUnhidden();
            }
            audio.clip = coatClip;
            audio.loop = false;
            audio.Play();
            calledHiding = false;
        }
    }
Esempio n. 5
0
    private void FixedUpdate()
    {
        // perform shake check
        Quaternion curOrientation = new Quaternion();

        Closet.GetInstance().ovrController.GetCameraOrientation(ref curOrientation);
        float diff = Vector3.Angle(curOrientation.eulerAngles, lastOrientation.eulerAngles);

        if (shakeCounter >= 5)
        {
            alive = false;
        }
        else if (diff > shakeTolerance)
        {
            shakeCounter++;
        }

        lastOrientation = curOrientation;
    }
Esempio n. 6
0
    public float suspicionThreshold;     // amount of volume where boyfriend gets suspicious

    private void Start()
    {
        Closet.GetInstance().onClosetSound += OnClosetSound;
    }
Esempio n. 7
0
 private void Destroy()
 {
     Closet.GetInstance().onClosetSound -= OnClosetSound;
 }
 public override void Trigger()
 {
     Debug.Log("hiding");
     Closet.GetInstance().onPlayerHidden += PlayerHiddenHandler;
 }