Esempio n. 1
0
    public virtual IList <AttachmentController> DiscoverNearbyAttachable()
    {
        List <AttachmentController> nearby = new List <AttachmentController>();

        Collider[] hitColliders = Physics.OverlapSphere(transform.position, PullRadius);
        foreach (Collider collider in hitColliders)
        {
            PullableController pullable = collider.transform.GetComponent <PullableController>();
            if (pullable == null || pullable.CapturedBy != null)
            {
                continue;
            }

            AttachmentController attachment = collider.transform.GetComponent <AttachmentController>();
            if (attachment == null)
            {
                continue;
            }

            HardpointController mounting = attachment.FindMountingHardpoint();
            if (mounting == null || mounting.Attached != null)
            {
                continue;
            }

            nearby.Add(attachment);
        }
        return(nearby);
    }