public void SetAnimationFrameByFloat(WolfAnimation ani, float progress, float step) { float percent = RXMath.Mod(progress, step) / step; int frame = Mathf.RoundToInt(percent * (float)(ani.numFrames - 1)); SetAnimationFrame(ani, frame); }
public void SetAnimationFrame(WolfAnimation ani, int frame) { this.ani = ani; this.currentFrame = frame % ani.numFrames; //wrap it FAtlasElement newElement = ani.frames[currentFrame]; if (bodySprite.element != newElement) { bodySprite.element = newElement; didAnimationChange = true; } }
public void SetAnimationFrameByFloat(WolfAnimation ani, float progress, float step) { float percent = RXMath.Mod(progress,step)/step; int frame = Mathf.RoundToInt(percent * (float)(ani.numFrames-1)); SetAnimationFrame(ani,frame); }
public void SetAnimationFrame(WolfAnimation ani, int frame) { this.ani = ani; this.currentFrame = frame % ani.numFrames; //wrap it FAtlasElement newElement = ani.frames[currentFrame]; if(bodySprite.element != newElement) { bodySprite.element = newElement; didAnimationChange = true; } }
void Start() { logic = GetComponent <WolfMoveLogic>(); animation = GetComponent <WolfAnimation>(); }