Пример #1
0
    void OnTriggerStay(Collider col)
    {
        if (col.CompareTag("Skull") && _holdingSkull == null && playerState == PlayerState.Walking)
        {
            if (Input.GetButtonDown(_controls["PickUp"]))
            {
                col.transform.SetParent(this.transform);
                col.GetComponent <Skull>().owner = this;
                col.GetComponent <Skull>().DisableGravity();
                _holdingSkull = col.gameObject;
                _holdingSkull.transform.position = skullHandlePoint.position;
                PlayAudioClip(sounds.obtainSkullClip);
                playerState = PlayerState.HasSkull;
            }
        }
        if (col.CompareTag("Altar"))
        {
            if (Input.GetButtonDown(_controls["PickUp"]) && playerState == PlayerState.HasSkull && _holdingSkull != null)
            {
                Altar altar = col.GetComponent <Altar>();
                if (_holdingSkull)
                {
//					PlayAudioClip(sounds.placeSkullClip);
                    altar.PlaceSkullObject(skullColorMaterial);
                    _score++;
                    Destroy(_holdingSkull);
                    _holdingSkull = null;
                    playerState   = PlayerState.Walking;
                    GameManager.Instance.ItemHasSpawned = false;
                }
            }
        }
    }