Exemplo n.º 1
0
 private static void AnimsXML(XmlNode xmlNode, ObjModel obj)
 {
     for (XmlNode xmlNode1 = xmlNode.FirstChild; xmlNode1 != null; xmlNode1 = xmlNode1.NextSibling)
     {
         if ("Anims".Equals(xmlNode1.Name))
         {
             for (XmlNode xmlNode2 = xmlNode1.FirstChild; xmlNode2 != null; xmlNode2 = xmlNode2.NextSibling)
             {
                 if ("Anim".Equals(xmlNode2.Name))
                 {
                     XmlNamedNodeMap attributes = (XmlNamedNodeMap)xmlNode2.Attributes;
                     AnimModel       animModel  = new AnimModel()
                     {
                         _id        = int.Parse(attributes.GetNamedItem("Id").Value),
                         _duration  = float.Parse(attributes.GetNamedItem("Duration").Value),
                         _nextAnim  = int.Parse(attributes.GetNamedItem("Next").Value),
                         _otherObj  = int.Parse(attributes.GetNamedItem("OtherOBJ").Value),
                         _otherAnim = int.Parse(attributes.GetNamedItem("OtherANIM").Value)
                     };
                     if (animModel._id == 0)
                     {
                         obj._noInstaSync = true;
                     }
                     if (animModel._id != (int)byte.MaxValue)
                     {
                         obj._updateId = 3;
                     }
                     obj._anims.Add(animModel);
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
 private static void AnimsXML(XmlNode xmlNode, ObjModel obj)
 {
     for (XmlNode xmlNode5 = xmlNode.FirstChild; xmlNode5 != null; xmlNode5 = xmlNode5.NextSibling)
     {
         if ("Anims".Equals(xmlNode5.Name))
         {
             for (XmlNode xmlNode6 = xmlNode5.FirstChild; xmlNode6 != null; xmlNode6 = xmlNode6.NextSibling)
             {
                 if ("Sync".Equals(xmlNode6.Name))
                 {
                     XmlNamedNodeMap xml6 = xmlNode6.Attributes;
                     AnimModel       anim = new AnimModel
                     {
                         _id        = int.Parse(xml6.GetNamedItem("Id").Value),
                         _duration  = float.Parse(xml6.GetNamedItem("Date").Value),
                         _nextAnim  = int.Parse(xml6.GetNamedItem("Next").Value),
                         _otherObj  = int.Parse(xml6.GetNamedItem("OtherOBJ").Value),
                         _otherAnim = int.Parse(xml6.GetNamedItem("OtherANIM").Value)
                     };
                     if (anim._id == 0)
                     {
                         obj._noInstaSync = true;
                     }
                     if (anim._id != 255)
                     {
                         obj._updateId = 3;
                     }
                     obj._anims.Add(anim);
                 }
             }
         }
     }
 }
Exemplo n.º 3
0
 public int SetRandomAnimToObj(Room room, ObjectInfo obj)
 {
     if (this._anims != null && this._anims.Count > 0)
     {
         AnimModel anim = this._anims[new Random().Next(this._anims.Count)];
         obj._anim = anim;
         obj.lastInteractionTime = DateTime.Now;
         if (anim._otherObj > 0)
         {
             ObjectInfo objectInfo = room._objects[anim._otherObj];
             this.SelectAnimToObj(anim._otherAnim, 0.0f, 0.0f, objectInfo);
         }
         return(anim._id);
     }
     obj._anim = (AnimModel)null;
     return((int)byte.MaxValue);
 }
Exemplo n.º 4
0
 public int GetARandomAnim(Room room, ObjectInfo obj)
 {
     if (_anims != null && _anims.Count > 0)
     {
         int       idx  = new Random().Next(_anims.Count);
         AnimModel anim = _anims[idx];
         obj._anim    = anim;
         obj._useDate = DateTime.Now;
         if (anim._otherObj > 0)
         {
             ObjectInfo obj2 = room._objects[anim._otherObj];
             GetAnim(anim._otherAnim, 0, 0, obj2);
         }
         //Logger.warning("Animação escolhida: " + anim._id);
         return(anim._id);
     }
     obj._anim = null;
     return(255);
 }
Exemplo n.º 5
0
        public void GetAnim(int animId, float time, float duration, ObjectInfo obj)
        {
            if (animId == 255 || obj == null || obj._model == null || obj._model._anims == null || obj._model._anims.Count == 0)
            {
                return;
            }
            ObjModel objModel = obj._model;

            for (int i = 0; i < objModel._anims.Count; i++)
            {
                AnimModel anim = objModel._anims[i];
                if (anim._id == animId)
                {
                    obj._anim    = anim;
                    time        -= duration;
                    obj._useDate = DateTime.Now.AddSeconds(time * -1);
                    break;
                }
            }
        }
Exemplo n.º 6
0
        public void SelectAnimToObj(int animId, float time, float duration, ObjectInfo obj)
        {
            if (animId == (int)byte.MaxValue || obj == null || (obj._model == null || obj._model._anims == null) || obj._model._anims.Count == 0)
            {
                return;
            }
            ObjModel model = obj._model;

            for (int index = 0; index < model._anims.Count; ++index)
            {
                AnimModel anim = model._anims[index];
                if (anim._id == animId)
                {
                    obj._anim = anim;
                    time     -= duration;
                    obj.lastInteractionTime = DateTime.Now.AddSeconds((double)time * -1.0);
                    break;
                }
            }
        }