public void setTownActionInfo(HumanTownController town)
 {
     partialFeed.text = "Kill " + town.populationPartialLoss + " to restore " + town.partialFeedAmt + " hunger " + "("
                        + town.partialFeedThreat + " Threat)";
     fullFeed.text = "Kill " + town.populationFullLoss + " to restore " + town.fullFeedAmt + " hunger " + "("
                     + town.fullFeedThreat + " Threat)";
     convert.text = "Convert 1 human to a unit (" + town.convertThreat + " - " + (town.convertThreat + 10) + ")";
 }
Esempio n. 2
0
    // Show description of selected object, remove description box if no item is selected
    public void SetObjText()
    {
        if (selectedObj != null)
        {
            selectedObjectPanel.SetActive(true);
            if (selectedObj.layer == LayerMask.NameToLayer("Resource"))
            {
                ResourceController resource = selectedObj.GetComponentInChildren <ResourceController>();
                actionButtonInfo.setResourceActionInfo(resource);
                selectedObjText.text =
                    selectedObj.tag + "\n"
                    + resource.currentResourceAmt + " " + selectedObj.tag + " available" + "\n"
                    + "Respawns after " + resource.timeToRespawn / Timer._instance.secondsInFullDay + " days";
            }

            if (selectedObj.tag == "HumanTown")
            {
                HumanTownController humanTown = selectedObj.GetComponent <HumanTownController>();
                actionButtonInfo.setTownActionInfo(humanTown);
                if (humanTown.beingSubjugated)
                {
                    Debug.Log("Town selected, yes subjugation");
                    selectedObjText.text =
                        "Human Town" + "\n"
                        + "Population: " + (int)humanTown.population + "\n"
                        + "<b>Can feed to restore hunger or kidnap and convert a human. All actions increase threat level</b>" + "\n"
                        + "Subjugation level: " + humanTown.subjugationLevel + "/" + humanTown.subjugationLimit;
                }
                else if (humanTown.subjugationFinished)
                {
                    Debug.Log("Town selected, yes subjugation");
                    selectedObjText.text =
                        "Human Town" + "\n"
                        + "Population: " + (int)humanTown.population + "\n"
                        + "<b>Can feed to restore hunger or kidnap and convert a human. All actions increase threat level</b>" + "\n"
                        + "<b>Subjugated: provides small regeneration to your hunger</b>";
                }
                else if (!humanTown.subjugationFinished)
                {
                    Debug.Log("Town selected, no subjugation");
                    selectedObjText.text =
                        "Human Town" + "\n"
                        + "Population: " + (int)humanTown.population + "\n"
                        + "<b>Can feed to restore hunger or kidnap and convert a human. All actions increase threat level</b>";
                }
            }

            if (selectedObj.tag == "HumanBase")
            {
                selectedObjText.text =
                    "Main Human Base" + "\n"
                    + "Will send out attacks against you based on your level of threat" + "\n"
                    + "<b>Can be subjugated after all towns are subjugated</b>" + "\n"
                    + "<b>Base repair cost: 3 wood and 3 stone per health point</b>";
            }

            if (selectedObj.tag == "Base")
            {
                actionButtonInfo.setRepairActionInfo();
                selectedObjText.text =
                    "Main Base" + "\n"
                    + "Health: " + BaseController._instance.health + "\n"
                    + "Attack level: " + BaseController._instance.attack + "\n"
                    + "Defense level: " + BaseController._instance.defense + "\n";
            }

            if (selectedObj.tag == "Enemy")
            {
                EnemyController enemy = selectedObj.GetComponent <EnemyController>();
                selectedObjText.text =
                    "Enemy" + "\n"
                    + "Health: " + enemy.health + "\n"
                    + "Attack level: " + enemy.attack;
            }
        }
        else
        {
            selectedObjText.text = "";
            selectedObjectPanel.SetActive(false);
            Debug.Log("remove text");
        }
    }
Esempio n. 3
0
    // Brings up action buttons based on what object is selected
    public void SetActionButton()
    {
        if (selectedObj != null)
        {
            if (selectedObj.tag == "HumanTown")
            {
                HumanTownController town = selectedObj.GetComponent <HumanTownController>();
                if (!SceneController.Instance.togglePause)
                {
                    foreach (Button btn in townActionBtns)
                    {
                        btn.interactable = (town.population > 0);
                    }
                }
                else
                {
                    foreach (Button btn in townActionBtns)
                    {
                        btn.interactable = false;
                    }
                }

                if (town.population <= 0)
                {
                    PopupController._instance.SetPopupText("No population to perform actions on");
                }

                resourceActionBtn.gameObject.SetActive(false);
                repairActionsContainer.SetActive(false);
                mainHumanBaseSubjugateBtn.gameObject.SetActive(false);
                townActionsContainer.SetActive(true);
                if (!SceneController.Instance.togglePause)
                {
                    if (!Subjugation._instance.researched)
                    {
                        townActionBtns[3].interactable = false;
                    }
                    else if (Subjugation._instance.researched && !town.subjugationFinished)
                    {
                        townActionBtns[3].interactable = true;
                    }
                    else if (Subjugation._instance.researched && town.subjugationFinished)
                    {
                        townActionBtns[3].interactable = false;
                    }
                }
                else
                {
                    townActionBtns[3].interactable = false;
                }
                //BaseController._instance.HideCanvas();
            }
            else if (selectedObj.tag == "HumanBase")
            {
                Debug.Log("blah");
                townActionsContainer.SetActive(false);
                resourceActionBtn.gameObject.SetActive(false);
                repairActionsContainer.SetActive(false);
                mainHumanBaseSubjugateBtn.gameObject.SetActive(true);
                if (!SceneController.Instance.togglePause)
                {
                    mainHumanBaseSubjugateBtn.interactable = (subjugatedHumanTowns == totalHumanTowns);
                }
                else
                {
                    mainHumanBaseSubjugateBtn.interactable = false;
                }
            }
            else if (selectedObj.tag == "Base")
            {
                townActionsContainer.SetActive(false);
                resourceActionBtn.gameObject.SetActive(false);
                repairActionsContainer.SetActive(true);
                if (!SceneController.Instance.togglePause)
                {
                    foreach (Button btn in repairActionBtns)
                    {
                        btn.interactable = (!selectedObj.GetComponent <BaseController>().IsFullHealth() && (ResourceStorage._instance.wood >= 3 && ResourceStorage._instance.stone >= 3));
                    }
                }
                else
                {
                    foreach (Button btn in repairActionBtns)
                    {
                        btn.interactable = false;
                    }
                }

                mainHumanBaseSubjugateBtn.gameObject.SetActive(false);
                //BaseController._instance.ShowCanvas();
            }
            else if (selectedObj.layer == LayerMask.NameToLayer("Resource"))
            {
                townActionsContainer.SetActive(false);
                repairActionsContainer.SetActive(false);
                resourceActionBtn.gameObject.SetActive(true);
                mainHumanBaseSubjugateBtn.gameObject.SetActive(false);
                if (!SceneController.Instance.togglePause)
                {
                    resourceActionBtn.interactable = true;
                }
                else
                {
                    resourceActionBtn.interactable = false;
                }
                //BaseController._instance.HideCanvas();
            }
        }
        else
        {
            townActionsContainer.SetActive(false);
            repairActionsContainer.SetActive(false);
            resourceActionBtn.gameObject.SetActive(false);
            mainHumanBaseSubjugateBtn.gameObject.SetActive(false);
            //BaseController._instance.HideCanvas();
        }
    }