Example #1
0
        public static EntityEquipableAbility ReadEntityEquipableAbility(this NetworkReader reader)
        {
            AbilityData        ability         = (AbilityData)PinouApp.Resources.Data.Databases.GetItem(DatabaseType.Ability, reader.ReadInt32());
            bool               overrideTrigger = reader.ReadBoolean();
            AbilityTriggerData triggerData     = null;

            if (overrideTrigger)
            {
                triggerData = reader.ReadAbilityTriggerData();
            }
            bool  overrideCooldown = reader.ReadBoolean();
            float cooldown         = 0f;

            if (overrideCooldown)
            {
                cooldown = (float)reader.ReadDouble();
            }

            int abilitiesResourcesInfluencesLength = reader.ReadInt32();

            EntityEquipableAbilityResourcesInfluences[] abilitiesResourcesInfluences = new EntityEquipableAbilityResourcesInfluences[abilitiesResourcesInfluencesLength];
            for (int i = 0; i < abilitiesResourcesInfluencesLength; i++)
            {
                abilitiesResourcesInfluences[i] = reader.ReadEntityEquipableAbilityResourcesInfluences();
            }

            return(new EntityEquipableAbility(
                       ability,
                       overrideTrigger,
                       triggerData,
                       overrideCooldown,
                       cooldown,
                       abilitiesResourcesInfluences));
        }