public SetAnimator AddAnimationSet(AnimationSet set) { animationSets.Add(set.name, set); animator.AddAnimationSet(set); if (CurrentAnimationSet == null) { CurrentAnimationSet = set; } return(this); }
private void SetupAnimationSets() { float idleFPS = 4f; float dashFPS = 18; int directionalSelector() => (int)direction.Direction; var idleAnimationSet = new AnimationSet("idle", directionalSelector, Enumerable.Range(0, 8).Select(i => Utility.SpriteAnimationFromParams(idleFPS, sprites[i * 2], sprites[i * 2 + 1])).ToList()); var moveAnimationSet = new AnimationSet("move", directionalSelector, Enumerable.Range(0, 8).Select(i => Utility.SpriteAnimationFromParams(idleFPS, sprites[i * 2], sprites[i * 2 + 1])).ToList()); var fullDashAnimationSet = new AnimationSet("fullDash", directionalSelector, Enumerable.Range(0, 8).Select(i => Utility.SpriteAnimationFromParams(dashFPS, sprites[16 + i], sprites[24 + i], sprites[32 + i])).ToList()); setAnimator.AddAnimationSet(idleAnimationSet).AddAnimationSet(moveAnimationSet).AddAnimationSet(fullDashAnimationSet); }
public void PlaySet(string name) { CurrentAnimationSet = animationSets[name]; switchedAnimationSet = true; }