Пример #1
0
    private void OnCollisionEnter(Collision other)
    {
        if (!SliceRegistry.IsSlicer(other.transform))
        {
            return;
        }
        //This works only for the knife! If something is not cutting correctly and you arent using the knife prefab to cut, this is probably where the issue is at
        if (!(other.GetContact(0).thisCollider.gameObject.CompareTag("Sharp") || other.GetContact(0).otherCollider.gameObject.CompareTag("Sharp")))
        {
            return;
        }

        if (Pieces < 1)
        {
            return;
        }
        other.GetContact(0).otherCollider.gameObject.GetComponentInParent <AudioSource>().Play();
        slicedObjects = this.gameObject.SliceInstantiate(other.transform.position, other.transform.forward, mat);
        if (slicedObjects != null)
        {
            AddRigidBodyAndExplosions();
            gameObject.SetActive(false);
            Destroy(this);
        }
    }
Пример #2
0
 private void Start()
 {
     SliceRegistry.Register(this.transform);
 }