Created
May 11, 2016 17:13
-
-
Save IronMonk-UK/bc9de704cf93e78220409925ab791e02 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Makes tiles populated by units unwalkable, so they cannot be moved to, or stopped on | |
void BlockUnitTiles() { | |
// If the current unit is a User unit, and moving | |
if (userUnits.Contains(units[currentUnitIndex]) && units[currentUnitIndex].moving) { | |
// For every unit | |
foreach(Unit u in units) { | |
// If the unit is not the current unit | |
if(u != units[currentUnitIndex]) | |
// Set the walkable bool on the node of the populated tile to false | |
u.currentTile.node.walkable = false; | |
} | |
} | |
// If the unit has finished movement | |
if (units[currentUnitIndex].moved) { | |
// For every unit | |
foreach(Unit u in units) { | |
// Set the walkable bool on the node of the populated tile back to true | |
u.currentTile.node.walkable = true; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment