void SwitchToCPointV2(Transform cPoint) { currCPointT = cPoint; currCPointController = cPoint.GetComponent <CPointController>(); betweenDirections = false; if (direction == 1) { nextCPointT = currCPointT.GetComponent <CPointController>().pointAhead; } else { nextCPointT = currCPointT.GetComponent <CPointController>().invPointAhead; } nextCPointController = nextCPointT.GetComponent <CPointController>(); if (awaitingTurn && nextCPointController.pointLeft != nextTurnCPointT) { awaitingTurn = false; nextCPointT = nextTurnCPointT; nextCPointController = nextTurnCPointT.GetComponent <CPointController>(); nextShift = ShiftAfterTurn(); CheckTurnDirection(awaitingTurnDirection); } else { bool betweenSectors = currCPointT.parent != nextCPointT.parent; if (betweenSectors) { CheckNextSegmentDirection(); } } currDistanceBtwCP = Vector3.Distance(currCPointT.position, nextCPointT.position); }
public void Reverse() { direction *= -1; cPointsProgress = 1 - cPointsProgress; Transform swapTempT = currCPointT; currCPointT = nextCPointT; currCPointController = nextCPointController.GetComponent<CPointController>(); nextCPointT = swapTempT; nextCPointController = nextCPointT.GetComponent<CPointController>(); }
public void Reverse() { direction *= -1; cPointsProgress = 1 - cPointsProgress; Transform swapTempT = currCPointT; currCPointT = nextCPointT; currCPointController = nextCPointController.GetComponent <CPointController>(); nextCPointT = swapTempT; nextCPointController = nextCPointT.GetComponent <CPointController>(); }
void SwitchToCPointV2(Transform cPoint) { currCPointT = cPoint; currCPointController = cPoint.GetComponent<CPointController>(); betweenDirections = false; if (direction == 1) { nextCPointT = currCPointT.GetComponent<CPointController>().pointAhead; }else { nextCPointT = currCPointT.GetComponent<CPointController>().invPointAhead; } nextCPointController = nextCPointT.GetComponent<CPointController>(); if (awaitingTurn && nextCPointController.pointLeft != nextTurnCPointT) { awaitingTurn = false; nextCPointT = nextTurnCPointT; nextCPointController = nextTurnCPointT.GetComponent<CPointController>(); nextShift = ShiftAfterTurn (); CheckTurnDirection(awaitingTurnDirection); }else { bool betweenSectors = currCPointT.parent != nextCPointT.parent; if (betweenSectors) { CheckNextSegmentDirection(); } } currDistanceBtwCP = Vector3.Distance(currCPointT.position, nextCPointT.position); }