public virtual void activateEffectors(SpriterAbstractPlayer player)
 {
     foreach (SpriterIKObject key in this.ikMap.Keys)
     {
         SpriterAbstractObject obj = this.ikMap[key];
         if (obj is SpriterBone) obj = player.getRuntimeBones()[obj.getId()];
         else obj = player.getRuntimeObjects()[obj.getId()];
         obj.active = true;
         SpriterBone par = (SpriterBone)obj.getParent();
         for (int j = 0; j < key.chainLength && par != null; j++)
         {
             player.getRuntimeBones()[par.getId()].active = true;
             par = (SpriterBone)par.getParent();
         }
     }
 }
        public virtual void activateAll(SpriterAbstractPlayer
			 player)
        {
            foreach (SpriterBone bone in player.getRuntimeBones())
            {
                bone.active = true;
            }
            foreach (SpriterObject obj in player.getRuntimeObjects())
            {
                obj.active = true;
            }
        }
 protected override void resolve(float x, float y, int chainLength, SpriterAbstractObject effector, SpriterAbstractPlayer player)
 {
     base.updateRecursively(player, effector);
     float xx = effector.getX() + (float)System.Math.Cos(SpriterCalculator.DegreeToRadian(effector
         .getAngle())) * Com.Brashmonkey.Spriter.draw.AbstractDrawer.BONE_LENGTH * effector
         .getScaleX();
     float yy = effector.getY() + (float)System.Math.Sin(SpriterCalculator.DegreeToRadian(effector
         .getAngle())) * Com.Brashmonkey.Spriter.draw.AbstractDrawer.BONE_LENGTH * effector
         .getScaleX();
     effector.setAngle(Com.Brashmonkey.Spriter.SpriterCalculator.angleBetween(effector
         .getX(), effector.getY(), x, y));
     if (player.getFlipX() == -1)
     {
         effector.setAngle(effector.getAngle() + 180f);
     }
     SpriterBone parent = null;
     if (effector.hasParent())
     {
         parent = player.getRuntimeBones()[effector.getParentId()];
     }
     //effector.copyValuesTo(temp);
     //SpriterCalculator.reTranslateRelative(parent, temp);
     //if(effector instanceof SpriterBone)	temp.copyValuesTo(player.lastFrame.getBones()[effector.getId()]);
     //else temp.copyValuesTo(player.lastFrame.getObjects()[effector.getId()]);
     for (int i = 0; i < chainLength && parent != null; i++)
     {
         if (Com.Brashmonkey.Spriter.SpriterCalculator.distanceBetween(xx, yy, x, y) <= this
             .tolerance)
         {
             SpriterBone p = null;
             if (parent.hasParent())
             {
                 p = player.getRuntimeBones()[parent.getParentId()];
             }
             int j = 0;
             while (p != null && j < chainLength)
             {
                 base.updateRecursively(player, p);
                 if (p.hasParent())
                 {
                     p = player.getRuntimeBones()[p.getParentId()];
                 }
                 else
                 {
                     p = null;
                 }
                 j++;
             }
             return;
         }
         parent.setAngle(parent.getAngle() + Com.Brashmonkey.Spriter.SpriterCalculator.angleDifference
             (Com.Brashmonkey.Spriter.SpriterCalculator.angleBetween(parent.getX(), parent.getY
             (), x, y), Com.Brashmonkey.Spriter.SpriterCalculator.angleBetween(parent.getX(),
             parent.getY(), xx, yy)));
         base.updateRecursively(player, parent);
         if (parent.hasParent())
         {
             parent = player.getRuntimeBones()[parent.getParent().getId()];
         }
         else
         {
             parent = null;
         }
         xx = effector.getX() + (float)System.Math.Cos(SpriterCalculator.DegreeToRadian(effector.getAngle
             ())) * Com.Brashmonkey.Spriter.draw.AbstractDrawer.BONE_LENGTH * effector.getScaleX
             ();
         yy = effector.getY() + (float)System.Math.Sin(SpriterCalculator.DegreeToRadian(effector.getAngle
             ())) * Com.Brashmonkey.Spriter.draw.AbstractDrawer.BONE_LENGTH * effector.getScaleX
             ();
     }
 }
        protected internal virtual void updateRecursively(SpriterAbstractPlayer
			 player, SpriterAbstractObject @object)
        {
            this.updateObject(player, @object);
            if (@object is SpriterBone)
            {
                foreach (SpriterBone child in ((SpriterBone
                    )@object).getChildBones())
                {
                    this.updateRecursively(player, player.getRuntimeBones()[child.getId()]);
                }
                foreach (SpriterObject child_1 in ((SpriterBone
                    )@object).getChildObjects())
                {
                    this.updateRecursively(player, player.getRuntimeObjects()[child_1.getId()]);
                }
            }
        }
 /// <summary>
 /// Resolves the inverse kinematics constraints with the implemented algorithm in
 /// <see cref="resolve(float, float, int, SpriterAbstractObject, SpriterAbstractPlayer)
 /// 	">resolve(float, float, int, SpriterAbstractObject, SpriterAbstractPlayer)
 /// 	</see>
 /// .
 /// </summary>
 /// <param name="player">player to apply the resolving.</param>
 public virtual void resolve(SpriterAbstractPlayer player)
 {
     foreach(SpriterIKObject key in this.ikMap.Keys)
     {
         for (int j = 0; j < key.iterations; j++)
         {
             SpriterAbstractObject obj = this.ikMap[key];
             if (obj is Com.Brashmonkey.Spriter.objects.SpriterBone) obj = player.getRuntimeBones()[obj.getId()];
             else obj = player.getRuntimeObjects()[obj.getId()];
             this.resolve(obj.getX(), obj.getY(), key.chainLength, obj, player);
         }
     }
 }