private MoveCellHelper CreateMoveCellHelper(float startTime, ViewCell go, List <Pos2D> list) { var ret = new MoveCellHelper(); ret.startTime = startTime; ret.endTime = (list.Count - 1) * moveUnitLengthTime + startTime; ret.cellGo = go; foreach (var p in list) { ret.trajectory.Add(layout.Logic2View(p)); } return(ret); }
private Vector3 CalculateCurrentPos(MoveCellHelper h, float time) { if (time <= h.startTime) { return(h.trajectory[0]); } if (time >= h.endTime) { return(h.trajectory[h.trajectory.Count - 1]); } var diff = (time - h.startTime) * (h.trajectory.Count - 1) / moveUnitLengthTime; var a = Mathf.FloorToInt(diff); var b = diff - a; if (a + 1 >= h.trajectory.Count) { return(h.trajectory[h.trajectory.Count - 1]); } else { return(h.trajectory[a] * (1 - b) + h.trajectory[a + 1] * b); } }
private MoveCellHelper CreateMoveCellHelper(float startTime, ViewCell go, List<Pos2D> list) { var ret = new MoveCellHelper(); ret.startTime = startTime; ret.endTime = (list.Count - 1) * moveUnitLengthTime + startTime; ret.cellGo = go; foreach (var p in list) { ret.trajectory.Add(layout.Logic2View(p)); } return ret; }
private Vector3 CalculateCurrentPos(MoveCellHelper h, float time) { if (time <= h.startTime) return h.trajectory[0]; if (time >= h.endTime) return h.trajectory[h.trajectory.Count - 1]; var diff = (time - h.startTime) * (h.trajectory.Count - 1) / moveUnitLengthTime; var a = Mathf.FloorToInt(diff); var b = diff - a; if (a + 1 >= h.trajectory.Count) { return h.trajectory[h.trajectory.Count - 1]; } else { return h.trajectory[a] * (1 - b) + h.trajectory[a + 1] * b; } }