Beispiel #1
0
        /// <summary>
        /// Helper function allowing you to calculate the position of the car
        /// on a starting/finishing grid given the car position.
        /// Add the returned value with the starting/finishing line.
        /// </summary>
        /// <param name="carPosNo">Car position number.</param>
        /// <returns>Grid position</returns>
        Vector3 CalculateGridPosition(int carPosNo)
        {
            Vector3 result = firstCarBaseLineDisplacement;

            for (int curCarPosNo = 0; curCarPosNo < carPosNo; curCarPosNo++)
            {
                result -= verticalDistanceBetweenCars + horizontalDistanceBetweenCars * LanguageExtensions.FastPow(-1, curCarPosNo);
            }
            return(result);
        }