Example #1
0
    public void reloadSprites()
    {
        switch (ProgressionScript.getCockpit())
        {
        case 0: cockpit.GetComponent <Image>().sprite = cockpit0; break;

        case 1: cockpit.GetComponent <Image>().sprite = cockpit1; break;

        case 2: cockpit.GetComponent <Image>().sprite = cockpit2; break;
        }

        switch (ProgressionScript.getReactor())
        {
        case 0: reactor.GetComponent <Image>().sprite = reactor0; break;

        case 1: reactor.GetComponent <Image>().sprite = reactor1; break;

        case 2: reactor.GetComponent <Image>().sprite = reactor2; break;

        case 3: reactor.GetComponent <Image>().sprite = reactor3; break;

        case 4: reactor.GetComponent <Image>().sprite = reactor4; break;
        }

        switch (ProgressionScript.getRoom1())
        {
        case 0: room1.GetComponent <Image>().sprite = room1_0; break;

        case 1: room1.GetComponent <Image>().sprite = room1_1; break;

        case 2: room1.GetComponent <Image>().sprite = room1_2; break;

        case 3: room1.GetComponent <Image>().sprite = room1_3; break;

        case 4: room1.GetComponent <Image>().sprite = room1_4; break;
        }

        switch (ProgressionScript.getRoom2())
        {
        case 0: room2.GetComponent <Image>().sprite = room2_0; break;

        case 1: room2.GetComponent <Image>().sprite = room2_1; break;

        case 2: room2.GetComponent <Image>().sprite = room2_2; break;

        case 3: room2.GetComponent <Image>().sprite = room2_3; break;

        case 4: room2.GetComponent <Image>().sprite = room2_4; break;
        }

        switch (ProgressionScript.getRoom3())
        {
        case 0: room3.GetComponent <Image>().sprite = room3_0; break;

        case 1: room3.GetComponent <Image>().sprite = room3_1; break;

        case 2: room3.GetComponent <Image>().sprite = room3_2; break;

        case 3: room3.GetComponent <Image>().sprite = room3_3; break;

        case 4: room3.GetComponent <Image>().sprite = room3_4; break;
        }

        switch (ProgressionScript.getRoom4())
        {
        case 0: room4.GetComponent <Image>().sprite = room4_0; break;

        case 1: room4.GetComponent <Image>().sprite = room4_1; break;

        case 2: room4.GetComponent <Image>().sprite = room4_2; break;

        case 3: room4.GetComponent <Image>().sprite = room4_3; break;

        case 4: room4.GetComponent <Image>().sprite = room4_4; break;
        }

        switch (ProgressionScript.getRoom5())
        {
        case 0: room5.GetComponent <Image>().sprite = room5_0; break;

        case 1: room5.GetComponent <Image>().sprite = room5_1; break;

        case 2: room5.GetComponent <Image>().sprite = room5_2; break;

        case 3: room5.GetComponent <Image>().sprite = room5_3; break;

        case 4: room5.GetComponent <Image>().sprite = room5_4; break;
        }

        switch (ProgressionScript.getRoom6())
        {
        case 0: room6.GetComponent <Image>().sprite = room6_0; break;

        case 1: room6.GetComponent <Image>().sprite = room6_1; break;

        case 2: room6.GetComponent <Image>().sprite = room6_2; break;

        case 3: room6.GetComponent <Image>().sprite = room6_3; break;

        case 4: room6.GetComponent <Image>().sprite = room6_4; break;
        }
    }
Example #2
0
    public void showDialogue(int index)
    {
        Debug.Log("fired at " + index);
        hideAllDialogues();

        GameObject panel = ((GameObject)dialogues[index]).transform.GetChild(0).gameObject.transform.GetChild(0).gameObject;

        ((GameObject)dialogues[index]).transform.GetChild(0).gameObject.SetActive(true);
        TextMeshProUGUI canPurchase = panel.transform.GetChild(2).GetComponent <TextMeshProUGUI>();
        Inventory       costInv     = null;
        Button          b           = panel.transform.GetChild(3).GetComponent <Button>();
        int             i           = 0;
        bool            maxLevel    = false;

        switch (index)
        {
        case 0:
            i       = ProgressionScript.getReactor();
            costInv = CostScript.getCost("reactor", i + 1);
            if (i >= 4)
            {
                maxLevel = true;
            }
            break;

        case 1:
            i       = ProgressionScript.getCockpit();
            costInv = CostScript.getCost("cockpit", i + 1);
            if (i >= 2)
            {
                maxLevel = true;
            }
            break;

        case 2:
            i       = ProgressionScript.getRoom1();
            costInv = CostScript.getCost("room1", i + 1);
            if (i >= 4)
            {
                maxLevel = true;
            }
            break;

        case 3:
            i       = ProgressionScript.getRoom2();
            costInv = CostScript.getCost("room2", i + 1);
            if (i >= 4)
            {
                maxLevel = true;
            }
            break;

        case 4:
            i       = ProgressionScript.getRoom3();
            costInv = CostScript.getCost("room3", i + 1);
            if (i >= 4)
            {
                maxLevel = true;
            }
            break;

        case 5:
            i       = ProgressionScript.getRoom4();
            costInv = CostScript.getCost("room4", i + 1);
            if (i >= 4)
            {
                maxLevel = true;
            }
            break;

        case 6:
            i       = ProgressionScript.getRoom5();
            costInv = CostScript.getCost("room5", i + 1);
            if (i >= 4)
            {
                maxLevel = true;
            }
            break;

        case 7:
            i       = ProgressionScript.getRoom6();
            costInv = CostScript.getCost("room6", i + 1);
            if (i >= 4)
            {
                maxLevel = true;
            }
            break;
        }

        if (MapGeneratorScript.inventory.containsInventory(costInv))
        {
            canPurchase.text = "You can purchase this upgrade";
            b.interactable   = true;
        }
        else
        {
            canPurchase.text = "You cannot purchase this upgrade";
            b.interactable   = false;
        }

        panel.transform.GetChild(1).GetComponent <TextMeshProUGUI>().text = "Cost: " + costInv.listInventory();
        panel.transform.GetChild(3).gameObject.transform.GetChild(0).GetComponent <TextMeshProUGUI>().text = "Upgrade to level " + (i + 1);

        if (maxLevel)
        {
            canPurchase.text = "You have already reached max level";
            panel.transform.GetChild(3).gameObject.transform.GetChild(0).GetComponent <TextMeshProUGUI>().text = "Maxed out";
            b.interactable = false;
        }
    }