Exemplo n.º 1
0
    public bool loadAnimation(string animStr, Unit.Orientation or, Sprite[] sprites)
    {
        SpriteAnimation spAnimation = new SpriteAnimation(sprites, 0.2f);

        //Debug.Log ("sprites " + sprites.Length + " animStr " + animStr);
        if (animations.ContainsKey(animStr))
        {
            animations[animStr].Add(or, spAnimation);
        }
        else
        {
            Dictionary <Unit.Orientation, SpriteAnimation> dic = new Dictionary <Unit.Orientation, SpriteAnimation> ();
            dic.Add(or, spAnimation);
            animations.Add(animStr, dic);
        }

        return(true);
    }
Exemplo n.º 2
0
    public void setAnim(string animName, Unit.Orientation or, int animationMode = SpriteAnimation.ANIMATION_LOOPING)
    {
        if (or == Unit.Orientation.Or_W)
        {
            spriteTransform.rotation = flipRight;
            or = Unit.Orientation.Or_E;
        }
        else if (or == Unit.Orientation.Or_E)
        {
            spriteTransform.rotation = flipLeft;
        }


        curAnim = animations[animName][or];

        if (this.animationMode != animationMode)
        {
            this.animationMode = animationMode;
        }
    }
Exemplo n.º 3
0
 public void setActionFrames(string animStr, Unit.Orientation or, int frame, IList <System.Action> actions)
 {
     animations[animStr][or].keyFrames[frame].events = actions;
 }
Exemplo n.º 4
0
 public void setAnimSpeed(float speed, string animName, Unit.Orientation or)
 {
     animations[animName][or].setSpeed(speed);
 }
Exemplo n.º 5
0
 public float getAnimSpeed(string animName, Unit.Orientation or)
 {
     return(animations[animName][or].getSpeed());
 }
Exemplo n.º 6
0
 public float getAnimDurationUntilFrame(short frame, string animName, Unit.Orientation or)
 {
     return(animations[animName][or].getDurationUntil(frame) * 1 / speed);
 }
Exemplo n.º 7
0
 public float getAnimDurationSec(string animName, Unit.Orientation or)
 {
     return(animations[animName][or].getDuration() * 1 / speed);
 }