Exemple #1
0
    public void SpawnItem()
    {
        var chance = 0;

        chance = random.Next(0, 6);
        switch (chance)
        {
        case 0:
            Sword sword = new Sword();
            sword.Initialization();
            inventory.Add(sword);
            break;

        case 1:
            Stick stick = new Stick();
            stick.Initialization();
            inventory.Add(stick);
            break;

        case 2:
            Hat hat = new Hat();
            hat.Initialization();
            inventory.Add(hat);
            break;

        case 3:
            Bib bib = new Bib();
            bib.Initialization();
            inventory.Add(bib);
            break;

        case 4:
            Trousers trousers = new Trousers();
            trousers.Initialization();
            inventory.Add(trousers);
            break;

        case 5:
            Boots boots = new Boots();
            boots.Initialization();
            inventory.Add(boots);
            break;
        }
    }