private void SetNewTargetPosition() { if (isBlueCar) { targetPosition = path.getBluePoint(isPathSwitched); } else { targetPosition = path.getRedPoint(isPathSwitched); } if (looping) { if (isBlueCar) { if (path.BlueIndex == path.blueGetLength() - 1) { path.resetIndex(isBlueCar); } } else { if (path.RedIndex == path.redGetLength() - 1) { path.resetIndex(isBlueCar); } } } path.updateIndex(isBlueCar, isPathSwitched); }
void Start() { path = SingletonPath.Instance; if (isBlueCar) { targetPosition = path.getBluePoint(isPathSwitched); } else { targetPosition = path.getRedPoint(isPathSwitched); } }