protected override void OnSimulate() { if (targetReached == false) { if (cachedBeginCheck != 0) { { if (cachedBeginCheck < 0) { cachedBody.Rotate(turnCos, turnSin); } else { cachedBody.Rotate(turnCos, -turnSin); } } } else { if (cachedBody._rotation.Dot(targetRotation.x, targetRotation.y) < 0) { cachedBody.Rotate(turnCos, turnSin); } else { Arrive(); } } cachedBody.RotationChanged = true; } }
protected override void OnSimulate() { if (targetReached) { if (cachedBody.HasParent == false) { if (contactChecked) { contactChecked = false; checkCollisionCount = checkCollisionTurnRate; contactDif /= contactCount; TurnDirection(contactDif); isContactTurning = true; contactDif = Vector2d.zero; contactCount = 0; } else if (checkCollisionCount > 0) { checkCollisionCount--; } } } if (targetReached == false) { if (isContactTurning) { if (contacted) { contacted = false; } else { targetReached = true; isContactTurning = false; } } if (cachedBeginCheck != 0) { { if (cachedBeginCheck < 0) { cachedBody.Rotate(turnCos, turnSin); } else { cachedBody.Rotate(turnCos, -turnSin); } } } else { if (cachedBody.Rotation.Dot(targetRotation.x, targetRotation.y) < 0) { cachedBody.Rotate(turnCos, turnSin); } else { Arrive(); } } cachedBody.RotationChanged = true; } }