This commit is contained in:
2026-05-30 09:16:35 +07:00
parent 2f87ce19a7
commit 1c0ee6efb7
4001 changed files with 3363438 additions and 1738 deletions

View File

@@ -0,0 +1,67 @@
using Invector.vCharacterController.vActions;
using UnityEngine;
public class vWeaponCollectableControl : MonoBehaviour
{
[vHelpBox("This component is used for NO INVENTORY weapons", vHelpBoxAttribute.MessageType.Info)]
public Rigidbody _rigidbody;
public Collider _physicsCollider;
public Collider _selfCollider;
public virtual void Start()
{
var _collectable = GetComponent<vCollectableStandalone>();
if (_collectable)
{
_collectable.OnEquip.AddListener(OnEquip);
_collectable.OnDrop.AddListener(OnDrop);
}
if (_rigidbody == null)
{
_rigidbody = GetComponentInParent<Rigidbody>();
}
if (_physicsCollider == null)
{
_physicsCollider = GetComponentInParent<Collider>();
}
if (_selfCollider == null)
{
_selfCollider = GetComponentInChildren<Collider>();
}
}
public virtual void OnEquip()
{
if (_rigidbody != null)
{
_rigidbody.isKinematic = true;
}
if (_physicsCollider != null)
{
_physicsCollider.enabled = false;
}
if (_selfCollider != null)
{
_selfCollider.enabled = false;
}
}
public virtual void OnDrop()
{
if (_rigidbody != null)
{
_rigidbody.isKinematic = false;
}
if (_physicsCollider != null)
{
_physicsCollider.enabled = true;
}
if (_selfCollider != null)
{
_selfCollider.enabled = true;
}
}
}