示例#1
0
    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);
    }
示例#2
0
    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);
        }
    }
示例#3
0
	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;
	}
示例#4
0
	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;
		}
	}