Esempio n. 1
0
        bool isValidGrabbale(Collider col, Grabbable grab)
        {
            // Object has been deactivated. Remove it
            if (col == null || grab == null || !grab.isActiveAndEnabled || !col.enabled)
            {
                return(false);
            }
            // Not considered grabbable any longer. May have been picked up, marked, etc.
            else if (!grab.IsValidGrabbable())
            {
                return(false);
            }
            // Snap Zone without an item isn't a valid grab. Want to skip this unless something is inside
            else if (grab.GetComponent <SnapZone>() != null && grab.GetComponent <SnapZone>().HeldItem == null)
            {
                return(false);
            }
            // Position was manually set outside of break distance
            // No longer possible for it to be the closestGrabbable
            else if (grab == ClosestGrabbable)
            {
                if (grab.BreakDistance > 0 && Vector3.Distance(grab.transform.position, transform.position) > grab.BreakDistance)
                {
                    return(false);
                }
            }

            return(true);
        }