Exemplo n.º 1
0
 void Start()
 {
     inhabitants    = new List <NPC> ();
     typeOfBuilding = Buildingtype.Apartement;
     DBCharsAndBuildings.GetInstance().RegistrationBuilding(this);
     StartCoroutine(SpawnDelay(spawnDelayTime));
 }
Exemplo n.º 2
0
 void Start()
 {
     inhabitants = new List<NPC> ();
     typeOfBuilding = Buildingtype.Apartement;
     DBCharsAndBuildings.GetInstance().RegistrationBuilding(this);
     StartCoroutine(SpawnDelay(spawnDelayTime));
 }
Exemplo n.º 3
0
 public void Dismiss()
 {
     jobIdleTrigger = true;
     job = Buildingtype.None;
     hisWorkplace = null;
     bool jobSearchResult = Jobsearch();
     if(!jobSearchResult){
         StartCoroutine(JobDelay(jobSearchZyclusTime));
     }
 }
Exemplo n.º 4
0
 //Findet alle Gebäude vom gesuchten Datentyp und speichert sie in einer Liste, die sie dann ausgibt
 public List<IBuilding> FindBuilding(Buildingtype type)
 {
     List<IBuilding> temp = new List<IBuilding>();
     foreach (IBuilding building in buildings) {
         if(building.GetBuildingType() == type){
             temp.Add (building);
         }
     }
     return temp;
 }
Exemplo n.º 5
0
    public void Dismiss()
    {
        jobIdleTrigger = true;
        job            = Buildingtype.None;
        hisWorkplace   = null;
        bool jobSearchResult = Jobsearch();

        if (!jobSearchResult)
        {
            StartCoroutine(JobDelay(jobSearchZyclusTime));
        }
    }
Exemplo n.º 6
0
    //Findet alle Gebäude vom gesuchten Datentyp und speichert sie in einer Liste, die sie dann ausgibt
    public List <IBuilding> FindBuilding(Buildingtype type)
    {
        List <IBuilding> temp = new List <IBuilding>();

        foreach (IBuilding building in buildings)
        {
            if (building.GetBuildingType() == type)
            {
                temp.Add(building);
            }
        }
        return(temp);
    }
Exemplo n.º 7
0
 //Gibt einem Npc das gewünschte Gebäude mit der kürzesten Entfernung zurück
 public Transform FindClosestTargetBuilding(Buildingtype Typus, Transform NpcPosition)
 {
     int index = 0;
     float distance = float.PositiveInfinity;
     List<IBuilding> possibles = FindBuilding(Typus);
     for(int i = 0; i < possibles.Count; i++){
         if(CalculateDistance(NpcPosition, possibles [i].GetTransform()) < distance){
             index = i;
             distance = CalculateDistance(NpcPosition, possibles [i].GetTransform());
         }
     }
     return possibles [index].GetTransform();
 }
Exemplo n.º 8
0
    //Gibt einem Npc das gewünschte Gebäude mit der kürzesten Entfernung zurück
    public Transform FindClosestTargetBuilding(Buildingtype Typus, Transform NpcPosition)
    {
        int              index     = 0;
        float            distance  = float.PositiveInfinity;
        List <IBuilding> possibles = FindBuilding(Typus);

        for (int i = 0; i < possibles.Count; i++)
        {
            if (CalculateDistance(NpcPosition, possibles [i].GetTransform()) < distance)
            {
                index    = i;
                distance = CalculateDistance(NpcPosition, possibles [i].GetTransform());
            }
        }
        return(possibles [index].GetTransform());
    }
Exemplo n.º 9
0
    bool Jobsearch()
    {
        List <IWorkplace> workplaceListe = DBCharsAndBuildings.GetInstance().GetWorkplaces();

        Debug.Log("Suche Job");
        foreach (IWorkplace workplace in workplaceListe)
        {
            if (workplace.HasJobsLeft())
            {
                Debug.Log(workplace);
                job          = workplace.GetJobType();
                hisWorkplace = ((IBuilding)workplace).GetTransform();
                work.SetWorkplacePosition(hisWorkplace);
                jobIdleTrigger = false;
                workplace.RegistrationWorker(this);
                return(true);
            }
        }
        return(false);
    }
Exemplo n.º 10
0
 bool Jobsearch()
 {
     List<IWorkplace> workplaceListe = DBCharsAndBuildings.GetInstance().GetWorkplaces();
     Debug.Log("Suche Job");
     foreach(IWorkplace workplace in workplaceListe){
         if(workplace.HasJobsLeft()){
             Debug.Log(workplace);
             job = workplace.GetJobType();
             hisWorkplace = ((IBuilding)workplace).GetTransform();
             work.SetWorkplacePosition(hisWorkplace);
             jobIdleTrigger = false;
             workplace.RegistrationWorker(this);
             return true;
         }
     }
     return false;
 }