예제 #1
0
        public void OnTriggerEnter(Collider other)
        {
            if (heldBy.Count > 0 && other.GetComponent <PlacePoint>())
            {
                var otherPoint = other.GetComponent <PlacePoint>();
                if (otherPoint == null)
                {
                    return;
                }

                if (placePoint != null && placePoint.PlacedObject() != null)
                {
                    return;
                }

                if (placePoint == null || otherPoint.Distance(transform) < placePoint.Distance(transform))
                {
                    if (otherPoint.CanPlace(transform))
                    {
                        placePoint = other.GetComponent <PlacePoint>();
                        placePoint.Highlight();
                        if (placePoint.callGrabbableHighlight)
                        {
                            Highlight();
                        }
                    }
                }
            }
        }
예제 #2
0
        public void OnTriggerEnter(Collider other)
        {
            if (other.GetComponent <PlacePoint>())
            {
                var otherPoint = other.GetComponent <PlacePoint>();
                if (heldBy.Count == 0 && !otherPoint.onlyPlaceWhileHolding)
                {
                    return;
                }
                if (otherPoint == null)
                {
                    return;
                }

                if (placePoint != null && placePoint.GetPlacedObject() != null)
                {
                    return;
                }

                if (placePoint == null)
                {
                    if (otherPoint.CanPlace(transform))
                    {
                        placePoint = other.GetComponent <PlacePoint>();
                        if (placePoint.forcePlace)
                        {
                            if (lastPlacePoint == null || (lastPlacePoint != null && !lastPlacePoint.Equals(placePoint)))
                            {
                                ForceHandsRelease();
                                placePoint.Place(this);
                                lastPlacePoint = placePoint;
                            }
                        }
                        else
                        {
                            placePoint.Highlight(this);
                            if (placePoint.grabbableHighlight)
                            {
                                Highlight(heldBy[0]);
                            }
                        }
                    }
                }
            }
        }