本文整理汇总了C#中MazeCell类的典型用法代码示例。如果您正苦于以下问题:C# MazeCell类的具体用法?C# MazeCell怎么用?C# MazeCell使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MazeCell类属于命名空间,在下文中一共展示了MazeCell类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Initialize
public override void Initialize (MazeCell primary, MazeCell other, MazeDirection direction)
{
float localX = hinge.localScale.x;
float localY = hinge.localScale.y;
float localZ = hinge.localScale.z;
base.Initialize(primary, other, direction);
if (OtherSideOfDoor != null)
{
isMirrored = true;
hinge.localScale = new Vector3(-localX, localY, localZ);
Vector3 p = hinge.localPosition;
p.x *= -1;
hinge.localPosition = p;
}
for (int i = 0; i < transform.childCount; i++)
{
Transform child = transform.GetChild(i);
if (child != hinge)
{
child.GetComponent<Renderer>().material = cell.room.settings.wallMaterial;
}
}
}
示例2: Initialize
public void Initialize (MazeCell cell) {
base.Initialize (cell);
Vector3 temp = new Vector3(0,6f,0);
this.transform.position += temp;
var killTimer = Random.Range (3, 5);
this.killTime = System.DateTime.Now.AddSeconds (killTimer);
}
示例3: OnControllerColliderHit
void OnControllerColliderHit(ControllerColliderHit hit)
{
Rigidbody body = hit.collider.attachedRigidbody;
MazeCell cell = hit.gameObject.GetComponentInParent<MazeCell>();
if (cell == null)
return;
if(cell != currentCell)
{
if(currentCell != null)
currentCell.OnPlayerExit();
cell.OnPlayerEnter();
}
currentCell = cell;
Vector3 transformDirection = new Vector3(Mathf.Round(transform.forward.x), 0f, Mathf.Round(transform.forward.z));
IntVector2 direction = new IntVector2((int) transformDirection.x, (int) transformDirection.z);
if(direction.x != 0 && direction.z != 0)
{
if (Random.Range(0, 1) == 1)
direction.x = 0;
else
direction.z = 0;
}
MazeDirection mazeDirection = MazeDirections.FromIntVector2(direction);
faceDirection = mazeDirection;
}
示例4: CreatePassage
// creates a passage between the specified cells
private void CreatePassage(MazeCell cell, MazeCell otherCell, MazeDirection direction)
{
MazePassage passage = Instantiate(passagePrefab) as MazePassage;
passage.Initialize(cell, otherCell, direction);
passage = Instantiate(passagePrefab) as MazePassage;
passage.Initialize(otherCell, cell, direction.GetOpposite());
}
示例5: Initialize
public virtual void Initialize (MazeCell cell, MazeDirection direction = MazeDirection.North) {
this.cell = cell;
this.direction = direction;
transform.parent = cell.transform;
transform.localPosition = Vector3.zero;
transform.localRotation = direction.ToRotation();
}
示例6: FindAdjacentCellWall
public int FindAdjacentCellWall(MazeCell mazeCell)
{
if( mazeCell.row == this.row )
{
if( mazeCell.column < this.column)
{
return 0;
}
else
{
return 2;
}
}
else
{
if( mazeCell.row < this.row )
{
return 1;
}
else
{
return 3;
}
}
}
示例7: SetMazeCell
protected void SetMazeCell(int row, int column, MazeCell cell){
if (row >= 0 && column >= 0 && row < mMazeRows && column < mMazeColumns) {
mMaze[row,column] = cell;
}else{
throw new System.ArgumentOutOfRangeException();
}
}
示例8: SetLocation
public void SetLocation (MazeCell cell) {
if (currentCell != null) {
currentCell.OnPlayerExited();
}
currentCell = cell;
transform.localPosition = cell.transform.localPosition;
currentCell.OnPlayerEntered();
}
示例9: GetDoorsContainedAtCell
private List<MazeDoor> GetDoorsContainedAtCell(MazeCell cell) {
var doors = new List<MazeDoor> ();
foreach (var edge in cell.edges) {
if (edge is MazeDoor)
doors.Add ((MazeDoor)edge);
}
return doors;
}
示例10: CreateWall
private void CreateWall(MazeCell cell, MazeCell otherCell, MazeDirection direction){
MazeWall wall = Instantiate (wallFab) as MazeWall;
wall.Initialize (cell, otherCell, direction);
if(otherCell != null){
wall = Instantiate (wallFab) as MazeWall;
wall.Initialize (otherCell, cell, direction.GetOpposite ());
}
}
示例11: CreateDoor
public void CreateDoor(MazeCell mazeCell)
{
int sideToCreateDoorOn = FindAdjacentCellWall(mazeCell);
doors[sideToCreateDoorOn] = true;
int oppositeDoorSide = (sideToCreateDoorOn + 2) % 4;
mazeCell.doors[oppositeDoorSide] = true;
}
示例12: GetMazePassageBasedOnMaxDoorNumber
private MazePassage GetMazePassageBasedOnMaxDoorNumber (MazeCell cell) {
if (cell.room != null && cell.room.Size > maze.cells.Length/(maze.MaxDoorNumber+2) && doorNumber < maze.MaxDoorNumber) {
doorNumber++;
return maze.doorPrefab;
}
else
return maze.passagePrefab;
}
示例13: Initialize
public void Initialize (MazeCell cell, MazeCell otherCell, MazeDirection direction) {
this.cell = cell;
this.otherCell = otherCell;
this.direction = direction;
cell.SetEdge(direction, this);
transform.parent = cell.transform;
transform.localPosition = Vector3.zero;
transform.localRotation = direction.ToRotation();
}
示例14: CreateWall
public void CreateWall(MazeCell cell, MazeCell otherCell, MazeDirection direction)
{
MazeWall wall = Instantiate(wallprefabs[Random.Range(0, wallprefabs.Length)]) as MazeWall;
wall.Initialize(cell, otherCell, direction);
if(otherCell != null)
{
wall = Instantiate(wallprefabs[Random.Range(0, wallprefabs.Length)]) as MazeWall;
wall.Initialize(otherCell, cell, direction.GetOpposite());
}
}
示例15: GetSurroundingCellsInSameRoom
public static List<MazeCell> GetSurroundingCellsInSameRoom(MazeCell cell, MazeCell otherCell, MazeRoom room) {
var selectedCell = cell.room.RoomId == room.RoomId ? cell : otherCell;
List<MazeCell> cells = new List<MazeCell>();
foreach (IntVector2 vectors in MazeDirections.vectorsAllDirections) {
IntVector2 coordinates = selectedCell.coordinates + vectors;
var celly = selectedCell.room.cells.Find (x => x.coordinates == coordinates);
if (celly != null)
cells.Add (celly);
}
return cells;
}