Exemplo n.º 1
0
 public GameObject(World world, Vector2 position, Vector2 initialVelocity, Vector2 size, List<AnimationSet> animations,
     String initialAnimation, bool shouldCollide, bool gravitable, int health)
 {
     this.World = world;
     this.Position = position;
     this.Velocity = initialVelocity;
     this.Size = size;
     this.Animations = animations;
     this.CurAnimation = FindAnimationByName(initialAnimation);
     this.ShouldCollide = shouldCollide;
     this.Health = health;
     this.Color = Color.White;
     this.gravitable = gravitable;
 }
Exemplo n.º 2
0
 /// <summary>
 ///     Changes the animation being played. Doesn't do anything if called with the name of the currently
 ///     playing animation.
 /// </summary>
 /// <param name="name">The name of the new animation.</param>
 /// <exception cref="System.InvalidOperationException">Specified animation doesn't exist.</exception>
 protected virtual void ChangeAnimation(string name)
 {
     if (!CurAnimation.IsCalled(name))
     {
         AnimationSet newAnimation = FindAnimationByName(name);
         if (newAnimation == null)
             throw new InvalidOperationException("Specified animation doesn't exist.");
         newAnimation.Reset();
         newAnimation.Update();
         CurAnimation = newAnimation;
     }
 }