public bool MoveTorwards(CellPosition target, EntityMap map, GroundMap groundMap) { var dx = target.x - actor.entity.position.x; var dy = target.y - actor.entity.position.y; var distance = (int)Mathf.Sqrt(dx * dx + dy * dy); dx = dx / distance; dy = dy / distance; var newX = actor.entity.position.x + dx; var newY = actor.entity.position.y + dy; if (!groundMap.IsBlocked(newX, newY) && map.GetBlockingEntityAtPosition(newX, newY) == null) { Move(dx, dy); return(true); } return(false); }