Пример #1
0
    void CreateDungeon()
    {
        Vector2Int origin = new Vector2Int();

        for (int i = 0; i < 10; i++)
        {
            string path = GenerateMap(origin, UnityEngine.Random.Range(5, 31));
            if (i == 0)
            {
                goalLocation = origin.Adjust(path);
            }
            origin = origin.Adjust(path.Substring(0, UnityEngine.Random.Range(1, path.Length)));
        }

        Debug.Log("\r\n" + map.AsMap());
        Debug.Log("\r\n" + map.AsMap(goalLocation));
    }
Пример #2
0
    public static Vector2Int Adjust(this Vector2Int origin, List <Room.PlayerExit> path)
    {
        Vector2Int toReturn = new Vector2Int(origin.x, origin.y);

        foreach (var dir in path)
        {
            toReturn = toReturn.Adjust(dir);
        }
        return(toReturn);
    }
Пример #3
0
    public static Vector2Int Adjust(this Vector2Int origin, string path)
    {
        Vector2Int toReturn = new Vector2Int(origin.x, origin.y);

        foreach (var dir in path)
        {
            toReturn = toReturn.Adjust(dir.GetExit());
        }

        return(toReturn);
    }
Пример #4
0
 void InstantiateNewRoom(Room.PlayerExit direction)
 {
     Debug.Log(direction);
     GetNewRoom(currentLocation.Adjust(direction));
 }