Ejemplo n.º 1
0
    private IEnumerator FollowEnum()
    {
        var trans           = transform;
        var origine         = trans.position;
        var length          = Points.Length;
        var onePathDuration = Duration / length;
        var lerpCurve       = AnimationCurve.Linear(0f, 0f, 1f, 1f);
        int index           = StartIndex % length;

        while (true)
        {
            var beg = Points[index] + origine;
            index = ++index % length;
            var end = Points[index] + origine;
            yield return(HelperTween.MoveTransformEnum(trans, beg, end, onePathDuration, lerpCurve, false));
        }
    }
Ejemplo n.º 2
0
    private IEnumerator FireSlowMo()
    {
        Time.timeScale = 0f;
        //Move & scale
        StartCoroutine(HelperTween.MoveTransformEnum(TargetShoot.transform, TargetShoot.transform.position, _trans.position,
                                                     0.3f, AnimationCurve.EaseInOut(0f, 0f, 1f, 1f)));
        yield return(HelperTween.ScaleEnum(TargetShoot.transform, TargetShoot.transform.localScale, Vector3.zero, 0.3f, AnimationCurve.EaseInOut(0f, 0f, 1f, 1f)));

        TargetShoot.transform.position   = _trans.position;
        TargetShoot.PawnRigid2D.velocity = Vector2.zero;

        if (OnShootPawn != null)
        {
            OnShootPawn();
        }
        TargetShoot.PawnRigid2D.AddForce(_aimDir * ShootForce, ForceMode2D.Impulse);
        StartCoroutine(HelperTween.ScaleEnum(TargetShoot.transform, TargetShoot.transform.localScale, Vector3.one, 0.2f,
                                             AnimationCurve.EaseInOut(0f, 0f, 1f, 1f)));
        yield return(HelperTween.TimeScaleEnum(0f, 1f, 0.3f, AnimationCurve.EaseInOut(0f, 0f, 1f, 1f)));
        //Move & scale and timescale
    }