Ejemplo n.º 1
0
	//Movement stuff

	public void moveHeroToPosition(Hero h, Position p)
	{
		if (!isInsideBounds (p))
			return;

		movementGraph.setGoal (p);
		pathfinder.Run (movementGraph);

		int cost = pathfinder.getGoalCost ();

		if (cost == -1) 														//goal cost -1 means pathfinder couldnt reach goal from the origin
		{
			Debug.Log ("Cant reach that position");
			return;
		}

		h.moveTo (p, cost);
	}