void Update() { PathfinderPath shortest = finder.CheckShortestPath(); if (shortest != null) { Debug.Log(shortest.ToString()); clickedUnit.MovePath = shortest; finder.ClearShortestPath(); } }
public void Update() { if (movePath != null && movePath.Count > 1) { float time = Time.time; if (time - startTime >= duration) { Debug.Log("OnTile: " + onTile.ToString()); startTime = time; duration = 1f; movePath.RemoveFirst(); onTile = controller.getTileAtIndex(movePath.First.IndexPos); if (movePath.Second == null) { return; } } gameObject.transform.position = Vector3.Lerp( Tile.GetOnTileUnityPos(movePath.First), Tile.GetOnTileUnityPos(movePath.Second), (time - startTime) / duration); Debug.Log("Path is: " + movePath.ToString()); } }