示例#1
0
 // 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);
     }
 }
示例#2
0
    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();
    }
示例#3
0
    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;
    }