Exemple #1
0
    void GeneratePowerupPrefab()
    {
        ClearList(listCreatedBuff);

        listBuff = ShopDataManager.Instance.GetPoerUpData();

        for (int i = 0; i < listBuff.Count; i++)
        {
            GameObject  go         = Instantiate(powerupPrefab) as GameObject;
            PowerupItem buffPrefab = go.GetComponent <PowerupItem>();

            buffPrefab.SetParentToggleGrup(parentGameobject);
            buffPrefab.SetItemData(listBuff[i]);

            if (i == 0)
            {
                buffPrefab.ItemSelectedPreview();
            }

            listCreatedBuff.Add(go);
        }
    }
Exemple #2
0
        public void SpinItemBox(Player p) {
            p.PlayItemBoxSound();
            p.HasItem = true;
            Thread t = new Thread(() => {
                for(int i = 0; i < 50; i++) {
                    switch(rand.Next(4)) {
                        case 0:
                            p.ItemFrame.Image = Banana;
                            current = PowerupItem.Banana;
                            break;
                            
                        case 1:
                            p.ItemFrame.Image = Mushroom;
                            current = PowerupItem.Mushroom;
                            break;

                        case 2:
                            p.ItemFrame.Image = Shell;
                            current = PowerupItem.Shell;
                            break;
                        case 3:
                            p.ItemFrame.Image = RedShell;
                            current = PowerupItem.RedShell;
                            break;
                    }
                    Thread.Sleep(80);

                }
                p.currentPowerup = current;

            });

            t.IsBackground = true;
            t.Start();


        }