private void Start()
    {
        monsterName = "Alp";
        for (int i = 0; i != dbObject.deserializedObject.monsters.Count; i++)
        {
            if (dbObject.deserializedObject.monsters[i].name == monsterName)
            {
                monsterObj = dbObject.deserializedObject.monsters[i];
            }
        }


        MonsterInit(monsterObj);
    }
 public void MonsterInit(XML.Monster monsterObj)
 {
     monsterNameLable.text = monsterObj.name;
 }
Exemple #3
0
    // Test Monster
    XML.Monster MonsterAdd(string name)
    {
        var monster = new XML.Monster();

        monster.id                                           = Guid.NewGuid();
        monster.name                                         = name;
        monster.bounty                                       = 1000;
        monster.armor                                        = 0;
        monster.threat                                       = new XML.Threat();
        monster.threat.difficulty                            = "Hard";
        monster.threat.complexity                            = "Difficult";
        monster.skills                                       = new XML.Skills();
        monster.skills.intelligenceSkills                    = new XML.IntelligenceSkills();
        monster.skills.intelligenceSkills.awareness          = 8f;
        monster.skills.intelligenceSkills.business           = 0;
        monster.skills.intelligenceSkills.deduction          = 0;
        monster.skills.intelligenceSkills.education          = 0;
        monster.skills.intelligenceSkills.commonSpeech       = 0;
        monster.skills.intelligenceSkills.elderSpeech        = 0;
        monster.skills.intelligenceSkills.dwarven            = 0;
        monster.skills.intelligenceSkills.monsterLore        = 0;
        monster.skills.intelligenceSkills.socialEtiquette    = 0;
        monster.skills.intelligenceSkills.streetwise         = 0;
        monster.skills.intelligenceSkills.tactics            = 0;
        monster.skills.intelligenceSkills.teaching           = 0;
        monster.skills.intelligenceSkills.wildernessSurvival = 0;
        monster.skills.reflexSkills                          = new XML.ReflexSkills();
        monster.skills.reflexSkills.brawling                 = 8f;
        monster.skills.reflexSkills.dodge                    = 10f;
        monster.skills.reflexSkills.melee                    = 7f;
        monster.skills.reflexSkills.riding                   = 0;
        monster.skills.reflexSkills.sailing                  = 0;
        monster.skills.reflexSkills.smallBlades              = 0;
        monster.skills.reflexSkills.staffSpear               = 0;
        monster.skills.reflexSkills.swordsmanship            = 0;
        monster.skills.dexteritySkills                       = new XML.DexteritySkills();
        monster.skills.dexteritySkills.archery               = 0;
        monster.skills.dexteritySkills.athletics             = 10f;
        monster.skills.dexteritySkills.crossbow              = 0;
        monster.skills.dexteritySkills.slightOfHand          = 0;
        monster.skills.dexteritySkills.stealth               = 9f;
        monster.skills.bodySkills                            = new XML.BodySkills();
        monster.skills.bodySkills.physique                   = 0;
        monster.skills.bodySkills.endurance                  = 0;
        monster.skills.empathySkills                         = new XML.EmpathySkills();
        monster.skills.empathySkills.charisma                = 9f;
        monster.skills.empathySkills.deceit                  = 10f;
        monster.skills.empathySkills.fineArts                = 0;
        monster.skills.empathySkills.gambling                = 0;
        monster.skills.empathySkills.style                   = 0;
        monster.skills.empathySkills.humanPerception         = 8f;
        monster.skills.empathySkills.leadership              = 0;
        monster.skills.empathySkills.performance             = 0;
        monster.skills.empathySkills.persuasion              = 0;
        monster.skills.empathySkills.seduction               = 10f;
        monster.skills.craftSkills                           = new XML.CraftSkills();
        monster.skills.craftSkills.alchemy                   = 0;
        monster.skills.craftSkills.crafting                  = 0;
        monster.skills.craftSkills.disguise                  = 0;
        monster.skills.craftSkills.firstAid                  = 0;
        monster.skills.craftSkills.forgery                   = 0;
        monster.skills.craftSkills.pickLock                  = 0;
        monster.skills.craftSkills.trap                      = 0;
        monster.skills.willSkills                            = new XML.WillSkills();
        monster.skills.willSkills.courage                    = 6f;
        monster.skills.willSkills.hex                        = 0;
        monster.skills.willSkills.intimidation               = 4f;
        monster.skills.willSkills.casting                    = 0;
        monster.skills.willSkills.resistCoercion             = 8f;
        monster.skills.willSkills.resistMagic                = 9f;
        monster.skills.willSkills.ritualCrafting             = 0;
        monster.abilities                                    = new List <XML.Abilities>();
        monster.abilities.Add(new XML.AnaestheticSalivaAbility());
        monster.abilities.Add(new XML.FastCharge());
        monster.abilities.Add(new XML.IllusionAbility());
        monster.abilities.Add(new XML.InvisibleToMagicalScanningAbility());
        monster.abilities.Add(new XML.NightVision());
        monster.abilities.Add(new XML.Regeneration());
        monster.abilities.Add(new XML.SonicScreechAbility());
        monster.vulnerabilities = new List <XML.Vulnerabilities>();
        monster.vulnerabilities.Add(new XML.BlackBloodPotion());
        monster.vulnerabilities.Add(new XML.BloodTransference());
        monster.vulnerabilities.Add(new XML.MoondustBomb());
        monster.vulnerabilities.Add(new XML.TouchOfSilver());
        monster.vulnerabilities.Add(new XML.VampireOil());
        monster.weapons = new List <XML.Weapon>();
        monster.weapons.Add(new XML.Claws());
        monster.weapons.Add(new XML.Bite());
        monster.mutagenRecoverySection                              = new XML.MutagenRecoverySection();
        monster.mutagenRecoverySection.decoction                    = "Alp Decoction";
        monster.mutagenRecoverySection.description                  = "Grants +2 to Critical Wound Chance rolls.";
        monster.mutagenRecoverySection.decoctionFormulae            = new XML.DecoctionFormulae();
        monster.mutagenRecoverySection.decoctionFormulae.name       = "Alp Decoction Formulae";
        monster.mutagenRecoverySection.decoctionFormulae.craftDC    = 18;
        monster.mutagenRecoverySection.decoctionFormulae.craftTime  = .5f;
        monster.mutagenRecoverySection.decoctionFormulae.components = new List <XML.AlchemyComponents>();
        monster.mutagenRecoverySection.decoctionFormulae.components.Add(XML.AlchemyComponents.Rebis);
        monster.mutagenRecoverySection.decoctionFormulae.components.Add(XML.AlchemyComponents.Rebis);
        monster.mutagenRecoverySection.decoctionFormulae.components.Add(XML.AlchemyComponents.Quebrith);
        monster.mutagenRecoverySection.decoctionFormulae.components.Add(XML.AlchemyComponents.Aether);
        monster.mutagenRecoverySection.decoctionFormulae.components.Add(XML.AlchemyComponents.Fulgur);
        monster.mutagenRecoverySection.mutagen               = new XML.Mutagen();
        monster.mutagenRecoverySection.mutagen.name          = "Alp Mutagen";
        monster.mutagenRecoverySection.mutagen.alchemyDC     = 20;
        monster.mutagenRecoverySection.mutagen.effect        = "+1 Dodge/Escape";
        monster.mutagenRecoverySection.mutagen.minorMutation = "Visibly swollen veins";
        monster.loot = new List <XML.Loot>();
        monster.loot.Add(new XML.VampireTeeth());

        return(monster);
    }
