Exemplo n.º 1
0
    void onClick()
    {
        ShopSlot sS = transform.parent.GetComponent <ShopSlot>();

        if (sS.bought)
        {
            if (!sS.selected && Bottombar.instance.mobsInBar < 5)
            {
                Bottombar.instance.addToBar(sS.prefab);
                sS.toggleSelected();
            }
            else if (sS.selected)
            {
                Bottombar.instance.removeFromBar(sS.prefab);
                sS.toggleSelected();
            }
        }
    }
Exemplo n.º 2
0
    void postPrepareLoadedLevel()
    {
        cleanLevelForLoad();
        M_Boss bossM = GameController.instance.boss.GetComponent <M_Boss>();

        bossM.health    = savedGame.bossHealth;
        bossM.mana      = savedGame.bossMana;
        bossM.maxHealth = savedGame.bossMaxHealth;
        bossM.maxMana   = savedGame.bossMaxMana;

        int i = 0;

        foreach (M_Mob mob in instantiatedMobs)
        {
            mob.health    = savedGame.mobs[i][1];
            mob.mana      = savedGame.mobs[i][2];
            mob.maxHealth = savedGame.mobs[i][3];
            mob.maxMana   = savedGame.mobs[i][4];
            i++;
        }

        i = 0;
        foreach (float[] chestAttr in savedGame.chestPos)
        {
            GameObject chestPrefab = PrefabIndex.instance.prefabIndex[savedGame.chests[i][0]];
            Vector3    chestPos    = new Vector3(savedGame.chestPos[i][0], savedGame.chestPos[i][1], savedGame.chestPos[i][2]);
            GameObject insChest    = Instantiate(chestPrefab, chestPos, chestPrefab.transform.rotation) as GameObject;
            GameController.instance.roomShades[savedGame.chests[i][1]].GetComponent <RoomController>().addChest(insChest);
            i++;
        }

        // Spawn Menu
        i = 0;
        while (true)
        {
            i++;
            Transform mobSlot = GameController.instance.mobWindow.transform.Find("Scroller/Grid/Slot" + i);
            if (mobSlot != null)
            {
                ShopSlot sSlot = mobSlot.GetComponent <ShopSlot>();
                if (savedGame.spawnSlots[i - 1][0] != 1)
                {
                    sSlot.unlock();
                }
                if (savedGame.spawnSlots[i - 1][1] == 1)
                {
                    sSlot.changeButtonToTalent();
                }
                if (savedGame.spawnSlots[i - 1][2] == 1)
                {
                    sSlot.toggleSelected();
                    Bottombar.instance.addToBar(PrefabIndex.instance.prefabIndex[savedGame.spawnSlots[i - 1][3]]);
                }
            }
            else
            {
                break;
            }
        }
        NGUITools.SetActive(GameController.instance.mobWindow, false);

        // Talents
        i = 0;
        foreach (Talent[] talents in TalentWindow.instance.allTalents)
        {
            for (int j = 0; j < 9; j++)
            {
                talents[j].active = savedGame.talents[i][j] == 1;
            }
            i++;
        }

        NGUITools.SetActive(GameController.instance.loadingWindow, false);
    }