예제 #1
0
 public ActorStats(Lidgren.Network.NetIncomingMessage r)
 {
     life        = new Container(r);
     breath      = new FloatContainer(r);
     power       = new Container(r);
     share_power = r.ReadBoolean();
     ammo        = new Container(r);
     experience  = r.ReadInt32();
     level       = 1 + (int)Math.Pow(experience / 5, .5f);
     if (level > 1)
     {
         experience_to_level = new Container(experience - ((int)Math.Pow((level - 1), 2) * 5), ((int)Math.Pow((level), 2) * 5) - (int)Math.Pow((level - 1), 2) * 5);
     }
     else
     {
         experience_to_level = new Container(experience, (int)Math.Pow((level), 2) * 5);
     }
     complexity             = r.ReadInt32();
     armor                  = r.ReadString();
     jump_speed             = r.ReadSingle();
     run_speed              = r.ReadSingle();
     jump_max_time          = r.ReadSingle();
     jump_cur_time          = 0f;
     can_swim               = r.ReadBoolean();
     boyant                 = r.ReadBoolean();
     jump_can_resume        = r.ReadBoolean();
     life_regen             = r.ReadSingle();
     accum_life_regen       = 0f;
     ammo_regen             = r.ReadSingle();
     accum_ammo_regen       = 0f;
     energy_regen           = r.ReadSingle();
     accum_energy_regen     = 0f;
     water_jump_proficiency = r.ReadSingle();
     max_safe_fall          = r.ReadInt32();
 }
예제 #2
0
        public void ReadMe(Lidgren.Network.NetIncomingMessage msg)
        {
            EmmitingDirection   = msg.ReadVector();
            EmitingTime         = msg.ReadFloat();
            MinAngle            = msg.ReadFloat();
            MaxAngle            = msg.ReadFloat();
            MaxForce            = msg.ReadFloat();
            MinForce            = msg.ReadFloat();
            MaxLife             = msg.ReadFloat();
            MinLife             = msg.ReadFloat();
            MaxSize             = msg.ReadFloat();
            MinSize             = msg.ReadFloat();
            MaxRotation         = msg.ReadFloat();
            MinRotation         = msg.ReadFloat();
            MaxStartingRotation = msg.ReadFloat();
            MinStartingRotation = msg.ReadFloat();
            Delay          = msg.ReadFloat();
            SizeMultiplier = msg.ReadFloat();
            Amount         = msg.ReadInt32();
            FireAll        = msg.ReadBoolean();
            Infinite       = msg.ReadBoolean();
            Position       = msg.ReadVector();
            Direction      = msg.ReadVector();

            Factory = NetDataHelper.ReadParticleFactory(msg);
            IList <IControl> controls = NetDataHelper.ReadControls(msg);

            foreach (IControl control in controls)
            {
                AddControl(control);
            }
        }
예제 #3
0
        public ItemChest(Lidgren.Network.NetIncomingMessage r)
        {
            destroyable    = r.ReadBoolean();
            chest_name     = r.ReadString();
            security       = r.ReadString();
            world_top_left = new Point(r.ReadUInt16(), r.ReadUInt16());
            furniture_id   = r.ReadUInt16();
            items          = new List <Cubby>();
            int num_items = r.ReadByte();

            for (int i = 0; i < num_items; i++)
            {
                items.Add(new Cubby(r));
            }
        }
예제 #4
0
        /// <summary>
        /// Deserialize the array from the message
        /// </summary>
        /// <param name="message"></param>
        public void OnDeserialize(Lidgren.Network.NetIncomingMessage message)
        {
            var length = message.ReadInt32();

            items = new T[length];

            for (int i = 0; i < length; i++)
            {
                var hasValue = true;
                if (PreserveIndex && !IsValueType)
                {
                    hasValue = message.ReadBoolean();
                }
                if (!hasValue)
                {
                    continue;
                }

                var t = new T();
                t.OnDeserialize(message);
                items[i] = t;
            }
        }