Ejemplo n.º 1
0
        partial void SetupDrawOrder()
        {
            //make sure every character gets drawn at a distinct "layer"
            //(instead of having some of the limbs appear behind and some in front of other characters)
            float startDepth = 0.1f;
            float increment  = 0.001f;

            foreach (Character otherCharacter in Character.CharacterList)
            {
                if (otherCharacter == character)
                {
                    continue;
                }
                startDepth += increment;
            }
            //make sure each limb has a distinct depth value
            List <Limb> depthSortedLimbs = Limbs.OrderBy(l => l.ActiveSprite == null ? 0.0f : l.ActiveSprite.Depth).ToList();

            foreach (Limb limb in Limbs)
            {
                if (limb.ActiveSprite != null)
                {
                    limb.ActiveSprite.Depth = startDepth + depthSortedLimbs.IndexOf(limb) * 0.00001f;
                }
            }
            depthSortedLimbs.Reverse();
            inversedLimbDrawOrder = depthSortedLimbs.ToArray();
        }
Ejemplo n.º 2
0
 protected void CreateLimbs()
 {
     Limbs.Clear();
     foreach (var element in MainElement.Elements("limb"))
     {
         Limbs.Add(new LimbParams(element, this));
     }
     Limbs = Limbs.OrderBy(l => l.ID).ToList();
 }