コード例 #1
0
ファイル: WaypointsMover.cs プロジェクト: ming2d941/match3
 private void UpdateCurved()
 {
     _splineT += Time.deltaTime / _partTime;
     if (_splineT > 1.0f)
     {
         _splineT = 0.0f;
         TakeNextWaypoint();
         UpdateCurvePoints();
     }
     else
     {
         Vector2 point = _splineCurve.GetPoint(_splineT);
         transform.position = point;
     }
 }
コード例 #2
0
ファイル: MapPath.cs プロジェクト: BookSayOne/Test
    private Vector2[] GetDivededPoints(int ind)
    {
        var     points   = new Vector2[11];
        var     pointInd = 0;
        var     indexes  = GetSplinePointIndexes(ind, true);
        Vector2 a        = paths[indexes[0]].transform.position;
        Vector2 b        = paths[indexes[1]].transform.position;
        Vector2 c        = paths[indexes[2]].transform.position;
        Vector2 d        = paths[indexes[3]].transform.position;

        for (float t = 0; t <= 1.001f; t += 0.1f)
        {
            points[pointInd++] = SplineCurve.GetPoint(a, b, c, d, t);
        }
        return(points);
    }