Esempio n. 1
0
    public static Vector2 GenerateWaypoint(MapManagerComponent.Tile tile, LayerMask maskObstacles, int numberOfTries)
    {
        int     i = 0;
        Vector2 waypointGen;

        do
        {
            waypointGen = new Vector2(Random.Range(tile.x1, tile.x2), Random.Range(tile.z1, tile.z2));
            i++;
            if (i > numberOfTries)
            {
                break;
            }
        } while (!CheckIfWalkable(ref waypointGen, maskObstacles));
        return(waypointGen);
    }
Esempio n. 2
0
    //Vector3 originRayCast;
    //Vector3 destinationRayCast;

    public bool GenerateWaypoint(MapManagerComponent.Tile tile, int numberOfTries, out Vector2 genWaypoint)
    {
        int i = 0;

        do
        {
            genWaypoint = new Vector2(Random.Range(tile.x1, tile.x2), Random.Range(tile.z1, tile.z2));
            i++;
            if (i > numberOfTries)
            {
                return(false);
            }
        } while(!CheckIfWalkable(ref genWaypoint, maskObstacles));

        return(true);
    }
Esempio n. 3
0
 public void GoToPlayerTile(MapManagerComponent.Tile tile)
 {
     //TODO goto tile before searching, not necesarry?
     //TODO getobject tile, check if player in the same tile, to increase difficulty, make AI smarter
     SearchTileForPlayer(waypointsTries);
 }