public IEnumerator Walk() // TODO: play appropriate animations { if (Path.Count < 2) { Debug.Log("WARN!!!! UnitView:StartMmoving Path null"); yield return(new WaitForSeconds(0.0f)); } int i = Path.Count - 1; IsMoving = true; Vector3 tilePos; while (i > 0) { TileView curTV = Path[i]; TileView nextTV = Path[i - 1]; int numSteps = 10; Vector3 delta = nextTV.GetPosition() - curTV.GetPosition(); int count = 0; float xDiff = 0; float yDiff = 0; if (Mathf.Abs(delta.x) > 0) { xDiff = delta.x / numSteps; } else if (Mathf.Abs(delta.y) > 0) { yDiff = delta.y / numSteps; } else { Debug.Log("WARN!!! UnitView:StartMoving impossible state"); } while (count++ < numSteps) { SetPosition(new Vector3(gameObject.transform.position.x + xDiff, gameObject.transform.position.y + yDiff, 0)); yield return(new WaitForSeconds(0.001f)); } count = 0; i--; } IsMoving = false; }