Пример #1
0
        public static EntityEquipable ReadEntityEquipable(this NetworkReader reader)
        {
            string name               = reader.ReadString();
            int    level              = reader.ReadInt32();
            EntityEquipableType type  = (EntityEquipableType)reader.ReadInt32();
            int statsInfluencesLength = reader.ReadInt32();

            StatsInfluenceData.StatsInfluence[] statsInfluences = new StatsInfluenceData.StatsInfluence[statsInfluencesLength];
            for (int i = 0; i < statsInfluencesLength; i++)
            {
                statsInfluences[i] = reader.ReadStatsInfluence();
            }

            bool hasEquippedAbility = reader.ReadBoolean();
            EntityEquipableAbility equipableAbility = null;

            if (hasEquippedAbility)
            {
                equipableAbility = reader.ReadEntityEquipableAbility();
            }

            bool hasVisual = reader.ReadBoolean();
            EntityEquipableVisual visual = null;

            if (hasVisual)
            {
                visual = reader.ReadEntityEquipableVisual();
            }

            return(new EntityEquipable(
                       name,
                       level,
                       type,
                       statsInfluences,
                       equipableAbility,
                       visual));
        }