void ClearTrackers()
 {
     res     = null;
     com     = null;
     ind     = null;
     off     = null;
     indc    = null;
     fol     = null;
     serv    = null;
     tracker = null;
 }
    public void removeResidential(GameObject removeObject)
    // Removes residential building
    {
        Debug.Log("Removing...");
        ResidentialTracker temp = removeObject.GetComponent <ResidentialTracker>();

        EconomyManager.ecoTick -= temp.UpdateSecond;
        residentialCap         -= removeObject.GetComponent <ResidentialTracker>().GetCapacity();
        temp.RemoveAllUsers();
        populationManager.DeallocateUsers(temp.users, "residential");
        numResidential--;
        residential.Remove(removeObject);
    }
Beispiel #3
0
 // Use this for initialization
 void Start()
 {
     if (Serializer.IsDeserializing)
     {
         return;
     }
     if (Serializer.IsLoading)
     {
         return;
     }
     residentialTracker = GetComponent <ResidentialTracker>();
     referencesUpdated  = false;
     stareat            = GameObject.Find("Camera (eye)").transform;
 }
 void AcceptApplication(ResidentialTracker applicantTracker)
 {
     if (!applicantTracker.isActiveAndEnabled)
     {
         return;
     }
     if (applicantTracker.unemployedPopulation >= 1)
     {
         AddUsers(1);
         employees.Add(applicantTracker);
         applicantTracker.AcceptApplication();
     }
     else
     {
         RejectApplication(applicantTracker);
     }
 }
Beispiel #5
0
 void AcceptApplication(ResidentialTracker applicantTracker)
 {
     if (applicantTracker.unemployedPopulation >= 1 && !Serializer.IsLoading)
     {
         AddUsers(1);
         employees.Add(applicantTracker);
         applicantTracker.AcceptApplication();
     }
     else if (Random.Range(0, 5) > 3 && !Serializer.IsLoading)
     {
         AcceptApplication(applicantTracker);
     }
     else
     {
         RejectApplication(applicantTracker);
     }
 }
Beispiel #6
0
    public void Apply(float applicantLandValue, ResidentialTracker applicantTracker)
    {
        double u1            = 1.0 - rand.NextDouble(); //uniform(0,1] random doubles
        double u2            = 1.0 - rand.NextDouble();
        double randStdNormal = Mathf.Sqrt(-2.0f * Mathf.Log((float)u1)) *
                               Mathf.Sin(2.0f * Mathf.PI * (float)u2); //random normal(0,1)
        double randNormal =
            landValue - 5 + 5 * randStdNormal;                         //random normal(mean,stdDev^2)

        if (usable && users < capacity)                                // TODO: ADD LAND VALUE CHECKS BACK IN
        {
            AcceptApplication(applicantTracker);
        }
        else
        {
            RejectApplication(applicantTracker);
        }
    }
    public void Apply(float applicantLandValue, ResidentialTracker applicantTracker)
    {
        // TODO: the application is considered by the tracker, and the value of residential land has
        // an impact on the final decision, along with an element of chance
        float landValueDifference = landValue - applicantLandValue;

        landValueDifference = Mathf.Abs(landValueDifference);
        if (landValueDifference < landValue / 3 && usable && users < capacity && !Serializer.IsLoading)
        {
            AcceptApplication(applicantTracker);
        }
        else if (Random.Range(0, 5) > 3 && !Serializer.IsLoading)
        {
            AcceptApplication(applicantTracker);
        }
        else
        {
            RejectApplication(applicantTracker);
        }
    }
 void SetTracker()
 {
     ClearTrackers();
     tracker = containedBuilding.GetComponent <ItemTracker>();
     if (containedType == 0)
     {
         res        = containedBuilding.GetComponent <ResidentialTracker>();
         res.usable = false;
     }
     else if (containedType == 1)
     {
         com        = containedBuilding.GetComponent <CommercialTracker>();
         com.usable = false;
     }
     else if (containedType == 2)
     {
         ind        = containedBuilding.GetComponent <IndustrialTracker>();
         ind.usable = false;
     }
     else if (containedType == 3)
     {
         off        = containedBuilding.GetComponent <CommercialTracker>();
         off.usable = false;
     }
     else if (containedType == 4)
     {
         indc        = containedBuilding.GetComponent <IndustrialComponent>();
         indc.usable = false;
     }
     else if (containedType == 5)
     {
         fol        = containedBuilding.GetComponent <FoliageTracker>();
         fol.active = false;
     }
     else if (containedType == 6)
     {
         serv        = containedBuilding.GetComponent <ServiceTrackerBase>();
         serv.active = true;
     }
 }
 void RejectApplication(ResidentialTracker applicantTracker)
 {
     // TODO
 }
Beispiel #10
0
 void RejectApplication(ResidentialTracker applicantTracker)
 {
     // TODO:
     //Debug.Log("Applicant rejected!!!");
 }