本文整理汇总了C#中Maze类的典型用法代码示例。如果您正苦于以下问题:C# Maze类的具体用法?C# Maze怎么用?C# Maze使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Maze类属于命名空间,在下文中一共展示了Maze类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MazePrototypeFactory
public MazePrototypeFactory(Maze maze, Room room, Door door, Wall wall)
{
this.prototypeMaze = maze;
this.prototypeRoom = room;
this.prototypeDoor = door;
this.prototypeWall = wall;
}
示例2: Start
// Use this for initialization
void Start()
{
enragedGrowl = GetComponent<AudioSource>();
maze = GameObject.Find("Maze").GetComponent<Maze>();
player = GameObject.Find("Player");
Orientate(col, row);
}
示例3: Start
// Use this for initialization
void Start()
{
maze = new Maze (32, 32);
maze.generate ();
aTexture = maze.tiles;
}
示例4: Update
// Update is called once per frame
void Update ()
{
if(mGen == null)
mGen = FindObjectOfType<MazeGenerator>();
else if(m == null && mGen != null)
{
m = mGen.currentMaze();
if(m != null)
{
Texture2D t = new Texture2D((int)m.Dimensions().x, (int)m.Dimensions().y, TextureFormat.ARGB4444, false);
for(int x=0; x<t.width; x++)
{
for(int y=0; y<t.height; y++)
{
if(m.GetCell(x,y).isWall)
t.SetPixel(x,y,Color.black);
else
t.SetPixel(x,y,Color.white);
}
}
t.anisoLevel = 0;
t.filterMode = FilterMode.Point;
t.Apply();
im.sprite = Sprite.Create(t, new Rect(0,0,t.width,t.height), Vector2.one/2);
}
}
}
示例5: Start
// Use this for initialization
void Start()
{
m_TileList = new List<Transform> ();
for (int x = 0; x < 8; x++) {
for (int y = 0; y < 12; y++) {
int flag = m_MapConfigArray [x, y];
var tileTF = Instantiate (tile, new Vector3 (y * 0.3f, -x * 0.3f, 0), Quaternion.identity) as Transform;
if (flag == 1) {
tileTF.GetComponent<SpriteRenderer> ().color = Color.red;
}
m_TileList.Add (tileTF);
}
}
Maze maze = new Maze(m_MapConfigArray);
Point start = new Point(1, 1);
Point end = new Point(1, 10);
// Transform startTile = m_TileList [1 * 12 + 1];
// startTile.GetComponent<SpriteRenderer> ().color = Color.black;
//
// Transform endTile = m_TileList [6 * 12 + 10];
// endTile.GetComponent<SpriteRenderer> ().color = Color.black;
var parent = maze.FindPath(start, end, false);
while (parent != null)
{
Debug.Log(parent.X + ", " + parent.Y);
Transform targetTile = m_TileList [parent.X * 12 + parent.Y];
targetTile.GetComponent<SpriteRenderer> ().color = Color.green;
parent = parent.ParentPoint;
}
}
示例6: Update
void Update ()
{
if(mGen == null)
mGen = FindObjectOfType<MazeGenerator>();
else if(m == null)
{
m = mGen.currentMaze();
}
else if(pControl == null)
{
GameObject g = GameObject.FindGameObjectWithTag("MyPlayer");
if(g != null)
pControl = g.GetComponent<PlayerControl>();
}
else
{
pOffset = pixelOffset();
cellDim = cellDimenstions();
icon.rectTransform.sizeDelta = new Vector2(cellDimenstions().x, cellDimenstions().y);
icon.transform.localEulerAngles = new Vector3(0,0,-pControl.transform.localEulerAngles.y + 90);
Vector2 pPos = pControl.pos();
float x = pixelOffset().x + (cellDimenstions().x*pPos.x) + (cellDimenstions().x/2);
float y = pixelOffset().y + (cellDimenstions().y*pPos.y) + (cellDimenstions().x/2);
Vector2 v = new Vector2(x,y);
GetComponent<RectTransform>().anchoredPosition = v;
}
}
示例7: Update
// Update is called once per frame
void Update ()
{
if(m == null)
{
m = gen.currentMaze();
RandomPlacement();
}
if(!setup && PlayerControl)
{
gameObject.tag = "MyPlayer";
SpriteObj.SetActive(false);
CamHolder.SetActive(true);
}
bool up = Input.GetKeyDown(KeyCode.UpArrow);
bool down = Input.GetKeyDown(KeyCode.DownArrow);
bool left = Input.GetKeyDown(KeyCode.LeftArrow);
bool right = Input.GetKeyDown(KeyCode.RightArrow);
if(!PlayerControl)
return;
if(up || down || left || right)
{
CmdDoMovement(up, down, left, right);
}
CheckSeen();
if(Input.GetKeyDown(KeyCode.Space))
{
StopCoroutine("LineShow");
StartCoroutine("LineShow");
CmdShoot();
}
}
示例8: Start
// Помещаем персонажа в центр лабиринта
void Start() {
var maze = GameObject.Find("Maze").GetComponent<Maze>();
transform.position = new Vector2(maze.width / 2, maze.height / 2);
dest = transform.position;
mazeInstance = GameObject.Find("Maze").GetComponent<Maze>();
}
示例9: Neighbours
public static List<Cell> Neighbours(Maze maze, Point point)
{
List<Cell> neighbours = new List<Cell>();
if (point.y > 1)
{
neighbours.Add(maze.Grid[point.x, point.y-1]);
}
if (point.y < maze.height-2)
{
neighbours.Add(maze.Grid[point.x, point.y+1]);
}
if (point.x > 1)
{
neighbours.Add(maze.Grid[point.x-1, point.y]);
}
if (point.x < maze.width-2)
{
neighbours.Add(maze.Grid[point.x+1, point.y]);
}
return neighbours;
}
示例10: afterFrame
IEnumerator afterFrame()
{
yield return true;
online = true;
m = GameObject.FindObjectOfType<MazeGenerator>().currentMaze();
wantPos = randomPos();
}
示例11: generateNewStage
public void generateNewStage(GameObject floorTile,
GameObject wallBlock,
GameObject coin,
GameObject player,
GameObject targetSprite,
GameObject door,
int difficulty,
int maxDifficulty)
{
// Grab prefabs from function call
_floorTile = floorTile;
_wallBlock = wallBlock;
_coin = coin;
_player = player;
_targetSprite = Instantiate(targetSprite);
_door = door;
// Determine size and num coins for this stage
determineParamsBasedOnDifficulty(difficulty, maxDifficulty);
// Create our maze
_maze = new Maze(_size, difficulty, maxDifficulty);
_maze.generateMap();
// Allocate our arrays
_coins = new GameObject[_numCoins];
_components = new GameObject[(int)_size.x,(int)_size.y];
// Instantiate our prefabs
placeComponentsFromMap();
}
示例12: MazyPrototypeFactory
public MazyPrototypeFactory(Maze maze, Wall wall, Room room, Door door)
{
_maze = maze;
_wall = wall;
_room = room;
_door = door;
}
示例13: BeginGame
private void BeginGame()
{
mazeInstance = Instantiate(mazePrefab) as Maze;
//StartCoroutine(mazeInstance.Generate());
mazeInstance.Generate();
timeLimit = mazeInstance.difficulty *1.5f;
timerText.color = new Color(0,1,213.0f/255.0f);
}
示例14: BotFactory
public BotFactory(Maze maze, EngineSettings settings, WallGrid walls, BrainFactory brainFactory, EyeFactory eyeFactory)
{
_maze = maze;
_settings = settings;
_walls = walls;
_brainFactory = brainFactory;
_eyeFactory = eyeFactory;
}
示例15: render
public override void render(Maze pmaze)
{
base.render(pmaze);
statX.Text = pmaze.Width.ToString();
statY.Text = pmaze.Height.ToString();
statRendered.Text = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
}