コード例 #1
0
 public void Execute()
 {
     carInFront[0] = new CarInFront
     {
         Dist = Highway1.MinDistBetweenCars * 10.0f,
         Velocity = 40.0f,
     };
 }
コード例 #2
0
            public void Execute(int index)
            {
                float d0;
                float velocity;

                if (index == 0)
                {
                    d0 = positionSort[count - 1].Position + laneLength;
                    velocity = positionSort[count - 1].Velocity;
                }
                else
                {
                    d0 = positionSort[index - 1].Position;
                    velocity = positionSort[index - 1].Velocity;
                }

                var d1 = positionSort[index].Position;
                var dist = d0 - d1;
                var remap = positionSort[index].Index;
                carInFront[remap] = new CarInFront { Dist = dist, Velocity = velocity };
            }