Example #1
0
    void OnFlipCallback(PlatformerSpriteController ctrl)
    {
        attachSpriteAnim.Sprite.FlipX = ctrl.isLeft;

        if (attachAnimator.isPlaying)
        {
            float t = attachAnimator.currentPlayingTake.sequence.elapsed;
            attachAnimator.PlayAtTime(mBodySpriteCtrl.isLeft ? "throwLeft" : "throw", t);
        }


        Transform attach = attachAnimator.transform;

        Vector3 s = attach.localScale;

        s.x = ctrl.isLeft ? -Mathf.Abs(s.x) : Mathf.Abs(s.x);

        attach.localScale = s;
    }