Ejemplo n.º 1
0
 public void GetDistanceBetweenFloorPositionsWorksShortDistance()
 {
     var p1 = new ArenaFloorPosition(0, 0);
     var p2 = new ArenaFloorPosition(1, 2);
     var d = ArenaHelper.GetDistanceBetweenFloorPositions(p1, p2);
     Assert.IsTrue(d == 1);
 }
 public void ShouldGetDistanceBetweenFloorPositionsForLongDistance()
 {
     var p1 = new ArenaFloorPosition(0, 1);
     var p2 = new ArenaFloorPosition(10, 25);
     var d = ArenaHelper.GetDistanceBetweenFloorPositions(p1, p2);
     Assert.IsTrue(d == 26);
 }
Ejemplo n.º 3
0
        public static ArenaFloorPosition GetClosestMovablePosition(ArenaFloorPosition p1, ArenaFloorPosition p2, int distance)
        {
            var position = new ArenaFloorPosition(p1.XCoord,p1.YCoord);
            for (var i = 0; i < distance; i++)
            {
                if (p1.XCoord != p2.XCoord)
                {
                    position.SetXCoord(position.XCoord > p2.XCoord ? position.XCoord - 1 : position.XCoord + 1);
                }

                if (p1.YCoord == p2.YCoord) continue;
                position.SetYCoord(position.YCoord > p2.YCoord ? position.YCoord - 1 : position.YCoord + 1);

            }
            return position;
        }
Ejemplo n.º 4
0
 public static int GetDistanceBetweenFloorPositions(ArenaFloorPosition p1, ArenaFloorPosition p2)
 {
     return Convert.ToInt32(Math.Floor(Maths.MathematicalFunctions.PythagorusGetHypotenusLengthFromRightAngledLengths(p1.XCoord - p2.XCoord, p2.YCoord - p2.YCoord)));
 }
Ejemplo n.º 5
0
 public void SetCharacterLocation(int x, int y)
 {
     characterLocation = new ArenaFloorPosition(x, y);
 }
Ejemplo n.º 6
0
 public ArenaFloorTile SelectFloorTile(ArenaFloorPosition pos)
 {
     return ArenaFloor[pos.XCoord,pos.YCoord];
 }