Example #1
0
    private void WallsTest()
    {
        var walls = new Walls();

        walls.AddWallData(WallData.CreateCurved(-2f, -2f, -4f, -0f, -2, 2, 0.3f, 2f));
        walls.AddWallData(
            WallData.CreateStreight(-2f, 2f, 0f, 2f, 0.4f, 2f, null, WidthChangeType.Type2));
        walls.AddWallData(WallData.CreateStreight(0f, 2f, 2f, 2f, 0.1f, 1f));
        walls.AddWallData(WallData.CreateStreight(2f, 2f, 2f, -2f, 0.2f, 2f));
        walls.AddWallData(WallData.CreateStreight(2f, -2f, -2f, -2f, 0.5f, 2f));

//        var walls = new Dictionary<Vector2, List<WallData>> ();


/*        var walls = new[]
 *      {
 * //            BaseWallData.CreateStreight (new Vector2 (-2, -2), new Vector2 (-2, 2), 0.2f, 2f),
 *          WallData.CreateCurved (new Vector2 (-2, -2), new Vector2 (-4, -0), new Vector2 (-2, 2), 0.3f, 2f),
 *          WallData.CreateStreight (new Vector2 (-2, 2), new Vector2 (0, 2), 0.4f, 2f, null, WidthChangeType.Type2),
 *          WallData.CreateStreight (new Vector2 (0, 2), new Vector2 (2, 2), 0.1f, 1f),
 *          WallData.CreateStreight (new Vector2 (2, 2), new Vector2 (2, -2), 0.2f, 2f),
 *          WallData.CreateStreight (new Vector2 (2, -2), new Vector2 (-2, -2), 0.5f, 2f)
 *      };*/

/*        var walls = new[]
 *      {
 *          WallData.CreateStreight (new Vector2 (0, -2), new Vector2 (-2, 0), 0.2f, 2f),
 *          WallData.CreateStreight (new Vector2 (-2, 0), new Vector2 (0, 2), 0.2f, 2f),
 *          WallData.CreateStreight (new Vector2 (0, 2), new Vector2 (2, 0), 0.2f, 2f),
 *          WallData.CreateStreight (new Vector2 (2, 0), new Vector2 (0, -2), 0.2f, 2f)
 *      };*/

/*        var wallsCount = walls.Count;
 *      for (int i = 0; i < wallsCount; i++) {
 *          var prevIndex = (i - 1 + wallsCount) % wallsCount;
 *          var nextIndex = (i + 1) % wallsCount;
 *
 *          var meshes = WallMeshesGenerator.GetWallMeshes (walls[prevIndex], walls[i], walls[nextIndex]);
 *          var parent = new GameObject ($"Wall {i}").transform;
 *          for (int j = 0; j < meshes.Length; j++) {
 *              var mesh = meshes[j];
 *              MeshGenerator
 *                  .CreateGameObject (mesh.name, mesh)
 *                  .transform
 *                  .SetParent (parent, false);
 *          }
 *      }*/
    }
Example #2
0
    private void RoomsFinderTest()
    {
        var walls = new Walls();

        walls.AddWallData(WallData.CreateStreight(1f, 2f, 0f, 3f, 0.1f, 2f));
        walls.AddWallData(WallData.CreateStreight(0f, 2f, 0f, 3f, 0.1f, 2f));

        walls.AddWallData(WallData.CreateStreight(1f, 1f, 0.5f, 0.5f, 0.1f, 2f));
        walls.AddWallData(WallData.CreateStreight(0f, 0f, 0f, 2f, 0.1f, 2f));
        walls.AddWallData(WallData.CreateStreight(0f, 2f, 1f, 2f, 0.1f, 2f));
        walls.AddWallData(WallData.CreateStreight(1f, 2f, 1f, 3f, 0.1f, 2f));
        walls.AddWallData(WallData.CreateStreight(1f, 3f, 4f, 3f, 0.1f, 2f));
        walls.AddWallData(WallData.CreateStreight(4f, 3f, 2f, 2f, 0.1f, 2f));
        walls.AddWallData(WallData.CreateStreight(2f, 2f, 1f, 2f, 0.1f, 2f));
        walls.AddWallData(WallData.CreateStreight(2f, 2f, 2f, 0f, 0.1f, 2f));
        walls.AddWallData(WallData.CreateStreight(2f, 0f, 0f, 0f, 0.1f, 2f));
        walls.AddWallData(WallData.CreateStreight(1f, 2f, 1f, 1f, 0.1f, 2f));
        walls.AddWallData(WallData.CreateStreight(2f, 0f, 1.5f, 0.5f, 0.1f, 2f));
        walls.AddWallData(WallData.CreateStreight(1.5f, 0.5f, 1.5f, 1f, 0.1f, 2f));
        walls.AddWallData(WallData.CreateStreight(1.5f, 1f, 1f, 1f, 0.1f, 2f));


        walls.AddWallData(WallData.CreateStreight(10f, 10f, 10f, 15f, 0.1f, 2f));
        walls.AddWallData(WallData.CreateStreight(10f, 15f, 15f, 15f, 0.1f, 2f));
        walls.AddWallData(WallData.CreateStreight(15f, 15f, 15f, 10f, 0.1f, 2f));
        walls.AddWallData(WallData.CreateStreight(15f, 10f, 10f, 10f, 0.1f, 2f));

        walls.AddWallData(WallData.CreateStreight(11f, 11f, 11f, 13f, 0.1f, 2f));
        walls.AddWallData(WallData.CreateStreight(11f, 13f, 13f, 13f, 0.1f, 2f));
        walls.AddWallData(WallData.CreateStreight(13f, 13f, 13f, 11f, 0.1f, 2f));
        walls.AddWallData(WallData.CreateStreight(13f, 11f, 11f, 11f, 0.1f, 2f));


/*        walls.AddWallData (WallData.CreateStreight (0f, 0f, 0f, 2f, 0.1f, 2f));
 *      walls.AddWallData (WallData.CreateStreight (0f, 2f, 2f, 2f, 0.1f, 2f));
 *      walls.AddWallData (WallData.CreateStreight (2f, 2f, 2f, 0f, 0.1f, 2f));
 *      walls.AddWallData (WallData.CreateStreight (0f, 0f, 2f, 0f, 0.1f, 2f));*/

/*        walls.AddWallData (WallData.CreateStreight (2f, 2f, 3f, 2f, 0.1f, 2f));
 *      walls.AddWallData (WallData.CreateStreight (3f, 2f, 3f, 0f, 0.1f, 2f));
 *      walls.AddWallData (WallData.CreateStreight (3f, 0f, 2f, 0f, 0.1f, 2f));*/


        RoomMeshesGenerator.CreateRoomMeshes(walls);
    }