Exemplo n.º 1
0
    void PreviewItem(string long_id)
    {
        int    type = 0, id = 0, rarity = 0;
        StatsD stats = new StatsD();

        ReadItem(long_id, out type, out id, out stats, out rarity);
        itemPreview.sprite         = SpriteItemByID(long_id);
        itemPreview.preserveAspect = true;
    }
Exemplo n.º 2
0
 public void ReadItem(string long_id, out int type, out int id, out StatsD stats, out int rarity)
 {
     type  = int.Parse(long_id.Substring(0, 1));
     id    = int.Parse(long_id.Substring(1, 5));
     stats = new StatsD()
     {
         vit  = int.Parse(long_id.Substring(6, 1)),
         str  = int.Parse(long_id.Substring(7, 1)),
         dex  = int.Parse(long_id.Substring(8, 1)),
         luck = int.Parse(long_id.Substring(9, 1)),
     };
     rarity = int.Parse(long_id.Substring(10, 1));
 }
Exemplo n.º 3
0
    void GenerateEquipItem(EquipD_Type equip_type, byte rarity)
    {
        SpriteGroupEntry randomItem;
        byte             listNumber;

        switch (equip_type)
        {
        default: listNumber = 0; randomItem = spriteCollection.ArmorTorso[Random.Range(0, spriteCollection.ArmorTorso.Count)]; break;

        case EquipD_Type.Helmet: listNumber = 1; randomItem = spriteCollection.Helmet[Random.Range(0, spriteCollection.Helmet.Count)]; break;

        case EquipD_Type.Back: listNumber = 2; randomItem = spriteCollection.Back[Random.Range(0, spriteCollection.Back.Count)]; break;

        case EquipD_Type.Shield: listNumber = 3; randomItem = spriteCollection.Shield[Random.Range(0, spriteCollection.Shield.Count)]; break;

        case EquipD_Type.Weapon1H: listNumber = 4; randomItem = spriteCollection.MeleeWeapon1H[Random.Range(0, spriteCollection.MeleeWeapon1H.Count)]; break;

        case EquipD_Type.Weapon2H: listNumber = 5; randomItem = spriteCollection.MeleeWeapon2H[Random.Range(0, spriteCollection.MeleeWeapon2H.Count)]; break;
        }

        StatsD newStatsD = randomItem.stats;

        for (var x = 0; x < 3; x++)                  //Reparte 3 stats de forma aleatoria.
        {
            switch (Random.Range(0, 4))
            {
            case 0: newStatsD.vit++; break;

            case 1: newStatsD.str++; break;

            case 2: newStatsD.luck++; break;

            default: newStatsD.dex++; break;
            }
        }

        string long_id = listNumber.ToString() + randomItem.Id.ToString() + newStatsD.vit.ToString() + newStatsD.str.ToString() + newStatsD.dex.ToString() + newStatsD.luck.ToString() + rarity.ToString();

        print("Generado: " + long_id);
        PreviewItem(long_id);
    }