Exemple #1
0
    private int GetAmountCraftable(RARC_Crafting_SO craftingSO)
    {
        int amount = 0;

        switch (craftingSO.resourceType)
        {
        case RARC_Resource.ResourceType.Food:
            amount = RARC_GameStateController.Instance.currentCraftingPerTurn_Food;
            break;

        case RARC_Resource.ResourceType.Fuel:
            amount = RARC_GameStateController.Instance.currentCraftingPerTurn_Fuel;
            break;

        case RARC_Resource.ResourceType.Organics:
            amount = RARC_GameStateController.Instance.currentCraftingPerTurn_Organics;
            break;

        default:
            if (craftingSO.crewPerCraft != 0)
            {
                amount = RARC_GameStateController.Instance.currentCraftingPerTurn_Crew;
            }
            else if (craftingSO.botsPerCraft != 0)
            {
                amount = RARC_GameStateController.Instance.currentCraftingPerTurn_Bots;
            }
            break;
        }

        return(amount);
    }
Exemple #2
0
    /////////////////////////////////////////////////////////////////

    public void SetupTab(RARC_Crafting_SO newCraftingSO)
    {
        //Setup Info
        craftingSO = newCraftingSO;

        //Set name
        if (newCraftingSO.resourceType != RARC_Resource.ResourceType.NULL)
        {
            name_Text.text = craftingSO.resourceType.ToString();;
        }
        else if (craftingSO.crewPerCraft != 0)
        {
            name_Text.text = "Crewmate";
        }
        else if (craftingSO.botsPerCraft != 0)
        {
            name_Text.text = "Robot";
        }

        //Change Icon
        craftingIcon.sprite = craftingSO.craftingSprite;


        //Setup Tab
        List <RARC_Resource> resourcesRequired_List = GetResourcesList();

        requirementsTab.SetupTab(resourcesRequired_List, RARC_ButtonController_Game.Instance.colorValues_Red, RARC_ButtonController_Game.Instance.colorValues_White);

        //Text
        craftingResourceCurrent_Text.text = "Current: " + RARC_GameStateController.Instance.GetResoucesCount(craftingSO.resourceType) + "\n(+" + craftingSO.resourcePerCraft + ")";

        //Room Counting
        if (RARC_GameStateController.Instance.CountRoomsOnShip(craftingSO.roomRequired) <= 0)
        {
            gameObject.GetComponent <Button>().interactable = false;
            craftingRoomsCurrent_Text.text = craftingSO.roomRequired.ToString() + " Rooms: " + "<color=" + RARC_ButtonController_Game.Instance.colorValues_Red + ">" + RARC_GameStateController.Instance.CountRoomsOnShip(craftingSO.roomRequired) + "</color>";
        }
        else
        {
            craftingRoomsCurrent_Text.text = craftingSO.roomRequired.ToString() + " Rooms: " + "<color=" + RARC_ButtonController_Game.Instance.colorValues_White + ">" + RARC_GameStateController.Instance.CountRoomsOnShip(craftingSO.roomRequired) + "</color>";
        }

        //Allowed Amount For Crafting
        if (GetAmountCraftable(craftingSO) <= 0)
        {
            gameObject.GetComponent <Button>().interactable = false;
            craftingRemainingCurrent_Text.text = "Capacity Remaining: " + "<color=" + RARC_ButtonController_Game.Instance.colorValues_Red + ">" + GetAmountCraftable(craftingSO).ToString() + "</color>";
        }
        else
        {
            craftingRemainingCurrent_Text.text = "Capacity Remaining: " + "<color=" + RARC_ButtonController_Game.Instance.colorValues_White + ">" + GetAmountCraftable(craftingSO).ToString() + "</color>";
        }
    }