////// protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { if (keyData == (Keys.A))//west { West.PerformClick(); } if (keyData == (Keys.W))//north { North.PerformClick(); } if (keyData == (Keys.D))//east { East.PerformClick(); } if (keyData == (Keys.S))//south { South.PerformClick(); } if (keyData == (Keys.R)) //rest { Restandsleep.PerformClick(); } if (keyData == (Keys.Q)) { Attack.PerformClick(); } if (keyData == (Keys.I)) { Inventor.PerformClick(); } return(base.ProcessCmdKey(ref msg, keyData)); }
protected Direction ParseDirection(string strDirection) { Direction direction; switch (strDirection.ToLower()) { case "north": direction = new North(); break; case "south": direction = new South(); break; case "east": direction = new East(); break; case "west": direction = new West(); break; default: direction = new North(); break; } return(direction); }
//コンパスを確認して向きを変えたい private void CompassCheck() { FirstPosi(); switch (compass) { case 0: North.SetActive(true); Desk.gameObject.SetActive(true); Desk_Left.gameObject.SetActive(true); Desk_Right.gameObject.SetActive(true); deskscreen = 0; itemgetcs.North_Item(); break; case 1: East.SetActive(true); itemgetcs.East_Item(); break; case 2: South.SetActive(true); itemgetcs.South_Item(); break; case 3: West.SetActive(true); itemgetcs.West_Item(); break; } }
public void right_from_west_is_north() { var direction = new West(_plateau); var newdirection = direction.TurnRight(); Assert.That(newdirection, Is.TypeOf <North>()); }
public void left_from_west_is_south() { var direction = new West(_plateau); var newdirection = direction.TurnLeft(); Assert.That(newdirection, Is.TypeOf <South>()); }
public void UpdateAdjacentBlocks() { North.Update(); South.Update(); West.Update(); East.Update(); }
private Direction GetInstanceOfDirection(string directionString) { Direction direction = null; switch (directionString) { case "E": direction = new East(); break; case "W": direction = new West(); break; case "N": direction = new North(); break; case "S": direction = new South(); break; } return(direction); }
public XmlNode ToXml(XmlNode parent) { XmlNode result = parent.OwnerDocument.CreateNode(XmlNodeType.Element, "LatLoBox", string.Empty); // child nodes XmlNode nodNorth = result.OwnerDocument.CreateNode(XmlNodeType.Element, "north", string.Empty); nodNorth.InnerText = North.ToString(); result.AppendChild(nodNorth); XmlNode nodSouth = result.OwnerDocument.CreateNode(XmlNodeType.Element, "south", string.Empty); nodSouth.InnerText = South.ToString(); result.AppendChild(nodSouth); XmlNode nodEast = result.OwnerDocument.CreateNode(XmlNodeType.Element, "east", string.Empty); nodEast.InnerText = East.ToString(); result.AppendChild(nodEast); XmlNode nodWest = result.OwnerDocument.CreateNode(XmlNodeType.Element, "west", string.Empty); nodWest.InnerText = West.ToString(); result.AppendChild(nodWest); XmlNode nodRotation = result.OwnerDocument.CreateNode(XmlNodeType.Element, "rotation", string.Empty); nodRotation.InnerText = Rotation.ToString(); result.AppendChild(nodRotation); return(result); }
public void GivenDirectionSouth_WhenTurnRight_ShouldDirectionWest() { var direction = new South(); var newdirection = direction.Right().ToString(); var expected = new West().ToString(); Assert.Equal(expected, newdirection); }
public void GivenDirectionNorth_WhenTurnLeft_ShouldDirectionWest() { var direction = new North(); var newdirection = direction.Left().ToString(); var expected = new West().ToString(); Assert.Equal(expected, newdirection); }
public void WestShouldBeNorthWhenTurnedClockWise() { IOrientation west = new West(); var turnAntiClockWise = west.TurnClockWise(); turnAntiClockWise.Should().BeOfType <North>(); }
public void Test_West_TurnRight() { var direction = new West(); var right = direction.TurnRight(); Assert.AreEqual("0 1 N", right.GetDirectionAsString()); }
public void When_West_And_Turn_Right_Direction_Should_Be_North() { var direction = new West(_landscape); var newDirection = direction.TurnRight(); Assert.That(newDirection, Is.TypeOf <North>()); }
public void When_West_And_Turn_Left_Direction_Should_Be_South() { var direction = new West(_landscape); var newDirection = direction.TurnLeft(); Assert.That(newDirection, Is.TypeOf <South>()); }
public void Test_West_TurnLeft() { var direction = new West(); var left = direction.TurnLeft(); Assert.AreEqual("0 -1 S", left.GetDirectionAsString()); }
public void When_At_Start_And_Facing_West_And_Move_Do_Not_Pass_Boundary() { var direction = new West(_landscape); direction.Move(); Assert.That(_landscape.CoordinateX, Is.EqualTo(0)); Assert.That(_landscape.CoordinateY, Is.EqualTo(0)); }
public void ReturnNorthWhenGetRightDirectionIsCalled() { West west = West.GetInstance(); var result = west.GetRightDirection(); Assert.NotNull(result); Assert.IsType <North>(result); }
/// <inheritdoc /> public bool Equals(GeoBoundingBox other) { return(West.Equals(other.West) && South.Equals(other.South) && East.Equals(other.East) && North.Equals(other.North) && Nullable.Equals(MinAltitude, other.MinAltitude) && Nullable.Equals(MaxAltitude, other.MaxAltitude)); }
public override void WriteLayerProperties(System.Xml.XmlTextWriter xmlWriter) { xmlWriter.WriteAttributeString("North", North.ToString()); xmlWriter.WriteAttributeString("South", South.ToString()); xmlWriter.WriteAttributeString("East", East.ToString()); xmlWriter.WriteAttributeString("West", West.ToString()); xmlWriter.WriteAttributeString("Rotation", Rotation.ToString()); xmlWriter.WriteAttributeString("Altitude", Altitude.ToString()); }
public void GivenDirectionWest_WhenMove_ShouldXAxisDecremented() { var direction = new West(); var oldPosition = new Core.ValueObject.RoverPosition(3, 3, direction.Direction); var position = direction.Move(oldPosition); Assert.Equal(position.X, oldPosition.X - 1); Assert.Equal(position.Y, oldPosition.Y); }
public void Write(BinaryWriter writer) { writer.Write(Enabled); Position.Write(writer); North.Write(writer); East.Write(writer); South.Write(writer); West.Write(writer); }
public void MarsRover_CurrentDirectionIsWest_RotateRight_TurnsToNorth() { IDirection direction = new West(); Mock <IGrid> grid = new Mock <IGrid>(); MarsRover marsRover = new MarsRover(direction, new Coordinates(0, 0), grid.Object); marsRover.RotateRight(); Assert.That(marsRover.CurrentDirection, Is.TypeOf <North>()); }
public void ReturnSameInstanceWhenGetInstanceIsCalledMoreThanOnce() { West westFirst = West.GetInstance(); West westSecond = West.GetInstance(); Assert.NotNull(westFirst); Assert.NotNull(westSecond); Assert.Same(westFirst, westSecond); }
public void moves_west() { var command = new West(11); var result = command.Move(StartingPosition); result.North.Should().Be(1); result.East.Should().Be(-10); result.Direction.Should().Be(Direction.E); }
public void West_MoveFromCurrentPosition_ReturnsNewCoordinate_WithXMovedBackward( int currentX, int currentY, int newX) { Coordinates currentPosition = new Coordinates(currentX, currentY); IDirection currentDirection = new West(); Coordinates newCoordinates = currentDirection.MoveFrom(currentPosition); Assert.AreEqual(newCoordinates.XCoordinate, newX); Assert.AreEqual(newCoordinates.YCoordinate, currentY); }
// Start is called before the first frame update void Start() { //ボタンの有効・無効設定 North.SetActive(true); East.SetActive(false); South.SetActive(false); West.SetActive(false); //ボタンを押したときの動作 Left.onClick.AddListener(Left_Click); Right.onClick.AddListener(Right_Click); }
public void GetTurtleDirection_West_ReturnWest() { // Arrange var west = new West(); // Act var result = Settings.GetTurtleDirection("W"); // Assert Assert.Equal(result.GetType(), west.GetType()); }
private void FirstPosi() { North.SetActive(false); North_Open.SetActive(false); East.SetActive(false); South.SetActive(false); West.SetActive(false); Desk.gameObject.SetActive(false); Desk_Left.gameObject.SetActive(false); Desk_Right.gameObject.SetActive(false); }
public override int GetHashCode() { unchecked { var hashCode = North.GetHashCode(); hashCode = (hashCode * 397) ^ South.GetHashCode(); hashCode = (hashCode * 367) ^ East.GetHashCode(); hashCode = (hashCode * 347) ^ West.GetHashCode(); return(hashCode); } }
public void Move_HeadedWest_ResultsInPositionToTheLeft() { const int startX = 10; const int startY = 12; Direction sut = new West(); var moveResult = sut.Move(startX, startY); moveResult.x.Should().Be(startX - 1); moveResult.y.Should().Be(startY); }
/// <summary> /// Good place for IoC /// </summary> /// <returns></returns> public Direction InitializeAllCardinalPoints() { var north = new North { Name = "N" }; var south = new South { Name = "S" }; var west = new West { Name = "W" }; var east = new East { Name = "E" }; north.Left = west; north.Right = east; south.Left = east; south.Right = west; return north; }