Exemplo n.º 1
0
 void OnTriggerStay(Collider other)
 {
     if (other.name == "roast")
     {
         if (bottomInd.transform.position.y < topInd.transform.position.y)
         {
             n += (float)roast_inc * Time.deltaTime;
             //North.GetComponent<UnityEngine.UI.Text>().text = (n).ToString();
         }
         else if (bottomInd.transform.position.y > topInd.transform.position.y)
         {
             s += (float)roast_inc * Time.deltaTime;
             //South.GetComponent<UnityEngine.UI.Text>().text = (s).ToString();
         }
     }
     if (other.name == "burn")
     {
         if (bottomInd.transform.position.y < topInd.transform.position.y)
         {
             n += (float)burn_inc * Time.deltaTime;
             s += (float)roast_inc * Time.deltaTime;
             North.GetComponent <UnityEngine.UI.Text>().text = (n).ToString();
             South.GetComponent <UnityEngine.UI.Text>().text = (s).ToString();
         }
         else if (bottomInd.transform.position.y > topInd.transform.position.y)
         {
             s += (float)burn_inc * Time.deltaTime;
             n += (float)roast_inc * Time.deltaTime;
             South.GetComponent <UnityEngine.UI.Text>().text = (s).ToString();
             North.GetComponent <UnityEngine.UI.Text>().text = (n).ToString();
         }
     }
 }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
 //////
 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));
 }
Exemplo n.º 4
0
        public void When_South_And_Turn_Right_Direction_Should_Be_West()
        {
            var direction    = new South();
            var newdirection = direction.TurnRight();

            Assert.That(newdirection, Is.TypeOf <West>());
        }
Exemplo n.º 5
0
 void OnTriggerStay(Collider other)
 {
     if (other.name == "roast")
     {
         if (stick.transform.localRotation.eulerAngles.x < 180 && stick.transform.rotation.eulerAngles.x > 0)
         {
             n += (float)roast_inc * Time.deltaTime;
             North.GetComponent <UnityEngine.UI.Text>().text = (n).ToString();
         }
         else if (stick.transform.localRotation.eulerAngles.x > 180 && stick.transform.rotation.eulerAngles.x < 360)
         {
             s += (float)roast_inc * Time.deltaTime;
             South.GetComponent <UnityEngine.UI.Text>().text = (s).ToString();
         }
     }
     if (other.name == "burn")
     {
         if (bottomInd.transform.position.x < topInd.transform.position.x)
         {
             n += (float)burn_inc * Time.deltaTime;
             s += (float)roast_inc * Time.deltaTime;
             North.GetComponent <UnityEngine.UI.Text>().text = (n).ToString();
             South.GetComponent <UnityEngine.UI.Text>().text = (s).ToString();
         }
         else if (bottomInd.transform.position.x > topInd.transform.position.x)
         {
             s += (float)burn_inc * Time.deltaTime;
             n += (float)roast_inc * Time.deltaTime;
             South.GetComponent <UnityEngine.UI.Text>().text = (s).ToString();
             North.GetComponent <UnityEngine.UI.Text>().text = (n).ToString();
         }
     }
 }
Exemplo n.º 6
0
        public void When_South_And_Turn_Left_Direction_Should_Be_East()
        {
            var direction    = new South();
            var newdirection = direction.TurnLeft();

            Assert.That(newdirection, Is.TypeOf <East>());
        }
Exemplo n.º 7
0
        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);
        }
Exemplo n.º 8
0
        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);
        }
Exemplo n.º 9
0
 public void UpdateAdjacentBlocks()
 {
     North.Update();
     South.Update();
     West.Update();
     East.Update();
 }
Exemplo n.º 10
0
    //コンパスを確認して向きを変えたい
    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;
        }
    }
Exemplo n.º 11
0
        public void right_from_south_is_east()
        {
            var direction    = new South(_plateau);
            var newdirection = direction.TurnRight();

            Assert.That(newdirection, Is.TypeOf <West>());
        }
Exemplo n.º 12
0
        public void left_from_south_is_west()
        {
            var direction    = new South(_plateau);
            var newdirection = direction.TurnLeft();

            Assert.That(newdirection, Is.TypeOf <East>());
        }
Exemplo n.º 13
0
        public void Test_South_TurnRight()
        {
            var direction = new South();

            var right = direction.TurnRight();

            Assert.AreEqual("-1 0 W", right.GetDirectionAsString());
        }
Exemplo n.º 14
0
        public void GivenDirectionSouth_WhenTurnRight_ShouldDirectionWest()
        {
            var direction    = new South();
            var newdirection = direction.Right().ToString();
            var expected     = new West().ToString();

            Assert.Equal(expected, newdirection);
        }
