예제 #1
0
파일: AStar.cs 프로젝트: hwchan/new-kite
 // takes in pos and target as 3D world coordinates
 public static Vector3 Flee(Vector3 position, Vector3 target, LevelInfo mapInfo)
 {
     // delegate/reduce to 2D data version
     Vector2 gridVersion = Flee(mapInfo.LevelToGrid(position), mapInfo.LevelToGrid(target), mapInfo);
     return mapInfo.GridToLevel(gridVersion);
 }
예제 #2
0
파일: AStar.cs 프로젝트: hwchan/new-kite
    // takes in pos and target as 3D world coordinates
    public static Vector3 Find(Vector3 position, Vector3 target, LevelInfo mapInfo)
    {
        // optional todo: first perform a raycast from position to target
        // if there is nothing blocking
        // simply return target
        // Note: to do this properly, we'd need a layerMask as to not
        // "collide" with the player (meaning it'd always return false)

        // delegate/reduce to 2D data version
        Vector2 gridVersion = Find(mapInfo.LevelToGrid(position), mapInfo.LevelToGrid(target), mapInfo);
        return mapInfo.GridToLevel(gridVersion);
    }