public bool play(AnimationState m, float targ = 1.0f) { if (!now.isSame(m)) { pre.kill(); now.kill(); now = new MotionUnit2D(m, 0.0f, targ, false); } return(now.motionX.time >= now.motionX.length); }
public bool crossFade(AnimationState m, float time = 0.3f, float targ = 1.0f) { if (!now.isSame(m)) { pre.kill(); pre = now; pre.startFadeOut(time); now = new MotionUnit2D(m, time, targ, false); } return(now.motionX.time >= now.motionX.length); }
public bool crossFade2D(AnimationState mX, AnimationState mY, Vector2 dir, float speed, float time = 0.3f, float targ = 1.0f) { if (!now.isSame(mX, mY)) { pre.kill(); pre = now; pre.startFadeOut(time); now = new MotionUnit2D(mX, mY, time, targ, true); } now.move(dir, speed); return(now.motionX.time >= now.motionX.length && now.motionY.time >= now.motionY.length); }
public bool blend2D(AnimationState mX, AnimationState mY, Vector2 dir, float dirsMax, float speed, float time = 0.3f, float targ = 1.0f) // dir は正規化 { if (!now.isSame(mX, mY)) { pre.kill(); pre = now; pre.stay(); now = new MotionUnit2D(mX, mY, time, targ, true); } now.move(dir, speed); pre.antiMove(ref now, dirsMax); return(now.motionX.time >= now.motionX.length && now.motionY.time >= now.motionY.length); }
public void antiMove(ref MotionUnit2D other, float dirsMax) { this.nowWeight = (dirsMax - (other.dirWeight.x + other.dirWeight.y)) * other.targetWeight; }