// Update is called once per frame //void Update() //{ // //} #region Setup new SpawnAreas private void CalculateSpawnAreas() { spawnAreas = new List <SpawnArea>(); Dictionary <Tile, GameObject> oldEntitiesPosition = this.entitiesPosition; Dictionary <Tile, HeightLevelType> oldEntitiesHeightLevel = this.entitiesHeightLevel; this.entitiesPosition = new Dictionary <Tile, GameObject>(); this.entitiesHeightLevel = new Dictionary <Tile, HeightLevelType>(); areaCalculator.Calculate(); foreach (HeightLevelType levelType in Enum.GetValues(typeof(HeightLevelType))) { //alle Flächen auf einem Höhenlevel bestimmen List <Area> areas = areaCalculator.ContiguousAreasOnHeightLevel(levelType); //aus den Flächen die SpawnAreas generieren if (areas != null && levelType != HeightLevelType.UNDEFINED) { DetermineCorrectlyLocatedEntities(areas, levelType, oldEntitiesPosition, oldEntitiesHeightLevel); IEnumerable <SpawnArea> spawnAreasOnHeightLevel = SetupSpawnAreasForHeightLevel(areas, levelType); spawnAreas.AddRange(spawnAreasOnHeightLevel); } } DestroyOrphanGameObjects(oldEntitiesPosition); }