private void HandlePotentialFinished() { if (InRequestRange() && !_currentPlan.Finished && !_currentPlan.HeadingForIntersection && !_currentPlan.HeadingForObstacle) { _mover.GetComponent <Collider2D>().enabled = false; _currentMoveSpeed = _defaultMoveSpeed; RequestedNewPackage?.Invoke(); MovementPlanRequested?.Invoke(_currentPlan, SetCurrentPlan, false, false); } }
private void HandleIntersection() { if (_currentPlan.HeadingForIntersection && InRedirectRange() && !_currentPlan.HeadingForObstacle) { _mover.GetComponent <Collider2D>().enabled = false; _currentPlan.UpdateTargetLocationWhileMovingToIntersect(_currentPlan.TargetUnit.AngleDefinition.IntersectionPoint); DoTimeSlow(); var successfulRedirect = RedirectEvaluator.ValidRedirect( _currentPlan.TargetUnit.Transform.position, _currentPlan.TargetLocation, 0.85f); if (PassedRedirectRange()) { _mover.GetComponent <Collider2D>().enabled = false; RequestedNewPackage?.Invoke(); MovementPlanRequested?.Invoke(_currentPlan, SetCurrentPlan, successfulRedirect, false); Time.timeScale = 1f; _currentMoveSpeed = _defaultMoveSpeed * 1.5f; } } }