コード例 #1
0
    /// <summary>
    /// Removes an occupant, but does not specify the "available space" that this "house" posseses to the manager.
    /// </summary>
    /// <returns>Refugee removed</returns>
    public override Refugee RemoveOccupant()
    {
        if (GetOccupantCount() == 0)
        {
            Debug.LogError("No Occupants to remove");
            return(null);
        }

        Refugee _r = occupants[0];

        occupants.Remove(_r);
        _r.SetHouse(null);
        return(_r);
    }
コード例 #2
0
ファイル: House.cs プロジェクト: tejas4197/SE410Test
    /// <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);
    }
コード例 #3
0
ファイル: House.cs プロジェクト: tejas4197/SE410Test
    /// <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());
        }
    }
コード例 #4
0
 /// <summary>
 /// Adds an occupant, but does not specify the "available space" that this "house" posseses to the manager.
 /// </summary>
 /// <param name="_r">Refugee to add.</param>
 public override void AddOccupant(Refugee _r)
 {
     occupants.Add(_r);
     _r.SetHouse(this);
 }