Example #1
0
		private void bNew_Click(object sender, EventArgs e) {
			Animation animation = new Animation(0.2f);
			animation.Name = "Unnamed";

			for (int i = 0; i < 4; i++) {
				animation.Indices.Add(0);
			}

			this.Animations.Add(animation);

			cbAnimations.Items.Add(animation.Name);
			cbAnimations.SelectedIndex = cbAnimations.Items.Count - 1;
			tbCurrentFrame.Maximum = 4 - 1;

			this.SetState(true);
		}
Example #2
0
		public void Play(Animation animation, bool forcePlayOnce, Action callback) {
			if (!forcePlay) {
				this.Reset();
				this.forcePlay = forcePlayOnce;
				this.callback = callback;
				if (animation != null && (this.controller == null || this.controller.Animation != animation)) {
					if (controller != null) controller.FocusLost();
					this.controller = new AnimationController(animation);

					if (!this.cachedAnimations.ContainsKey(animation) || animation.Resettable) {
					} else {
						this.controller = this.cachedAnimations[animation];
					}

					if (!this.cachedAnimations.ContainsKey(animation)) {
						this.cachedAnimations.Add(animation, this.controller);
					}
					this.controller.LoopPassed += new EventHandler(onLoopPassed);
				}
			}
		}
Example #3
0
		public AnimationController(Animation animation) {
			this.Animation = animation;
		}