Exemplo n.º 15
0
        public void GivenDirectionSouth_WhenTurnLeft_ShouldDirectionEast()
        {
            var direction    = new South();
            var newdirection = direction.Left().ToString();
            var expected     = new East().ToString();

            Assert.Equal(expected, newdirection);
        }
Exemplo n.º 16
0
        public void When_Rover_At_1_2_South_And_Move_Should_Be_1_1()
        {
            var direction      = new South();
            var newCoordinates = direction.MoveForward(new Coordinates(1, 2));

            Assert.That(newCoordinates.XCoordinate, Is.EqualTo(1));
            Assert.That(newCoordinates.YCoordinate, Is.EqualTo(1));
        }
Exemplo n.º 17
0
        public void Test_South_TurnLeft()
        {
            var direction = new South();

            var left = direction.TurnLeft();

            Assert.AreEqual("1 0 E", left.GetDirectionAsString());
        }
Exemplo n.º 18
0
        public void SouthShouldBeWestWhenTurnedClockWise()
        {
            IOrientation south = new South();

            var turnAntiClockWise = south.TurnClockWise();

            turnAntiClockWise.Should().BeOfType <West>();
        }
Exemplo n.º 19
0
        public void When_At_Start_And_Facing_South_And_Move_Do_Not_Pass_Boundary()
        {
            var direction = new South(_landscape);

            direction.Move();

            Assert.That(_landscape.CoordinateX, Is.EqualTo(0));
            Assert.That(_landscape.CoordinateY, Is.EqualTo(0));
        }
Exemplo n.º 20
0
        public void GivenDirectionSouth_WhenMove_ShouldYAxisDecremented()
        {
            var direction   = new South();
            var oldPosition = new Core.ValueObject.RoverPosition(3, 3, direction.Direction);
            var position    = direction.Move(oldPosition);

            Assert.Equal(position.X, oldPosition.X);
            Assert.Equal(position.Y, oldPosition.Y - 1);
        }
Exemplo n.º 21
0
        public void ReturnSameInstanceWhenGetInstanceIsCalledMoreThanOnce()
        {
            South southFirst  = South.GetInstance();
            South southSecond = South.GetInstance();

            Assert.NotNull(southFirst);
            Assert.NotNull(southSecond);
            Assert.Same(southFirst, southSecond);
        }
Exemplo n.º 22
0
 /// <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));
 }
Exemplo n.º 23
0
        public void ReturnWestWhenGetRightDirectionIsCalled()
        {
            South south = South.GetInstance();

            var result = south.GetRightDirection();

            Assert.NotNull(result);
            Assert.IsType <West>(result);
        }
Exemplo n.º 24
0
 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());
 }
Exemplo n.º 25
0
 public void Write(BinaryWriter writer)
 {
     writer.Write(Enabled);
     Position.Write(writer);
     North.Write(writer);
     East.Write(writer);
     South.Write(writer);
     West.Write(writer);
 }
Exemplo n.º 26
0
        public void MarsRover_CurrentDirectionIsSouth_RotateRight_TurnsToWest()
        {
            IDirection   direction = new South();
            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 <West>());
        }
Exemplo n.º 27
0
 public void resetMarshmallow()
 {
     checkForAchievements(n, s);
     n = 0f;
     s = 0f;
     gameObject.GetComponent <MeshRenderer>().material.SetColor("Color_1", new Color(1f, 1f, 1f, 1f));
     gameObject.GetComponent <MeshRenderer>().material.SetColor("Color_2", new Color(1f, 1f, 1f, 1f));
     South.GetComponent <UnityEngine.UI.Text>().text = (s).ToString();
     North.GetComponent <UnityEngine.UI.Text>().text = (n).ToString();
 }
Exemplo n.º 28
0
        public void South_MoveFromCurrentPosition_ReturnsNewCoordinate_WithYMovedDownward(
            int currentX, int currentY, int newY)
        {
            Coordinates currentPosition  = new Coordinates(currentX, currentY);
            IDirection  currentDirection = new South();
            Coordinates newCoordinates   = currentDirection.MoveFrom(currentPosition);

            Assert.AreEqual(newCoordinates.XCoordinate, currentX);
            Assert.AreEqual(newCoordinates.YCoordinate, newY);
        }
Exemplo n.º 29
0
        public void moves_south()
        {
            var command = new South(11);

            var result = command.Move(StartingPosition);

            result.North.Should().Be(-10);
            result.East.Should().Be(1);
            result.Direction.Should().Be(Direction.E);
        }
Exemplo n.º 30
0
 // 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);
 }
Exemplo n.º 31
0
        /// <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;
        }