public State CreatNewStateFromMoving(IMover <State> mover) { State new_state = mover.Move(this); new_state.StateEvaluation(); new_state.ReachGoal(); return(new_state); }
public void From_Given_Direction_Moves_Specified_Places_To_Expected_Direction(int beginX, int beginY, char beginDirection, int movePlaces, Direction expectedEndDirection, int expectedEndX, int expectedEndY) { SetupRover("R1", beginX, beginY, beginDirection); _sut.Move(_rover, movePlaces); _rover.Direction.Should().Be(expectedEndDirection); _rover.Position.Should().Be(new Point(expectedEndX, expectedEndY)); }
public void Think() { if (_updateTimer > _data.PositionUpdateInterval) { _updateTimer = 0; _mover.Move(_data, ServiceLocator <ICharacterHandler> .Instance.GetPlayer().GetTransformPosition()); } _updateTimer += Time.deltaTime; }
private void Run() { if (movePosition == Vector3.zero) { movePosition = reachPoints.Items[reachpoint].position; } if (Vector3.Distance(transform.position, movePosition) <= changeDestinationDistance) { reachpoint = reachpoint >= reachPoints.Items.Count - 1 ? 0 : reachpoint + 1; movePosition = reachPoints.Items[reachpoint].position; } move.Move(movePosition, moveSpeed); }
public bool Move(IMover moverArg, Vector3Int moveParamsArg) { Vector3Int oldPosition = Position; Vector3Int newPosition; newPosition = moverArg.Move(this, moveParamsArg); if (oldPosition.x != newPosition.x || oldPosition.y != newPosition.y || oldPosition.z != newPosition.z) { _model.transform.position = newPosition; return(true); } return(false); }
public bool TileInteraction(NewPackets.TileInteraction parameters) { // Verify index range if (parameters.entityIndex >= Entities.Length || parameters.entityIndex < 0) { return(false); } // This entity is the actor // TODO: reduce casting Entity subject = Entities[parameters.entityIndex] as Entity; if (subject == null) { Debug.Log("ERROR: Entity does not exist!"); return(false); } ByteVector2 tile = new ByteVector2(parameters.tileX, parameters.tileY); // If the entity is `close` to the tile and the tile is solid if (MapManager.Map[parameters.tileX, parameters.tileY] != Tile.Empty && ByteVector2.ManhattanDistance(subject.GetPosition(), tile) <= 1) { // Try to dig with that entity IDigger digger = subject as IDigger; if (digger != null) { digger.Dig(tile); } } // If the entity isn't on that tile else if (ByteVector2.ManhattanDistance(subject.GetPosition(), tile) > 0) { IMover mover = subject as IMover; if (mover != null) { mover.Move(tile); } } return(true); }
// Update is called once per frame void FixedUpdate () { // TODO: Delete dirty hack before gravity is implemented if (Input.GetKeyDown (KeyCode.P)) { MoveToGround (); } Vector3 direction = director != null ? director.GetDirection () : Vector3.zero; if(Vector3.Distance (direction, Vector3.zero) > 0.01f) { float speed = Mathf.Lerp (walkVelocity.magnitude, walkSpeed, Time.deltaTime * damping); walkVelocity = direction.normalized * speed; } else { // TODO: Deccelerative lerp walkVelocity = Vector3.zero; } // TODO: Gravity // TODO: Don't hardcode rayDistance, layerMask and invertLayerMask float rayDistance = 1.1f; int layerMask = 1 << 8; layerMask = ~layerMask; Debug.DrawLine (root.position, root.position - (root.up * rayDistance)); RaycastHit hit; if(Physics.Raycast (root.position, -root.up, out hit, rayDistance, layerMask)) { gravVelocity = Vector3.zero; } else { gravVelocity += (-root.up * gravity); } velocity = walkVelocity + gravVelocity; if (mover != null) { Quaternion rot = transform.rotation; mover.Move (velocity); transform.rotation = rot; } if (rotator != null) { rotator.TryRotate (velocity.normalized); } }
public bool Move(IMover moverArg, Vector3Int moveParamArg) { List <IMovable> borderPlane; Vector3Int moveParamInt = moveParamArg; borderPlane = GetBorderArea(moveParamInt); foreach (var item in borderPlane) { if (!moverArg.IsCanMove(item.Position, moveParamInt)) { return(false); } } foreach (var item in _figures) { item.Move(moverArg, moveParamArg); } _positionFact = moverArg.Move(this, moveParamArg); return(true); }
private void MoveFileIfValidMedia(string path) { try { var to = GetNewFullPath(path); if (to != path) { _mover.Move(path, to); } } catch (IOException ex) { // This we want to log. Moving the file should cause no problem. Console.WriteLine(ex); } catch (Exception) { // Missing EXIF data, bad filename, so most likely not a media file that we want to rename. } }
public void Navigate(char instruction) { if (instruction == 'L') { _robot.Heading--; } else if (instruction == 'R') { _robot.Heading++; } else if (instruction == 'M') { IMover mover = MoverFactory.Create(_battleArena.Boundary.Locations, _robot.Heading.Value, _robot.Location); Location currentLocation = new Location(_robot.Location.X, _robot.Location.Y); _robot.Location = mover.Move(); if (currentLocation == _robot.Location) { _robot.Penalties++; } } }
// Many pieces, which focus around the soldier. // Using them is a problem because each time, // they need to be rewired, restructured and it's not known public void PlayWar() { var shooter = new Soldier(); var target = new Soldier(); // Shot should determine if damage is taken or not shooter.Shoot(target); _damager.Damage(target); // Soldier can move by itself _mover.Move(shooter, new Vector3D()); if (target.Hp <= 0) { // Soldier should know how it dies _killer.Kill(target); } else { // Soldiers know how to give first aid _healer.Heal(target); } }
public void Execute() { entity.Move(new Piece(world, entity.Position.AsPointL(), 5, new List <Mob>()), directions, time); }
public void UpdateState() { _collisionMover.Move(); }
public void UpdateState() { _pathMover.Move(); }
public void UpdateState() { _physicalMover.Move(); }
public void Navigate() { IMover mover = MoverFactory.Create(_mower); mover.Move(); }
public void Move(Vector3D location) => _mover.Move(location);
public bool Move(IBsActor actor, int slotId) { return(_mover.Move(actor, slotId)); }
public void MoveAction(Vector3 position) { _mover.Move(position); }
public void Move(Point delta, List <Point> listPoints) { mover.Move(delta, listPoints); }
public void Move <T>(BaseTile <T> source, BaseTile <T> destination) where T : BaseTile <T>, IHaveMovementCost { var maybePath = pathFinder.CalculatePath(source, destination, transform.position.z); maybePath.MatchSome(path => mover.Move(path)); }