示例#1
0
    public void GetGoods(IntPoint2D startingTile, Stack <IntPoint2D> path, StoreManager storeMgr, ScenarioData scenarioInfo)
    {
        GameObject level = GameObject.FindWithTag("GameController");

        WalkerPool pool = level.GetComponent("WalkerPool") as WalkerPool;

        GameObject citizen = pool.GetCitizen(startingTile, ScenarioMgr.Direction.Up);

        CitizenManager citMgr = citizen.GetComponent("CitizenManager") as CitizenManager;

        citMgr.SetUp(scenarioInfo, startingTile, ScenarioMgr.Direction.Up, path, storeMgr, this);
    }
    IEnumerator InitPopulation()
    {
        yield return(0);

        for (int i = 0; i < homeless; i++)
        {
            GameObject     citizen = walkerPool.GetCitizen(startTile, ScenarioMgr.Direction.Right);
            CitizenManager mgr     = citizen.GetComponent("CitizenManager") as CitizenManager;
            mgr.SetUp(scenario, startTile, ScenarioMgr.Direction.Right, true, startTile, null, false);
            homelessCollection.Enqueue(mgr);
            yield return(0);
        }
        StartCoroutine("PopulationUpdate");
    }
    public void RemoveHouse(IntPoint2D tileLoc)
    {
        HouseManager house;

        if (houseCollection.TryGetValue(tileLoc, out house))
        {
            int pop = house.GetPop();
            homeless = homeless + pop;
            for (int i = 0; i < pop; i++)
            {
                GameObject     citizen = walkerPool.GetCitizen(tileLoc, ScenarioMgr.Direction.Left);
                CitizenManager mgr     = citizen.GetComponent("CitizenManager") as CitizenManager;
                mgr.SetUp(scenario, tileLoc, ScenarioMgr.Direction.Right, true, startTile, null, false);
                homelessCollection.Enqueue(mgr);
            }
            houseCollection.Remove(tileLoc);
            homelessInfoText.text = "Homeless:  " + homeless;
        }
    }