Exemple #1
0
    private void PlayPoundingSound()
    {
        if (_poundingSounds.Length > 1)
        {
            int       n   = Random.Range(1, _poundingSounds.Length);
            AudioClip tmp = _poundingSounds[0];
            _poundingSounds[0] = _poundingSounds[n];
            _poundingSounds[n] = tmp;
        }

        _basicAudio.PlayOneShot(_poundingSounds[0]);
    }
Exemple #2
0
    public override void Interact(PlayerController player)
    {
        if (_master)
        {
            _master.Interact(player);
            return;
        }

        if (!Unlock(player))
        {
            _basicAudio.PlayOneShot(_audioDenied);
            return;
        }

        bool open    = false;
        bool closing = false;
        bool opening = false;

        foreach (Door door in _doors)
        {
            if (door.isOpen)
            {
                open = true;
            }
            if (door.closing)
            {
                closing = true;
            }
            if (door.opening)
            {
                opening = true;
            }
        }

        if (opening || closing)
        {
            return;
        }
        else if (open)
        {
            if (_coroutine != null)
            {
                StopCoroutine(_coroutine);
            }

            _coroutine = StartCoroutine(Close());
        }
        else
        {
            if (_coroutine != null)
            {
                StopCoroutine(_coroutine);
            }

            _coroutine = StartCoroutine(Open());
        }

        SetCanvas();
    }