-
Notifications
You must be signed in to change notification settings - Fork 10
DTL.Shape.RogueLike (形状クラス)
Gunji Ryota edited this page Jan 15, 2020
·
13 revisions
namespace DTL.Shape {
public class RogueLike
}
RogueLike
とは "Matrixの描画範囲にローグライクダンジョンを生成する" 機能を持つクラスである。
描画範囲の全てを必ず塗りつぶす。
DTL.Base.RectBaseRogueLike<TDerived> → DTL.Shape.RogueLike
// (1)
public RogueLike();
// (2)
public RogueLike(uint startX, uint startY, uint width, uint height)
// (3)
public RogueLike(RogueLikeList drawValue)
// (4)
public RogueLike(RogueLikeList drawValue, uint maxWay)
// (5)
public RogueLike(RogueLikeList drawValue, uint maxWay, DTL.Base.Coordinate2DimensionalAndLength2DimensionalmatrixRange roomRange)
// (6)
public RogueLike(RogueLikeList drawValue, uint maxWay, DTL.Base.Coordinate2DimensionalAndLength2DimensionalmatrixRange roomRange, DTL.Base.Coordinate2DimensionalAndLength2DimensionalmatrixRange wayRange)
// (7)
public RogueLike(int outsideWallId, int insideWallId, int roomId, int entranceId, int wayId)
// (8)
public RogueLike(int outsideWallId, int insideWallId, int roomId, int entranceId, int wayId, uint maxWay)
// (9)
public RogueLike(int outsideWallId, int insideWallId, int roomId, int entranceId, int wayId, uint maxWay,
DTL.Base.Coordinate2DimensionalAndLength2DimensionalmatrixRange roomRange)
// (10)
public RogueLike(int outsideWallId, int insideWallId, int roomId, int entranceId, int wayId, uint maxWay,
DTL.Base.Coordinate2DimensionalAndLength2DimensionalmatrixRange roomRange, DTL.Base.Coordinate2DimensionalAndLength2DimensionalmatrixRange wayRange)
// (11)
public RogueLike(DTL.Base.Coordinate2DimensionalAndLength2DimensionalmatrixRange matrixRange, RogueLikeList drawValue, uint maxWay)
// (12)
public RogueLike(DTL.Base.Coordinate2DimensionalAndLength2DimensionalmatrixRange matrixRange, RogueLikeList drawValue, uint maxWay, DTL.Base.Coordinate2DimensionalAndLength2DimensionalmatrixRange roomRange)
// (13)
public RogueLike(DTL.Base.Coordinate2DimensionalAndLength2DimensionalmatrixRange matrixRange, RogueLikeList drawValue, uint maxWay, DTL.Base.Coordinate2DimensionalAndLength2DimensionalmatrixRange roomRange, DTL.Base.Coordinate2DimensionalAndLength2DimensionalmatrixRange wayRange)
// (14)
public RogueLike(uint startX, uint startY, uint width, uint height, RogueLikeList drawValue,
uint maxWay)
// (15)
public RogueLike(uint startX, uint startY, uint width, uint height, RogueLikeList drawValue,
uint maxWay, DTL.Base.Coordinate2DimensionalAndLength2DimensionalmatrixRange roomRange)
// (16)
public RogueLike(uint startX, uint startY, uint width, uint height, RogueLikeList drawValue,
uint maxWay, DTL.Base.Coordinate2DimensionalAndLength2DimensionalmatrixRange roomRange, DTL.Base.Coordinate2DimensionalAndLength2DimensionalmatrixRange wayRange)
// (17)
public RogueLike(DTL.Base.Coordinate2DimensionalAndLength2DimensionalmatrixRange matrixRange)
説明 |
---|
(1) 空のRogueLikeのインスタンスを生成する。 |
(2), (17) 描画範囲を指定したRogueLikeのインスタンスを生成する。 |
(3), (7) 描画値RogueLikeListと指定したRogueLikeのインスタンスを生成する。 |
(4), (8) 描画値RogueLikeListと部屋と道の最大生成数を指定したRogueLikeのインスタンスを生成する。 |
(5), (9) 描画値RogueLikeListと部屋と道の最大生成数, 部屋の大きさを指定したRogueLikeのインスタンスを生成する。 |
(6), (10) 描画値RogueLikeListと生成する道の数, 部屋の大きさ, 部屋と道の最大生成数を指定したRogueLikeのインスタンスを生成する。 |
(11), (14) 描画範囲と描画値RogueLikeList, 部屋と道の最大生成数を指定したRogueLikeのインスタンスを生成する。 |
(12), (15) 描画範囲と描画値RogueLikeListと部屋と道の最大生成数, 部屋の大きさを指定したRogueLikeのインスタンスを生成する。 |
(13), (16) 描画範囲と描画値RogueLikeListと生成する道の数, 部屋の大きさ, 部屋と道の最大生成数を指定したRogueLikeのインスタンスを生成する。 |
Name | Accessibility | Descriptions | Version |
---|---|---|---|
uint startX | public get, protected set | 描画の開始点X | v0.1.0 |
uint startY | public get, protected set | 描画の開始点Y | v0.1.0 |
uint width | public get, protected set | 描画横幅W | v0.1.0 |
uint height | public get, protected set | 描画縦幅H | v0.1.0 |
int outsideWall | public get, protected set | 外壁の値 | v0.1.0 |
int wall | public get, protected set | 外壁の値 | v0.1.0 |
int insideWall | public get, protected set | 内壁の値 | v0.1.0 |
int room | public get, protected set | 部屋の値 | v0.1.0 |
int entrance | public get, protected set | エントランスの値 | v0.1.0 |
int way | public get, protected set | 道の値 | v0.1.0 |
uint maxWay | public get, protected set | 生成する道の最大値 | v0.1.0 |
Name | Descriptions | Version |
---|---|---|
GetPointX | 描画始点座標Xを取得 | v0.1.0 |
GetPointY | 描画始点座標Yを取得 | v0.1.0 |
GetWidth | 描画横幅Wを取得 | v0.1.0 |
GetHeight | 描画縦幅Hを取得 | v0.1.0 |
GetValue | 描画値を取得 | v0.1.0 |
GetOutsideWall | 外壁の値を取得 | v0.1.0 |
GetWall | 外壁の値を取得 | v0.1.0 |
GetInsideWall | 内壁の値を取得 | v0.1.0 |
GetRoom | 部屋の値を取得 | v0.1.0 |
GetEntrance | エントランスの値を取得 | v0.1.0 |
GetWay | 道の値を取得 | v0.1.0 |
GetMaxWay | 生成する道の最大値 | v0.1.0 |
Name | Descriptions | Version |
---|---|---|
SetPointX | 描画始点座標Xを指定 | v0.1.0 |
SetPointY | 描画始点座標Yを指定 | v0.1.0 |
SetWidth | 描画横幅Wを指定 | v0.1.0 |
SetHeight | 描画縦幅Hを指定 | v0.1.0 |
SetPoint | 描画始点座標(X,Y)を指定 | v0.1.0 |
SetRange | 描画範囲(X,Y,W,H)を指定 | v0.1.0 |
SetValue | 描画値を指定 | v0.1.0 |
SetOutsideWall | 外壁の値を指定 | v0.1.0 |
SetWall | 外壁の値を指定 | v0.1.0 |
SetInsideWall | 内壁の値を設定 | v0.1.0 |
SetRoom | 部屋の値を設定 | v0.1.0 |
SetEntrance | エントランスの値を設定 | v0.1.0 |
SetWay | 道の値を設定 | v0.1.0 |
SetMaxWay | 生成する道の最大値を設定 | v0.1.0 |
名前 | 説明 | 対応バージョン |
---|---|---|
ClearPointX | 描画始点座標Xを消去 | v0.1.0 |
ClearPointY | 描画始点座標Yを消去 | v0.1.0 |
ClearWidth | 描画横幅Wを消去 | v0.1.0 |
ClearHeight | 描画縦幅Hを消去 | v0.1.0 |
ClearPoint | 描画始点座標(X,Y)を消去 | v0.1.0 |
ClearRange | 描画範囲(X,Y,W,H)を消去 | v0.1.0 |
ClearValue | 描画値を消去 | v0.1.0 |
Clear | 描画範囲と描画値を消去 | v0.1.0 |
ClearOutsideWall | 外壁の値を消去 | v0.1.0 |
ClearWall | 外壁の値を消去 | v0.1.0 |
ClearInsideWall | 内壁の値を消去 | v0.1.0 |
ClearRoom | 部屋の値を消去 | v0.1.0 |
ClearEntrance | エントランスの値を消去 | v0.1.0 |
ClearWay | 道の値を消去 | v0.1.0 |
ClearMaxWay | 生成する道の最大値を消去 | v0.1.0 |
Name | Descriptions | Version |
---|---|---|
Draw(int[,]) | Matrixに描画する | v0.1.0 |
Create(int[,]) | Matrixに描画してMatrixを返す | v0.1.0 |
using MatrixRange = DTL.Base.Coordinate2DimensionalAndLength2DimensionalmatrixRange;
public class GenerateRogueLikeDungeon : MonoBehaviour {
private readonly int height = 32;
private readonly int width = 48;
private const int outsideWallId = 0;
private const int insideWallId = 1;
private const int roomId = 2;
private const int entranceId = 3;
private const int wayId = 4;
public GameObject OutsideWall;
public GameObject InsideWall;
public GameObject Room;
public GameObject Entrance;
public GameObject Way;
RogueLike rogueLike = new RogueLike(0, 1, 2, 3, 4, 30,
new MatrixRange(3, 3, 2, 2), new MatrixRange(3, 3, 4, 4));
void Start() {
int[,] matrix = new int[height, width];
rogueLike.Draw(matrix);
new OutputConsole().Draw(matrix);
DungeonInstantiate(matrix, height, width);
}
private void DungeonInstantiate(int[,] matrix, int h, int w) {
for (int i = 0; i < h; ++i) {
for (int j = 0; j < w; ++j) {
int pos1 = j;
switch (matrix[i, j]) {
case outsideWallId:
Instantiate(OutsideWall, new Vector3(pos1, 0, i), Quaternion.identity);
break;
case insideWallId:
Instantiate(InsideWall, new Vector3(pos1, 0, i), Quaternion.identity);
break;
case roomId:
Instantiate(Room, new Vector3(pos1, 0, i), Quaternion.identity);
break;
case entranceId:
Instantiate(Entrance, new Vector3(pos1, 0, i), Quaternion.identity);
break;
case wayId:
Instantiate(Way, new Vector3(pos1, 0, i), Quaternion.identity);
break;
}
}
}
}
}
Copyright (c) 2017-2019 Kasugaccho. Copyright (c) 2018-2019 As Project.
Distributed under the Boost Software License, Version 1.0.(See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)