49 lines
1.1 KiB
C#
49 lines
1.1 KiB
C#
using PathFinding;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Numerics;
|
|
|
|
namespace Gameboard.ShogiUI.UnitTests.PathFinding
|
|
{
|
|
public class SimpleElement : IPlanarElement
|
|
{
|
|
public int Number { get; }
|
|
public MoveSet MoveSet => null;
|
|
public bool IsUpsideDown => false;
|
|
|
|
public SimpleElement(int number)
|
|
{
|
|
Number = number;
|
|
}
|
|
}
|
|
|
|
public class TestPlanarCollection : IPlanarCollection<SimpleElement>
|
|
{
|
|
private readonly SimpleElement[,] array;
|
|
public TestPlanarCollection()
|
|
{
|
|
array = new SimpleElement[3, 3];
|
|
}
|
|
public SimpleElement this[int x, int y]
|
|
{
|
|
get => array[x, y];
|
|
set => array[x, y] = value;
|
|
}
|
|
public SimpleElement this[Vector2 vector]
|
|
{
|
|
get => this[(int)vector.X, (int)vector.Y];
|
|
set => this[(int)vector.X, (int)vector.Y] = value;
|
|
}
|
|
|
|
public IEnumerator<SimpleElement> GetEnumerator()
|
|
{
|
|
foreach (var e in array)
|
|
yield return e;
|
|
}
|
|
//IEnumerator IEnumerable.GetEnumerator()
|
|
//{
|
|
// return array.GetEnumerator();
|
|
//}
|
|
}
|
|
}
|