Example #1
0
 /// <summary>
 /// Assigns references and begins the restore hydration process.
 /// </summary>
 void Start()
 {
     cachedTransform = transform;
     refugeeManager  = RefugeeManager.GetInstance();
     housingManager  = HousingManager.GetInstance();
     //StartCoroutine(RestoreHydrationUpdate(RefugeeManager.GetInstance().GetUpdateHealthTimer()));
 }
Example #2
0
    private void Start()
    {
        m_moneyManager   = FindObjectOfType <MoneyManager>();
        m_housingManager = FindObjectOfType <HousingManager>();

        Charge = ChargeCapacity;
    }
Example #3
0
    protected override void Awake()
    {
        base.Awake();

        m_housingManager = FindObjectOfType <HousingManager>();

        UpdateHouses();
    }
Example #4
0
    private void Awake()
    {
        m_moneyManager        = FindObjectOfType <MoneyManager>();
        m_housingManager      = FindObjectOfType <HousingManager>();
        m_distributionManager = FindObjectOfType <DistributionManager>();
        m_researchManager     = FindObjectOfType <ResearchManager>();
        m_fabricatorManager   = FindObjectOfType <FabricatorManager>();

        m_saveManager = FindObjectOfType <SaveManager>();
        m_saveManager.OnDataLoaded += OnDataLoaded;
    }
Example #5
0
    private void Awake()
    {
        m_distributionManager = FindObjectOfType <DistributionManager>();
        m_moneyManager        = FindObjectOfType <MoneyManager>();
        m_housingManager      = FindObjectOfType <HousingManager>();
        m_fabricatorManager   = FindObjectOfType <FabricatorManager>();
        m_researchManager     = FindObjectOfType <ResearchManager>();

        m_mainFilePath     = Path.Combine(Application.persistentDataPath, FILE_NAME);
        m_vehiclesSavePath = Path.Combine(Application.persistentDataPath, VEHICLES_FILE_NAME);
        m_housesSavePath   = Path.Combine(Application.persistentDataPath, HOUSES_FILE_NAME);
        m_researchSavePath = Path.Combine(Application.persistentDataPath, RESEARCH_FILE_NAME);
    }
Example #6
0
    /// <summary>
    /// Waits for the construction to finish.
    /// </summary>
    /// <returns></returns>
    protected override IEnumerator BuildingConstructionBegin()
    {
        yield return(new WaitForTicks(constructionTime));

        HousingManager housingManager = HousingManager.GetInstance();
        float          distance;

        for (int i = 0; i < housingManager.GetHousesCount(); ++i)
        {
            distance = Vector3.Distance(housingManager.GetHouseAtIndex(i).cachedTransform.position, cachedTransform.position);
            if (distance < maxRadius)
            {
                housingManager.GetHouseAtIndex(i).AddWaterSource(health);
            }
        }
    }
Example #7
0
 /// <summary>
 /// Sets the refugees house that they live in. If they are in the HomelessHouse, it lets the housing manager know that they are homeless.
 /// </summary>
 /// <param name="_h">House to live in</param>
 public void SetHouse(Building _h)
 {
     if (_h == null)
     {
         SetNewDestination(GameManager.GetInstance().receptionCenter.cachedTransform.position);
         return;
     }
     if (_h.GetType() == typeof(HomelessHouse))
     {
         HousingManager.GetInstance().EnqueueHomeless(this);
     }
     else
     {
         house = (House)_h;
     }
     SetNewDestination(_h.cachedTransform.position);
 }
Example #8
0
    private IEnumerator ProcessAllRefugees()
    {
        while (true)
        {
            if (queue.Count == 0)
            {
                yield return(new WaitForTicks(1));
            }
            else
            {
                Refugee current = queue.Dequeue();
                current.SetNewDestination(lineStartPos);
                yield return(new WaitForTicks(timeToProcess));

                current.SetNewDestination(finishedProcessingPos);
                HousingManager.GetInstance().GetBestHouse().AddOccupant(current);
            }
        }
    }
