/* * Raycast to the square in front of the character * If we don't his anything, great! Move to the square * If we do hit something, try interacting with it */ public void attempt_move(int x_dir, int y_dir) { RaycastHit2D hit; Vector2 start = new Vector2(transform.position.x + .5f, transform.position.y + .5f); Vector2 end = new Vector2(start.x + x_dir, start.y + y_dir); Raycast(start, end, out hit); if (hit.collider == null) { attached_character.move_abs((int)transform.position.x + x_dir, (int)transform.position.y + y_dir); attached_character.decrease_move(); util_ref.v_manager.refresh_fog(); } else { Collision(hit, x_dir, y_dir); } }