Exemplo n.º 1
0
        public void AddAnimation(IAnimationRigidBody animation, string name = null)
        {
            if (name != null)
            {
                animation.Name = name;
            }
            if ((animation.Name ?? "").Equals(""))
            {
                animation.Name = "Ani" + "::" + animation.GetHashCode().ToString();
            }
            int i = Animations.IndexOf(animation);

            if (i < 0)
            {
                Animations.Add(animation);
            }
            else
            {
                Animations[i] = animation;
            }

            animation.Sprite = this;
            animation.SetTimingSource(TimingSource.Sources.Manual);
            animation.IsActive = Animated;
            if ((animation is IAnimKeyInput) && (_parentContainer != null))
            {
                var kani = animation as IAnimKeyInput;
                _parentContainer.WindowKeyDown += kani.OnKeyDown;
                _parentContainer.WindowKeyUp   += kani.OnKeyUp;
            }
        }
Exemplo n.º 2
0
 public void RemoveAnimation(IAnimationRigidBody animation)
 {
     try
     {
         if ((animation is IAnimKeyInput) && (_parentContainer != null))
         {
             var kani = animation as IAnimKeyInput;
             _parentContainer.WindowKeyDown -= kani.OnKeyDown;
             _parentContainer.WindowKeyUp   -= kani.OnKeyUp;
         }
         Animations.Remove(animation);
     }
     catch (Exception e)
     {
         Debug.WriteLine("Animation {0} not present in {1}.", animation.Name, Name);
     }
 }
Exemplo n.º 3
0
 public void RemoveAnimation(IAnimationRigidBody animation)
 {
     try
     {
         if ((animation is IAnimKeyInput) && (_parentContainer != null))
         {
             var kani = animation as IAnimKeyInput;
             _parentContainer.WindowKeyDown -= kani.OnKeyDown;
             _parentContainer.WindowKeyUp -= kani.OnKeyUp;
         }
         Animations.Remove(animation);
     }
     catch (Exception e)
     {
         Debug.WriteLine("Animation {0} not present in {1}.", animation.Name, Name);
     }
 }
Exemplo n.º 4
0
 public void Animation_OnDispose(IAnimationRigidBody animation)
 {
     RemoveAnimation(animation);
 }
Exemplo n.º 5
0
        public void AddAnimation(IAnimationRigidBody animation, string name = null)
        {
            if (name != null) animation.Name = name;
            if ((animation.Name ?? "").Equals("")) animation.Name = "Ani" + "::" + animation.GetHashCode().ToString();
            int i = Animations.IndexOf(animation);
            if (i < 0)
                Animations.Add(animation);
            else
                Animations[i] = animation;

            animation.Sprite = this;
            animation.SetTimingSource(TimingSource.Sources.Manual);
            animation.IsActive = Animated;
            if ((animation is IAnimKeyInput) && (_parentContainer != null))
            {
                var kani = animation as IAnimKeyInput;
                _parentContainer.WindowKeyDown += kani.OnKeyDown;
                _parentContainer.WindowKeyUp += kani.OnKeyUp;
            }
        }
Exemplo n.º 6
0
 public void Animation_OnDispose(IAnimationRigidBody animation)
 {
     RemoveAnimation(animation);
 }