public override void ReStart() { versionForCoRoutine++; base.ReStart(); currentTerrain = null; for (int i = 0; i < terrainsListToDel.Count; i++) { AbstractTag newterrainToDel = terrainsListToDel[i]; List <AbstractTag> AllElements = (newterrainToDel.GetComponent("TerrainTag") as TerrainTag).GetAllElements(); AllElements.Clear(); } }
private IEnumerator ClearTerrainFactory() { int curversionForCoRoutine = versionForCoRoutine; if (terrainsList.Count > 0) { if (curversionForCoRoutine != versionForCoRoutine) { yield break; } AbstractTag newterrainToDel = terrainsList[0]; TerrainTag terrainTag = newterrainToDel.GetComponent("TerrainTag") as TerrainTag; List <AbstractTag> AllElements = terrainTag.GetAllElements(); terrainTag.RemakeAllElementsList(); yield return(null); if (curversionForCoRoutine != versionForCoRoutine) { yield break; } terrainsList.Remove(newterrainToDel); terrainsListToDel.Add(newterrainToDel); if (curversionForCoRoutine != versionForCoRoutine) { yield break; } yield return(null); for (int i = 0; i < AllElements.Count; i++) { if (curversionForCoRoutine != versionForCoRoutine) { yield break; } if (AllElements[i]) { AllElements[i].DeleteFromUsed(); } yield return(null); } if (curversionForCoRoutine != versionForCoRoutine) { yield break; } AllElements.Clear(); AllElements = null; } yield return(null); }
public override void PutToFirstState(AbstractTag newTerrain) { newTerrain.singleTransform.position = new Vector3(-9999, -9999, -9999); newTerrain.singleTransform.rotation = Quaternion.identity; //MakeInactiveObjectsActive TerrainTag terrainTag = newTerrain.GetComponent("TerrainTag") as TerrainTag; terrainTag.ParseObstacleSets(); //terrainTag.MakeAllActive(); if (!GlobalOptions.flagOnlyFizik) { terrainTag.RecalculateRoadPathArray(); if (terrainsList.Count > 0) { TerrainTag terrainTagPrev = (terrainsList[terrainsList.Count - 1] as Abstract).GetComponent("TerrainTag") as TerrainTag; terrainTag.SetPrev(terrainTagPrev); terrainTagPrev.SetNext(terrainTag); } } }