public void TeleportTargetSelect() { ToBeChecked.Clear(); ValidTargets.Clear(); TargetLocations.Clear(); PossibleTeleportDestinations.Clear(); if (Grid == null) { Grid = GetComponent <Pathfinding>().Grid; } foreach (GameObject T in GetComponent <Pathfinding>().CurrentLocation.GetComponent <Tile>().Adjacent) { ToBeChecked.Add(T); } foreach (GameObject T in ToBeChecked) { if (T.GetComponent <Pathnode>().CurrentOccupant != null) { if (T.GetComponent <Pathnode>().CurrentOccupant.GetComponent <Unit>().Owner == GetComponent <Unit>().Owner) { ValidTargets.Add(T.GetComponent <Pathnode>().CurrentOccupant); TargetLocations.Add(T); } } } foreach (Transform TTT in Grid) { if (TargetLocations.Contains(TTT.gameObject) == false) { TTT.GetComponent <Pathnode>().Fade(); } } }
public void GenerateMovementOptions() { ToCheck.Clear(); Checked.Clear(); CanMoveTo.Clear(); foreach (Transform node in Grid) { node.GetComponent <Pathnode>().SetMPRequired(1); TileType tileType = node.GetComponent <Tile>().GetTile(); if (tileType == TileType.grass) { node.GetComponent <Pathnode>().SetMPRequired(Grass); } if (tileType == TileType.forest) { node.GetComponent <Pathnode>().SetMPRequired(Forest); } if (tileType == TileType.water) { node.GetComponent <Pathnode>().SetMPRequired(Water); } if (tileType == TileType.hills) { node.GetComponent <Pathnode>().SetMPRequired(Hills); } if (tileType == TileType.castle) { node.GetComponent <Pathnode>().SetMPRequired(Castle); } if (tileType == TileType.sand) { node.GetComponent <Pathnode>().SetMPRequired(Sand); } } //Debug.Log("calculating movement"); CurrentLocation.GetComponent <Pathnode>().MPRemain = MovePoints; ToCheck.Add(CurrentLocation); CanMoveTo.Add(CurrentLocation); FindAvailableTiles(CurrentLocation); foreach (GameObject T in ToCheck.ToArray()) { FindAvailableTiles(T); } foreach (Transform TTT in Grid) { if (CanMoveTo.Contains(TTT.gameObject) == false) { TTT.GetComponent <Pathnode>().Fade(); } } }