public void RemovePoint() { addPoints = GameObject.Find("MoveBot").GetComponent <MoveInstructions>(); addPoints.positions.RemoveAt(addPoints.positions.Count - 1); addPoints.ranges.RemoveAt(addPoints.ranges.Count - 1); addPoints.directions.RemoveAt(addPoints.directions.Count - 1); }
// Update is called once per frame public void NextMove() { addPoints = GameObject.Find("MoveBot").GetComponent <MoveInstructions>(); addPoints.positions.Add(startPoint.position); addPoints.ranges.Add(withinRange); addPoints.directions.Add(endPoint.position - startPoint.position); }
public void Move(MoveInstructions input, int position) { var instruction = new Instruction(_pluto, _rover, input.ToString()); _movementOperation.Execute(instruction); _rover.PosX.Should().Be(0); _rover.PosY.Should().Be(position); }
public void TurnAndMove(TurnInstructions turnInstruction, MoveInstructions moveInstruction, int yPosition, int xPosition) { var firstInstruction = new Instruction(_pluto, _rover, turnInstruction.ToString()); var secondInstruction = new Instruction(_pluto, _rover, moveInstruction.ToString()); _turnOperation.Execute(firstInstruction); _movementOperation.Execute(secondInstruction); _rover.PosY.Should().Be(yPosition); _rover.PosX.Should().Be(xPosition); }
private void DetectAction() { robit = GameObject.Find("MoveBot"); instruct = robit.GetComponent <MoveInstructions>(); Event currentEvent = Event.current; switch (currentEvent.type) { case EventType.MouseDown: Ray ray = Camera.current.ScreenPointToRay(Event.current.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit)) { i++; Vector3 temp = hit.point; //temp.y = robit.transform.position.y; Debug.Log(hit.point); instruct.positions.Add(temp); instruct.directions.Add(temp); instruct.ranges.Add(0.5f); } break; case EventType.KeyDown: if (currentEvent.keyCode == KeyCode.Backspace || currentEvent.keyCode == KeyCode.Delete) { if (i > 0) { i--; } } break; } }
private static string LongitudinalMovement(Rover rover, MoveInstructions instruction, Pluto pluto) { var displacement = 1; if (rover.CurrentDirection == "W") { displacement = -1; } if (AreMovingBackwards(instruction)) { displacement *= -1; } if (pluto.Grid[GetNextXCoOrd(rover, displacement, pluto)][rover.PosY].IsObstacle) { return("IsObstacle"); } rover.PosX = GetNextXCoOrd(rover, displacement, pluto); return(Success); }
// Use this for initialization void Start() { Debug.Log("Showpoints starting up!"); robit = GameObject.Find("MoveBot"); instruct = robit.GetComponent <MoveInstructions>(); }
public void Clear() { moveInstructions = MoveInstructions.neutral; actionInstructions = ActionInstructions.none; direction = Direction.Neutral; actedOn = false; }
private static bool AreMovingBackwards(MoveInstructions instruction) => instruction.Equals(MoveInstructions.B);