LazyBot/Assets/Scripts/Navigation/NavigationContainer.cs
/// <summary>
/// Calculates target's speed on point, based on its position.
/// </summary>
/// <param name="speed">Target's absolute speed.</param>
/// <param name="position">Target's position.</param>
/// <param name="index">Index of navigation point.</param>
Calculates target's speed on point, based on its position.
Calculates target ' s speed on point based on its position .
public void CalculateSpeedOnPoint(ref float speed, Vector3 position, int index)
        {
            float distance = Vector3.Distance(position, Points[index].Transform.position);
            if (distance <= Points[index].ImpactRadius)
            {
                speed = Mathf.Lerp(speed * Points[index].MinImpactSpeed, speed,
                        distance / Points[index].ImpactRadius);
            }
        }
public void CalculateSpeedOnPoint ( ref float speed , Vector3 position , int index ) { float distance = Vector3 . Distance ( position , Points [ index ] . Transform . position ) ; if ( distance <= Points [ index ] . ImpactRadius ) { speed = Mathf . Lerp ( speed * Points [ index ] . MinImpactSpeed , speed , distance / Points [ index ] . ImpactRadius ) ; } }
Calculates target's speed on point, based on its position.
Calculates target ' s speed on point based on its position .
float
ref
position
Vector3
None
index
int
Index of navigation point.
Index of navigation point .
speed
Target's absolute speed.
Target ' s absolute speed .