// Update is called once per frame void Update() { // THIS IS JUST A TEST OF SUMMONING ENEMIES AND GETTING THEM TO RECOGIZE THE MAP LOGIC if (Input.GetKeyDown(KeyCode.Space)) { GameObject enemyInstance = Instantiate(enemyBasic, TileMapLogic.getTileBehaviorByGridPosition(1, 1).transform.position, Quaternion.identity); GameController.enemies.Add(enemyInstance); } }
static List <Location> GetWalkableAdjacentSquares(int x, int y) { var proposedLocations = new List <Location>() { new Location(x, y - 1), new Location(x, y + 1), new Location(x - 1, y), new Location(x + 1, y), }; return(proposedLocations.Where( loc => TileMapLogic.getTileBehaviorByGridPosition(loc.Y, loc.X) != null && (!TileMapLogic.getTileBehaviorByGridPosition(loc.Y, loc.X).isBlocking || TileMapLogic.getTileBehaviorByGridPosition(loc.Y, loc.X).isHeroDestination) ).ToList()); //loc => map[loc.Y][loc.X] == ' ' || map[loc.Y][loc.X] == 'B').ToList(); }
public void setNextMoveToLocation() { // set next moveto location currentPlaceInTileSequence++; if (currentPlaceInTileSequence > myCurrentPath.ToArray().Length - 1) { Debug.Log("HIT DESTINATION"); Destroy(gameObject); return; } Vector2 nextTileCoord = myCurrentPath[currentPlaceInTileSequence]; // gets current moveto location by getting the specific tile at that grid coordinate and grabbing its position. currentMoveToLocation = TileMapLogic .getTileBehaviorByGridPosition((int)nextTileCoord[0], (int)nextTileCoord[1]) .transform .position; }