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

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

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

        parentDelta = Vector3.zero;
    }
Exemple #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);
    }
Exemple #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;
    }
Exemple #5
0
 void OnValidate()
 {
     defaultMultiPath = GetComponent <MultiPathDescriptor>();
 }
Exemple #6
0
 public abstract void RotateSwitcher(MultiPathDescriptor currentSegment, float distance);
Exemple #7
0
 public abstract MultiPathDescriptor GetNextPath(MultiPathDescriptor currentSegment, bool force = false);
Exemple #8
0
 public override MultiPathDescriptor GetNextPath(MultiPathDescriptor currentSegment, bool force = false)
 => otherSegment;
Exemple #9
0
 public override void RotateSwitcher(MultiPathDescriptor currentSegment, float distance)
 {
 }