private void OnTriggerStay(Collider other) { PushObjectScript pushobject = other.GetComponent <PushObjectScript>(); if (pushobject && Input.GetButtonDown("Push") && !_isKicking) { _pushObject = pushobject; KickObject(other.transform); return; } WeaponScript weapon = other.GetComponent <WeaponScript>(); if (weapon && Input.GetButtonDown("Interact") && !_isPickingUp) { _weaponScript = weapon; _isPickingUp = true; _animationController.pickUpWeaponIK.WeaponScript = weapon; _animationController.Pickup(); weapon.DisablePickUp(); _playerMovement.Stop(); } HitScript tohit = other.GetComponent <HitScript>(); if (tohit && _pickedUp && Input.GetButtonDown("Interact") && !_isHitting) { _enemyController = other.GetComponent <EnemyController>(); _toHit = tohit; _isHitting = true; Hit(other.transform); _toHit.DisableHitbox(); _playerMovement.Stop(); } if (other.tag == "Seen" && !_isHitting) { _enemyController = other.GetComponentInParent <EnemyController>(); _isSeen = true; _playerMovement.Stop(); Seen(other.transform.parent); } if (other.gameObject.tag == "Fall") { Fall(); } if (other.gameObject.tag == "Win") { _playerMovement.Stop(); WinGame(); } }
private void OnTriggerEnter2D(Collider2D collision) { PushObjectScript obj = collision.GetComponent <PushObjectScript>(); if (obj != null) { activate.SetActive(true); pushedBarrel.SetActive(false); placedBarrel.SetActive(true); Destroy(obj); progCtrl.setDoorActive(); Destroy(this); } }