예제 #1
0
    bool IsOnDestinationPosition()
    {
        if (destinationObject)
        {
            if ((dockedIn == destinationObject && IsDocked()) || Vector3.Distance(transform.position, destinationObject.GetEntrancePos()) <= interactionDistance)
            {
                return(true);
            }
            return(false);
        }

        return(Vector3.Distance(transform.position, agent.destination) <= interactionDistance);
    }
예제 #2
0
    public bool MoveToTargetObject(TargetableObject targetObject)
    {
        if (destinationObject && targetObject)
        {
            if (destinationObject.GetInstanceID() == targetObject.GetInstanceID() && IsDocked())
            {
                if (dockedIn.GetInstanceID() == targetObject.GetInstanceID())
                {
                    return(true);
                }
            }
        }

        Debug.Log("Moving to target obj");
        if (targetObject == null)
        {
            destinationObject = null;
            MoveToPosition(transform.position);
            Debug.LogError("TargetObject == null! Was that intended?");
            return(false);
        }

        MoveToPosition(targetObject.GetEntrancePos());
        destinationObject = targetObject;

        if (destinationObject)
        {
            if (IsOnDestinationPosition())
            {
                return(true);
            }
        }



        return(false);
    }