Sunday 24 January 2016

Further Movement Issues

Since my last post, I have been attempting to expand on the current movement implemented. To do this, I have attempted have players create a path in game, that their unit would then follow. This would allow me to implement a movement limit, and ensure that all units move tile to tile, rather than the current "shoot across the map to x location".

While I have been able to start on the creation of paths, I have hit a slight wall in dealing with a foreach loop. Tiles for a path are selected, and being added to a list that would comprise of every tile moved to along the path. The issue is, players can double back on themselves, by selecting a previously selected, adjacent tile. I have attempted to create a foreach loop, as below in Tile.cs, that looks for any member of the list that matches the tile being added. If already there, it should remove the tile from the list, but currently, the foreach is only reaching the first entry of the list, and never going further.

Further details on progress can be found in the comments on Tile.cs.