Пример #1
0
    private void createEnemiesTable()
    {
        enemiesTable = new RDSTable();

        for (int i = 0; i < enemiesType.Count; i++)
        {
            enemiesTable.addEntry(enemiesType[i]);
        }
    }
Пример #2
0
    protected virtual void Start()
    {
        //target = GameObject.FindWithTag("Player").GetComponent<Player>();
        target = GameObject.Find("player").GetComponent <Player>();
        //targetTransform = GameObject.FindWithTag("Player").transform;
        targetTransform = GameObject.Find("player").transform;
        health          = maxHealth;
        rg   = GetComponent <Rigidbody2D>();
        anim = GetComponent <Animator>();
        doll = GetComponent <Ragdoll>();

        dropTable = new RDSTable();
        createDropTable();
        playedDead       = false;
        attackTimer      = attackCooldown / 3.0f;
        standingInterval = Random.Range(standingIntervalMin, standingIntervalMax);

        veryOldAttack = -1;
        oldAttack     = -1;
        invincible    = false;
    }
Пример #3
0
    //This should be pulled in via xml
    private void CreateTables()
    {
        commonTable = new RDSTable();
        commonTable.AddEntry(new Armor("Cloth Chest Piece", ARMOR_CLASS.CLOTH, ITEM_SLOT.CHEST_ARMOR), 10);
        commonTable.AddEntry(new Armor("Cloth Helmet", ARMOR_CLASS.CLOTH, ITEM_SLOT.HELMET), 10);
        commonTable.AddEntry(new Armor("Padded Chest Piece", ARMOR_CLASS.LEATHER, ITEM_SLOT.CHEST_ARMOR), 10);
        commonTable.AddEntry(new Armor("Padded Helmet", ARMOR_CLASS.LEATHER, ITEM_SLOT.HELMET), 10);
        commonTable.AddEntry(new Armor("Plate Chest Piece", ARMOR_CLASS.PLATE, ITEM_SLOT.CHEST_ARMOR), 10);
        commonTable.AddEntry(new Armor("Plate Helment", ARMOR_CLASS.PLATE, ITEM_SLOT.HELMET), 10);
        commonTable.AddEntry(new Weapon("Default Stick", WEAPON_CLASS.TWO_HANDED, WEAPON_TYPE.STAFF), 10);
        commonTable.AddEntry(new Weapon("Blunt Object", WEAPON_CLASS.ONE_HANDED, WEAPON_TYPE.MACE), 10);
        commonTable.AddEntry(new Shield("Small Shield", SHIELD_TYPE.SMALL), 10);
        commonTable.AddEntry(new Shield("Medium Shield", SHIELD_TYPE.MEDIUM), 10);
        commonTable.AddEntry(new Shield("Large Shield", SHIELD_TYPE.LARGE), 10);
        commonTable.AddEntry(new Jewelry("Plain Amulet"), 10);
        commonTable.AddEntry(new Jewelry("Silver Ring"), 10);
        commonTable.AddEntry(new Jewelry("Copper Band"), 10);
        commonTable.AddEntry(new Misc("Note", "A torn message"), 10);

        //masterTable.AddEntry(commonTable, 10);
        //masterTable.AddEntry(setTable, 10);
        //masterTable.AddEntry(uniqueTable, 10);
    }
Пример #4
0
        private void InitializeDropTables()
        {
            Console.WriteLine("Initializing Drop Tables...");

            XmlDocument enemyDoc = new XmlDocument();
            enemyDoc.Load("Xml/Enemies.xml");

            XmlDocument itemDoc = new XmlDocument();
            XmlNode itemNode;
            
            List<string> xmlList = new List<string>();
            xmlList.Add("Xml/Armor.xml");
            xmlList.Add("Xml/Jewelry.xml");
            xmlList.Add("Xml/Weapons.xml");

            XmlNode enemyNode = enemyDoc.FirstChild.NextSibling;
            int enemyCount = enemyNode.ChildNodes.Count;
            enemyNode = enemyNode.FirstChild;
            for (int i = 0; i < enemyCount; i++)
            {
                int mLvl = Convert.ToInt32(enemyNode.Attributes[3].Value);
                RDSTable dropTable = new RDSTable();
                dropTable.rdsCount = 3;
                dropTable.AddEntry(new RDSNullValue(50));

                for (int j = 0; j < xmlList.Count; j++)
                {
                    itemDoc.Load(xmlList[j]);
                    itemNode = itemDoc.FirstChild.NextSibling;
                    int itemCount = itemNode.ChildNodes.Count;
                    itemNode = itemNode.FirstChild;
                    for (int k = 0; k < itemCount; k++)
                    {
                        int iLvl = Convert.ToInt32(itemNode.Attributes[2].Value);

                        double probability = 0;
                        if (mLvl == iLvl) probability = 1;
                        else probability = (double)mLvl / Math.Abs((mLvl * mLvl * mLvl) - (iLvl * iLvl * iLvl));

                        switch (j)
                        {
                            case 0:
                                dropTable.AddEntry(new ArmorObject(itemNode.Attributes[0].Value), probability);
                                break;
                            case 1:
                                dropTable.AddEntry(new JewelryObject(itemNode.Attributes[0].Value), probability);
                                break;
                            case 2:
                                dropTable.AddEntry(new WeaponObject(itemNode.Attributes[0].Value), probability);
                                break;
                        }
                        if (k < itemCount - 1) itemNode = itemNode.NextSibling;
                    }
                }
                dropMap.Add(enemyNode.Attributes[1].Value, dropTable);
                if (i < enemyCount - 1) enemyNode = enemyNode.NextSibling;
            }
        }