Example #1
0
    void Start()
    {
        FizzikAnimation anim = new FizzikAnimation();

        anim.Name = "idle";
        anim.Idle = true;

        FizzikFrame frame;

        //Frame 1
        frame = new FizzikFrame(spriteIdle, 1f);
        anim.AddFrame(frame);
        //

        FizzikAnimationController controller = this.GetComponentInParent <FizzikAnimationController>();

        controller.AddAnimation(anim);
    }
Example #2
0
    void Start()
    {
        FizzikAnimation anim = new FizzikAnimation();

        anim.Name = "fire";

        FizzikFrame frame;

        //Frame 1
        frame = new FizzikFrame(spriteIdle, .025f);
        anim.AddFrame(frame);
        frame = new FizzikFrame(spriteFire, .075f);
        anim.AddFrame(frame);
        frame = new FizzikFrame(spriteIdle, .025f);
        anim.AddFrame(frame);
        //

        FizzikAnimationController controller = this.GetComponentInParent <FizzikAnimationController>();

        controller.AddAnimation(anim);
    }
Example #3
0
    /*
     * Plays the animation with the given identifier name, can be used to replay an animation
     * easily, without havine the overhead of searching for the animation given an identifier.
     */
    public void PlayAnimation(string animation)
    {
        FizzikAnimation anim;

        if (currentAnim != null && animation.Equals(currentAnim.Name))
        {
            anim = currentAnim;
        }
        else
        {
            anim = FindAnimation(animation);
        }

        if (anim != null)
        {
            currentAnim     = anim;
            currentFrame    = 0;
            currentPlaytime = 0f;
            pingpong        = false;

            renderer.sprite = currentAnim.GetFrame(currentFrame).SpriteImage;
        }
    }
Example #4
0
 public void AddAnimation(FizzikAnimation anim)
 {
     animations.Add(anim);
 }