Example #9
0
    /// <summary>
    /// Removes a refugee from this house.
    /// </summary>
    /// <returns>Refugee removed.</returns>
    public virtual Refugee RemoveOccupant()
    {
        if (GetOccupantCount() == 0)
        {
            Debug.LogError("No Occupants to remove");
            return(null);
        }

        Refugee _r = occupants[0];

        occupants.Remove(_r);
        _r.SetHouse(null);

        if (GetOccupantCount() < prefOccupancy)
        {
            HousingManager.GetInstance().AddBelowPrefOccupants(GetHashVal(), this);
            HousingManager.GetInstance().RemoveBelowMaxOccupants(GetHashVal());
        }
        else if (GetOccupantCount() < maxOccupancy)
        {
            HousingManager.GetInstance().AddBelowMaxOccupants(GetHashVal(), this);
        }
        return(_r);
    }
Example #10
0
    /// <summary>
    /// Adds occupant _r into this house.
    /// </summary>
    /// <param name="_r">Refugee to add to this house.</param>
    public virtual void AddOccupant(Refugee _r)
    {
        if (maxOccupancy == GetOccupantCount())
        {
            Debug.LogError(gameObject.name + " is already a full house.");
            return;
        }

        occupants.Add(_r);
        _r.SetHouse(this);
        if (GetOccupantCount() < prefOccupancy)
        {
            HousingManager.GetInstance().AddBelowPrefOccupants(GetHashVal(), this);
        }
        else if (GetOccupantCount() < maxOccupancy)
        {
            HousingManager.GetInstance().RemoveBelowPrefOccupants(GetHashVal());
            HousingManager.GetInstance().AddBelowMaxOccupants(GetHashVal(), this);
        }
        else
        {
            HousingManager.GetInstance().RemoveBelowMaxOccupants(GetHashVal());
        }
    }
Example #11
0
 private void Awake()
 {
     m_housingManager      = FindObjectOfType <HousingManager>();
     m_distributionManager = FindObjectOfType <DistributionManager>();
 }
Example #12
0
    /// <summary>
    /// Waits for construction to finish and tells the HousingManager that it is ready.
    /// </summary>
    /// <returns></returns>
    protected override IEnumerator BuildingConstructionBegin()
    {
        yield return(new WaitForTicks(constructionTime));

        HousingManager.GetInstance().NewHouseBuilt(this);
    }
    public PlayerData(GameManager gameManager, VampireManager vampireManager, EfficiencyUpgrades efficiencyUpgrades, HousingManager housingManager, LaborManager laborManager)
    {
        //Data is commented for easy tracing and readability

        #region Resources

        res_Blood    = gameManager.res_Blood;    //Blood
        res_HumanPop = gameManager.res_HumanPop; //Human Population
        res_Wood     = gameManager.res_Wood;     //Wood
        res_Stone    = gameManager.res_Stone;    //Stone

        #endregion Resources

        #region Vampire Data

        for (int a = 0; a < 10; a++)
        {
            vampires_amount_Total[a] = vampireManager.vampires_amount_Total[a];           //Amount of total vampires of each tier
            vampires_unlocked[a]     = vampireManager.vampires_unlocked[a];               //State of the lock for vampire buttons in Lair Tab

            slider_savedMaxValueFeed[a]   = vampireManager.slider_savedMaxValueFeed[a];   //Saved max slider value of feed of each vampire window
            slider_savedMaxValueInfect[a] = vampireManager.slider_savedMaxValueInfect[a]; //Saved max slider value of infect of each vampire window
            slider_usedFeed[a]            = vampireManager.slider_usedFeed[a];            //Current allocated slider value of feed
            slider_usedInfect[a]          = vampireManager.slider_usedInfect[a];          //Current allocated slider value of infect

            level_SharpenFang[a]  = efficiencyUpgrades.level_SharpenFang[a];
            level_TrainAgility[a] = efficiencyUpgrades.level_TrainAgility[a];
        }

        #endregion Vampire Data

        #region Housing

        for (int a = 0; a < 10; a++)
        {
            vamp_housing_buildingAmount[a]  = housingManager.vamp_housing_buildingAmount[a];
            human_housing_buildingAmount[a] = housingManager.human_housing_buildingAmount[a];
        }

        #endregion Housing

        #region Labor

        fledgelings_used_wood  = laborManager.fledgelings_used_wood;
        fledgelings_used_stone = laborManager.fledgelings_used_stone;

        #endregion Labor
    }