Example #1
0
        IEnumerator Play(Vector2 localPosStart, Vector2 localPosDestination)
        {
            var strayPoint = localPosStart + Random.insideUnitCircle.normalized * Random.Range(10f, 30f);

            for (float t = 0; t < 1; t += 1.6f * Time.deltaTime)//1/1.6f的持续时间
            {
                var f0 = Curve0.Evaluate(t);
                var f1 = Curve1.Evaluate(t);
                transform.localPosition = localPosStart + (strayPoint - localPosStart) * f0 +
                                          (localPosDestination - localPosStart) * f1;

                yield return(new WaitForEndOfFrame());
            }
            GameData.MyEnergy += _energy;
            Destroy(gameObject);
        }
 /// <summary>
 /// Create a first-order Delegate Curve
 /// </summary>
 /// <param name="curve">Instance of `EasingCurve`</param>
 /// <param name="curveFunc1">First-order combination function </param>
 public DelegateCurve(EasingCurve curve, Curve1 curveFunc1)
 {
     this.curveA     = curve;
     this.curveFunc1 = curveFunc1;
     this.order      = Order.One;
 }