Пример #1
0
    private void Update()
    {
        if (Mathf.Abs(closedYRotation - transform.rotation.eulerAngles.y) <= closedDelta)
        {
            if (!isClosed)
            {
                OnDoorClose?.Invoke();
                isClosed = true;

                if (shakeCameraOnClose && impulseSource)
                {
                    impulseSource.GenerateImpulse();
                    FMODUnity.RuntimeManager.PlayOneShot(DoorSlam, transform.position);
                }
            }
        }
        else
        {
            if (isClosed)
            {
                OnDoorOpen?.Invoke();
                FMODUnity.RuntimeManager.PlayOneShot(DoorSqueak, transform.position);
                isClosed = false;
            }
        }
    }
Пример #2
0
    protected void Open()
    {
        // Play Opening animation

        OnDoorOpen?.Invoke();
        objectCollider.enabled = false;
        currentDoorState       = DoorStates.Open;
    }
Пример #3
0
    private IEnumerator OpenDoorEnumerator(bool killedDog)
    {
        openAudioEvent.Play();
        var sr = GetComponent <SpriteRenderer>();

        sr.color = new Color(0.9f, 0.9f, 0.9f, 0.5f);
        yield return(new WaitForSeconds(1f));

        //todo - go to loading screen
        OnDoorOpen?.Invoke(killedDog ? _killedDogSequence : _savedDogSequence);
    }