I have a readonly List that contains a few coordinates.
private readonly List<float[]> rightPositions = new List<float[]>()
{
new float[2] { 250, 0 },
new float[2] { 350, -200 },
new float[2] { 350, 200 },
new float[2] { 600, 0 }
};
In the following method I give the static data from List<float[]> rightPositions
to the field rTeam.PlayerArray[iterator].Position
.
private void ClearPlayers(Team rTeam, Team lTeam)
{
for (int iterator = 0; iterator < rTeam.PlayerArray.Length; iterator++)
{
rTeam.PlayerArray[iterator].Position = rightPositions.ElementAt(iterator);
}
}
The first time ClearPlayers(Team rTeam, Team lTeam)
is executed, the data from the List<float[]> rightPositions
is put in the rTeam.PlayerArray[iterator].Position
. After the first time, the data in the readonly List<float[]> rightPositions
is not the same as before.
Did I miss something obvious? Or do I need to use something els than a readonly field?
Thanks in advance.