Esempio n. 1
0
    private IEnumerator MimaxFollowersWillNowLeave()
    {
        int TotalMimaxFollowers = 0;

        foreach (var o in NPCSystem.followers)
        {
            if (o.Type == "M")
            {
                TotalMimaxFollowers++;
            }
        }

        int[] MimaxIDs = new int[TotalMimaxFollowers];

        foreach (var o in NPCSystem.followers)
        {
            if (o.Type == "M")
            {
                for (int i = 0; i < TotalMimaxFollowers; i++)
                {
                    MimaxIDs[i] = o.id;
                }
            }
        }
        if (MimaxIDs.Length > 0 && MimaxIDs != null)
        {
            int MimaxIDIndexToLeave = Random.Range(0, MimaxIDs.Length - 1);
            int MimaxIDToLeave      = MimaxIDs[MimaxIDIndexToLeave];

            NPCSystem.removeFollower(MimaxIDToLeave);
            BaseHealthObj.GetComponent <BaseHealth>().BaseHealthCalc();
        }
        yield return(new WaitForSeconds(5f));
    }
Esempio n. 2
0
    public void addNPCtoHouseSecondButton()
    {
        int i = 1;

        npcApplicant.text = ApplicantList[i].name.ToString() + " Moved In";
        applicantName[0]  = ApplicantList[i].name.ToString();

        button1.gameObject.SetActive(false);
        button2.gameObject.SetActive(false);

        statsUI.SetActive(true);
        assignList.SetActive(false);

        ApplicantList[i].status  = "idle";
        ApplicantList[i].houseId = FindObjectOfType <BB_House>().GetHouseID();

        NPCSystem.addFollower(ApplicantList[i].name,
                              ApplicantList[i].type,
                              ApplicantList[i].classType,
                              ApplicantList[i].secItem,
                              ApplicantList[i].priItem,
                              ApplicantList[i].status,
                              ApplicantList[i].houseId);

        FindObjectOfType <BB_GlobalStats>().addToPopulation();

        FindObjectOfType <BaseHealth>().BaseHealthCalc();

        changeSpirte();
    }
Esempio n. 3
0
    public static void MiniBDamage()
    {
        NPC      = new NPCSystem();
        baseHlth = new BaseHealth();
        foreach (var o in NPCSystem.followers)
        {
            if (BB_BasicControls.OutpBuilt != 10)
            {
                if (GameObject.FindGameObjectsWithTag("House").Length > 0)
                {
                    num = (BB_BasicControls.houseBuilt / 2);
                    n   = Mathf.Round(num);

                    if (o.Status == "House")
                    {
                        if (n > 0)
                        {
                            GameObject house = GameObject.FindWithTag("House");
                            Destroy(house);
                            destroyedbuilds++;
                            n--;
                            NPCSystem.removeFollower(o.Id);
                            baseHlth.BaseHealthCalc();
                        }
                    }
                }
                if (GameObject.FindGameObjectsWithTag("Outpost").Length > 0)
                {
                    num1 = (BB_BasicControls.OutpBuilt / 2);
                    n1   = Mathf.Round(num1);
                    if (o.Status == "Outpost")
                    {
                        if (n1 > 0)
                        {
                            GameObject outpost = GameObject.FindWithTag("Outpost");
                            Destroy(outpost);
                            destroyedbuilds++;
                            n1--;
                            NPCSystem.removeFollower(o.Id);
                            baseHlth.BaseHealthCalc();
                        }
                    }
                }
                tags = arr[Random.Range(0, 1)];
                if (o.Status == tags)
                {
                    if (GameObject.FindGameObjectsWithTag(tags).Length > 0)
                    {
                        GameObject building = GameObject.FindWithTag(tags);
                        Destroy(building);
                        destroyedbuilds++;
                        NPCSystem.removeFollower(o.Id);
                        baseHlth.BaseHealthCalc();
                    }
                }
            }
        }
    }
Esempio n. 4
0
    public static void WeatherDamage()
    {
        //NPC = new NPCSystem();
        baseHlth = new BaseHealth();
        foreach (var o in NPCSystem.followers)
        {
            //if (o.Type == "Nomad")
            if (o.Status == "Barracks")
            {
                if (o.Type != "Nomad")

                {
                    if (GameObject.FindGameObjectsWithTag("Barracks").Length > 0)
                    {
                        //if (BB_GlobalStats.UpgradedWorkshop < 2)
                        {
                            GameObject barracks = GameObject.FindWithTag("Barracks");
                            Destroy(barracks);
                            destroyedbuilds++;
                            //destroyedbuilds = destroyedbuilds + 1;
                            NPCSystem.removeFollower(o.Id);
                            baseHlth.BaseHealthCalc();
                        }
                    }
                }
            }

            //if (o.Type == "Ferrarium")
            if (o.Status == "Market")
            {
                if (o.Type != "Ferrarium")

                {
                    if (GameObject.FindGameObjectsWithTag("Market").Length > 0)
                    {
                        //if (BB_GlobalStats.UpgradedMarket < 2)
                        {
                            GameObject market = GameObject.FindWithTag("Market");
                            Destroy(market);
                            destroyedbuilds++;
                            NPCSystem.removeFollower(o.Id);
                            baseHlth.BaseHealthCalc();
                        }
                    }
                }
            }
            //if (o.Type == "Froot")
            if (o.Status == "Farm")
            {
                if (o.Type != "Froot")

                {
                    if (GameObject.FindGameObjectsWithTag("Farm").Length > 0)
                    {
                        //if (BB_GlobalStats.UpgradedFarms < 2)
                        {
                            GameObject farm = GameObject.FindWithTag("Farm");
                            Destroy(farm);
                            destroyedbuilds++;
                            NPCSystem.removeFollower(o.Id);
                            baseHlth.BaseHealthCalc();
                        }
                    }
                }
            }

            //if (o.Type == "Mimax")
            if (o.Status == "Workshop")
            {
                if (o.Type != "Mimax")

                {
                    if (GameObject.FindGameObjectsWithTag("Workshop").Length > 0)
                    {
                        //if (BB_GlobalStats.upgradeBarracks < 2)
                        {
                            GameObject workshop = GameObject.FindWithTag("Workshop");
                            Destroy(workshop);
                            destroyedbuilds++;
                            NPCSystem.removeFollower(o.Id);
                            baseHlth.BaseHealthCalc();
                        }
                    }
                }
            }



            if (GameObject.FindGameObjectsWithTag("House").Length > 0)
            {
                if (o.Status == "House")
                {
                    if (o.Status != "idle")
                    {
                        //if (BB_GlobalStats.UpgradedHouses < 2)
                        {
                            GameObject house = GameObject.FindWithTag("House");
                            Destroy(house);
                            destroyedbuilds++;
                            NPCSystem.removeFollower(o.Id);
                            baseHlth.BaseHealthCalc();
                        }
                    }
                }
            }
        }
    }