Esempio n. 1
0
    protected virtual void CheckPullingObjects()
    {
        bool updateConnected = false;

        for (int i = PullingTogether.Count - 1; i >= 0; i--)
        {
            PullTogether pulling  = PullingTogether[i];
            Vector3      toPoints = pulling.AttachmentPoint.transform.position - pulling.Point.transform.position;
            if (toPoints.magnitude < 1f)
            {
                PullObjectsController puller = pulling.Point.GetComponent <PullObjectsController>();
                if (puller != null)
                {
                    puller.PullSpecific = null;
                }
                Attach(pulling.Point, pulling.Attachment, pulling.AttachmentPoint);
                PullingTogether.RemoveAt(i);
                updateConnected = true;
            }
        }
        if (updateConnected)
        {
            DiscoverConnected();
        }
    }
Esempio n. 2
0
    protected override void CheckPullingObjects()
    {
        SensorController sensors = GetComponent <SensorController>();

        if (sensors == null)
        {
            return;
        }

        IDictionary <int, SensorController.Entry> entries = sensors.GetEntries();

        for (int i = PullingTogether.Count - 1; i >= 0; i--)
        {
            PullTogether pull = PullingTogether[i];
            int          id   = pull.Attachment.gameObject.GetInstanceID();
            if (!entries.ContainsKey(id))
            {
                PullingTogether.RemoveAt(i);
                continue;
            }

            SensorController.Entry entry = entries[id];
            if (!entry.Visible)
            {
                PullingTogether.RemoveAt(i);
                continue;
            }
        }
        base.CheckPullingObjects();
    }