示例#1
0
    public override void RotateSwitcher(MultiPathDescriptor nextSegment, float distance)
    {
        if (nextSegment == null)
        {
            return;
        }

        arrow.rotation = nextSegment.GetRotationAtDistance(distance);
    }
示例#2
0
    void Awake()
    {
        path = FindObjectOfType <DefaultMultiPathDescriptor>()
               .DefaultMultiPath;

        path.GetClosestPointAndDistanceByPoint(transform.position, out distance);
        pathParent   = path.transform;
        prevPosition = pathParent.position;

        parentDelta = Vector3.zero;
    }
示例#3
0
    public override MultiPathDescriptor GetNextPath(MultiPathDescriptor currentSegment, bool force = false)
    {
        if (currentSegment == currentPath)
        {
            if (switchOnLeave || force)
            {
                return(otherPath);
            }
        }

        if (currentSegment == otherPath)
        {
            if (switchOnEnter || force)
            {
                return(currentPath);
            }
        }

        return(null);
    }
示例#4
0
    public void TriggerAvailablePathSwitch(bool force = false)
    {
        if (nextSwitcher == null)
        {
            return;
        }

        var nextPath = nextSwitcher.GetNextPath(path, force);

        if (nextPath == null)
        {
            return;
        }

        path = nextPath;
        path.GetClosestPointAndDistanceByPoint(transform.position, out distance);

        nextSwitcher.RotateSwitcher(path, distance);

        pathParent   = path.transform;
        prevPosition = pathParent.position;
        parentDelta  = Vector3.zero;
    }
示例#5
0
 void OnValidate()
 {
     defaultMultiPath = GetComponent <MultiPathDescriptor>();
 }
示例#6
0
 public abstract void RotateSwitcher(MultiPathDescriptor currentSegment, float distance);
示例#7
0
 public abstract MultiPathDescriptor GetNextPath(MultiPathDescriptor currentSegment, bool force = false);
示例#8
0
 public override MultiPathDescriptor GetNextPath(MultiPathDescriptor currentSegment, bool force = false)
 => otherSegment;
示例#9
0
 public override void RotateSwitcher(MultiPathDescriptor currentSegment, float distance)
 {
 }