void Start() { inhabitants = new List <NPC> (); typeOfBuilding = Buildingtype.Apartement; DBCharsAndBuildings.GetInstance().RegistrationBuilding(this); StartCoroutine(SpawnDelay(spawnDelayTime)); }
void Start() { inhabitants = new List<NPC> (); typeOfBuilding = Buildingtype.Apartement; DBCharsAndBuildings.GetInstance().RegistrationBuilding(this); StartCoroutine(SpawnDelay(spawnDelayTime)); }
public void Dismiss() { jobIdleTrigger = true; job = Buildingtype.None; hisWorkplace = null; bool jobSearchResult = Jobsearch(); if(!jobSearchResult){ StartCoroutine(JobDelay(jobSearchZyclusTime)); } }
//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; }
public void Dismiss() { jobIdleTrigger = true; job = Buildingtype.None; hisWorkplace = null; bool jobSearchResult = Jobsearch(); if (!jobSearchResult) { StartCoroutine(JobDelay(jobSearchZyclusTime)); } }
//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); }
//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(); }
//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()); }
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); }
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; }