public override void RotateSwitcher(MultiPathDescriptor nextSegment, float distance) { if (nextSegment == null) { return; } arrow.rotation = nextSegment.GetRotationAtDistance(distance); }
void Awake() { path = FindObjectOfType <DefaultMultiPathDescriptor>() .DefaultMultiPath; path.GetClosestPointAndDistanceByPoint(transform.position, out distance); pathParent = path.transform; prevPosition = pathParent.position; parentDelta = Vector3.zero; }
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); }
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; }
void OnValidate() { defaultMultiPath = GetComponent <MultiPathDescriptor>(); }
public abstract void RotateSwitcher(MultiPathDescriptor currentSegment, float distance);
public abstract MultiPathDescriptor GetNextPath(MultiPathDescriptor currentSegment, bool force = false);
public override MultiPathDescriptor GetNextPath(MultiPathDescriptor currentSegment, bool force = false) => otherSegment;
public override void RotateSwitcher(MultiPathDescriptor currentSegment, float distance) { }