Exemple #4
0
    void Awake()
    {
        // Build Root object TODO load not build
        var objToSerialize = new XML.WEBRoot();

        objToSerialize.monsters = new List <XML.Monster>(3);
        for (int i = 0; i != objToSerialize.monsters.Capacity; i++)
        {
            var monster = new XML.Monster();
            monster.id                        = Guid.NewGuid();
            monster.name                      = "test" + i + 1;
            monster.bounty                    = (i + 2) * 2;
            monster.threat                    = new XML.Threat();
            monster.threat.difficulty         = "Easy";
            monster.threat.complexity         = "simple";
            monster.skills                    = new XML.Skills();
            monster.skills.intelligenceSkills = new XML.IntelligenceSkills();
            monster.skills.intelligenceSkills.commonSpeech = 5f;
            monster.abilities = new List <XML.Abilities>();
            monster.abilities.Add(new XML.Regeneration());
            monster.vulnerabilities = new List <XML.Vulnerabilities>();
            monster.vulnerabilities.Add(new XML.VampireOil());
            objToSerialize.monsters.Add(monster);
        }

        objToSerialize.monsters.Add(MonsterAdd("Alp"));

        // serialize / save to disk
        using (var xmlStream = new FileStream(filename, FileMode.Create, FileAccess.Write, FileShare.Read))
        {
            // Get all derived classes
            var knownTypes = Assembly.GetExecutingAssembly().GetTypes().Where(
                t => typeof(XML.Abilities).IsAssignableFrom(t) ||
                typeof(XML.Weapon).IsAssignableFrom(t) ||
                typeof(XML.WeaponEffect).IsAssignableFrom(t) ||
                typeof(XML.Loot).IsAssignableFrom(t) ||
                typeof(XML.Vulnerabilities).IsAssignableFrom(t)).ToArray();
            // serialize
            var serializer = new XmlSerializer(typeof(XML.WEBRoot), knownTypes);
            serializer.Serialize(xmlStream, objToSerialize);
        }

        // deserialize / load from disk
        using (var xmlStream = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read))
        {
            // Get all derived classes
            var knownTypes = Assembly.GetExecutingAssembly().GetTypes().Where(
                t => typeof(XML.Abilities).IsAssignableFrom(t) ||
                typeof(XML.Weapon).IsAssignableFrom(t) ||
                typeof(XML.WeaponEffect).IsAssignableFrom(t) ||
                typeof(XML.Loot).IsAssignableFrom(t) ||
                typeof(XML.Vulnerabilities).IsAssignableFrom(t)).ToArray();
            // deserialize
            var serializer = new XmlSerializer(typeof(XML.WEBRoot), knownTypes);
            deserializedObject = (XML.WEBRoot)serializer.Deserialize(xmlStream);
        }
        for (int i = 0; i != deserializedObject.monsters.Count; i++)
        {
            Debug.Log(deserializedObject.monsters[i].id);
            Debug.Log(deserializedObject.monsters[i].name);
            Debug.Log(deserializedObject.monsters[i].bounty);
            Debug.Log(deserializedObject.monsters[i].threat.difficulty);
            Debug.Log(deserializedObject.monsters[i].threat.complexity);
            Debug.Log(deserializedObject.monsters[i].skills.intelligenceSkills.commonSpeech);
            Debug.Log(deserializedObject.monsters[i].abilities[0].name);
            Debug.Log(deserializedObject.monsters[i].abilities[0].description);
            Debug.Log(deserializedObject.monsters[i].vulnerabilities[0].name);
        }
    }