本文整理汇总了C#中World.GetCellAt方法的典型用法代码示例。如果您正苦于以下问题:C# World.GetCellAt方法的具体用法?C# World.GetCellAt怎么用?C# World.GetCellAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类World
的用法示例。
在下文中一共展示了World.GetCellAt方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: should_return_null_if_a_specific_position_is_empty
public void should_return_null_if_a_specific_position_is_empty()
{
var cells = new List<Cell>();
var world = new World(cells, null);
var cell = world.GetCellAt(Position.At(6, 6));
cell.Should().BeNull();
}
示例2: should_return_a_cell_at_a_specific_position_if_it_exits
public void should_return_a_cell_at_a_specific_position_if_it_exits()
{
var cells = new List<Cell> { new Cell(Position.At(6, 6), State.Alive) };
var world = new World(cells, null);
var cell = world.GetCellAt(Position.At(6, 6));
cell.Should().NotBeNull();
}
示例3: Start
// public float SecondsPerGeneration {
// get {
// return secondsPerGeneration;
// }
// set {
// secondsPerGeneration = value;
// }
// }
// Use this for initialization
void Start()
{
Instance = this;
running = false;
World = new World (worldWidth, worldHeight);
cellMap = new Dictionary<Cell, GameObject> ();
for (int x = 0; x < World.Width; x++) {
for (int y = 0; y < World.Height; y++) {
Cell cell = World.GetCellAt (x, y);
GameObject go = new GameObject ();
go.name = "Cell_" + x + "_" + y;
go.transform.position = new Vector3 (cell.X, cell.Y, 0);
go.transform.SetParent (this.transform, true);
// go.AddComponent<SpriteRenderer> ().color = cellColours;
go.AddComponent<SpriteRenderer> ().sprite = floorSprite;
cellMap.Add (cell, go);
cell.RegisterCellChangedCallback ( OnCellChanged );
}
}
if(startRandomised)
World.RandomiseCells ();
}