Esempio n. 1
0
 public void SerializeRope(Rope r)
 {
     if (r != null)
     {
         this.ropeData.Write(true);
         this.ropeData.Write(CompressedVec2Binding.GetCompressedVec2(r.attach2Point));
         this.SerializeRope(r.attach2 as Rope);
     }
     else
     {
         this.ropeData.Write(false);
     }
 }
Esempio n. 2
0
 public void DeserializeRope(Rope r)
 {
     if (this.ropeData.ReadBool())
     {
         if (r == null)
         {
             this._rope = new Rope(0.0f, 0.0f, (Thing)r, (Thing)null, tex: this._ropeSprite, belongsTo: ((Thing)this));
             r          = this._rope;
         }
         r.attach1 = (Thing)r;
         r._thing  = (Thing)null;
         Level.Add((Thing)r);
         Vec2 uncompressedVec2 = CompressedVec2Binding.GetUncompressedVec2(this.ropeData.ReadInt());
         if (r == this._rope)
         {
             r.attach1 = (Thing)r;
             if (this.duck != null)
             {
                 r.position = this.duck.position;
             }
             r._thing = (Thing)this.duck;
         }
         if (r.attach2 == null || !(r.attach2 is Rope) || r.attach2 == r)
         {
             Rope rope = new Rope(uncompressedVec2.x, uncompressedVec2.y, (Thing)r, (Thing)null, tex: this._ropeSprite, belongsTo: ((Thing)this));
             r.attach2 = (Thing)rope;
         }
         if (r.attach2 != null)
         {
             r.attach2.position          = uncompressedVec2;
             (r.attach2 as Rope).attach1 = (Thing)r;
         }
         this.DeserializeRope(r.attach2 as Rope);
     }
     else if (r == this._rope)
     {
         this.Degrapple();
     }
     else
     {
         if (r == null)
         {
             return;
         }
         Rope attach1 = r.attach1 as Rope;
         attach1.TerminateLaterRopes();
         this._harpoon.Latch(r.position);
         attach1.attach2 = (Thing)this._harpoon;
     }
 }
Esempio n. 3
0
 public override object ReadNetValue(object val) => (object)CompressedVec2Binding.GetUncompressedVec2((int)val, this._range);
Esempio n. 4
0
 public override object GetNetValue() => (object)CompressedVec2Binding.GetCompressedVec2((Vec2)this.value, this._range);