本文整理汇总了C#中MazeCell类的典型用法代码示例。如果您正苦于以下问题:C# MazeCell类的具体用法?C# MazeCell怎么用?C# MazeCell使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MazeCell类属于命名空间,在下文中一共展示了MazeCell类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
}
}
开发者ID:designerzim,项目名称:unity-Maze,代码行数:25,代码来源:MazeDoor.cs
示例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);
}
开发者ID:papakaliati,项目名称:simplePrototypeOfPrototype,代码行数:7,代码来源:SpawningSphere.cs
示例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;
}
开发者ID:thmundal,项目名称:Blendertest,代码行数:31,代码来源:Player.cs
示例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());
}
开发者ID:RireMakar,项目名称:Unity-Backtracking,代码行数:8,代码来源:Maze.cs
示例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();
}
开发者ID:papakaliati,项目名称:simplePrototypeOfPrototype,代码行数:7,代码来源:MazeObject.cs
示例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;
}
}
}
开发者ID:julianstengaard,项目名称:TwinSpirits,代码行数:25,代码来源:MazeCell.cs
示例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();
}
}
开发者ID:jpecoraro342,项目名称:VR-Maze,代码行数:7,代码来源:BasicMazeGenerator.cs
示例8: SetLocation
public void SetLocation (MazeCell cell) {
if (currentCell != null) {
currentCell.OnPlayerExited();
}
currentCell = cell;
transform.localPosition = cell.transform.localPosition;
currentCell.OnPlayerEntered();
}
开发者ID:gulfaraz,项目名称:GGJ2016,代码行数:8,代码来源:Player.cs
示例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;
}
开发者ID:papakaliati,项目名称:simplePrototypeOfPrototype,代码行数:8,代码来源:DoorsOptimization.cs
示例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 ());
}
}
开发者ID:kleptodorf,项目名称:CS3013,代码行数:8,代码来源:Maze.cs
示例11: CreateDoor
public void CreateDoor(MazeCell mazeCell)
{
int sideToCreateDoorOn = FindAdjacentCellWall(mazeCell);
doors[sideToCreateDoorOn] = true;
int oppositeDoorSide = (sideToCreateDoorOn + 2) % 4;
mazeCell.doors[oppositeDoorSide] = true;
}
开发者ID:julianstengaard,项目名称:TwinSpirits,代码行数:8,代码来源:MazeCell.cs
示例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;
}
开发者ID:papakaliati,项目名称:simplePrototypeOfPrototype,代码行数:8,代码来源:MazeRandomDoorPropability.cs
示例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();
}
开发者ID:Zoltaris,项目名称:MinotaurMaze,代码行数:9,代码来源:MazeCellEdge.cs
示例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());
}
}
开发者ID:thmundal,项目名称:Blendertest,代码行数:10,代码来源:Maze.cs
示例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;
}
开发者ID:papakaliati,项目名称:simplePrototypeOfPrototype,代码行数:12,代码来源:MazeCell.cs
示例16: GetAllNeighborhoodCellsInSameRoom
public static List<MazeCell> GetAllNeighborhoodCellsInSameRoom(MazeCell cell, int factor) {
List<MazeCell> cells = new List<MazeCell>();
foreach (IntVector2 vectors in MazeDirections.vectorsAllDirections) {
IntVector2 tempVector = new IntVector2(0,0);
for (int k = 0; k < factor+1; ++k)
tempVector += vectors ;
IntVector2 coordinates = cell.coordinates + tempVector;
var celly = cell.room.cells.Find (x => x.coordinates == coordinates);
if (celly != null)
cells.Add (celly);
}
return cells;
}
开发者ID:papakaliati,项目名称:simplePrototypeOfPrototype,代码行数:13,代码来源:MazeCell.cs
示例17: GetCellComplexity
private int GetCellComplexity(MazeCell cell) {
int complexity = 0;
int counter = 0;
bool edgeReached = false;
while (!edgeReached) {
var neighborhoodCells = MazeCell.GetAllNeighborhoodCellsInSameRoom (cell, counter++);
complexity += neighborhoodCells.Count;
if (neighborhoodCells.Count < 8)
edgeReached = true;
}
return complexity;
}
开发者ID:papakaliati,项目名称:simplePrototypeOfPrototype,代码行数:13,代码来源:MazeComplexity.cs
示例18: CreatePassage
private void CreatePassage(MazeCell cell, MazeCell otherCell, MazeDirection direction)
{
MazePassage prefab = Random.value < doorProbability ? doorPrefab : passagePrefab;
MazePassage passage = Instantiate(prefab) as MazePassage;
passage.Initialize(cell, otherCell, direction);
passage = Instantiate(prefab) as MazePassage;
if (passage is MazeDoor) {
otherCell.Initialize(CreateRoom(cell.room.settingsIndex));
}
else {
otherCell.Initialize(cell.room);
}
passage.Initialize(otherCell, cell, direction.GetOpposite());
}
开发者ID:sabrinagreenlee,项目名称:JaneBound,代码行数:14,代码来源:Maze.cs
示例19: Maze
public Maze(int width, int height)
{
this.width = width;
this.height = height;
cells = new MazeCell[width, height];
//Fill the cells-array
for (int y = 0; y < height; y++)
{
for (int x = 0; x < width; x++)
{
cells[x,y] = new MazeCell(x, y);
}
}
}
开发者ID:julianstengaard,项目名称:TwinSpirits,代码行数:16,代码来源:Maze.cs
示例20: BasicMazeGenerator
public BasicMazeGenerator(int rows, int columns){
mMazeRows = Mathf.Abs(rows);
mMazeColumns = Mathf.Abs(columns);
if (mMazeRows == 0) {
mMazeRows = 1;
}
if (mMazeColumns == 0) {
mMazeColumns = 1;
}
mMaze = new MazeCell[rows,columns];
for (int row = 0; row < rows; row++) {
for(int column = 0; column < columns; column++){
mMaze[row,column] = new MazeCell();
}
}
}
开发者ID:jpecoraro342,项目名称:VR-Maze,代码行数:16,代码来源:BasicMazeGenerator.cs
注:本文中的MazeCell类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论