public IEnumerator LoadDecals() { Current = this; LoadingDecals = true; UnloadDecals(); MargeDecals(); List <Decal> Props = ScmapEditor.Current.map.Decals; const int YieldStep = 500; int LoadCounter = YieldStep; int Count = Props.Count; LoadedCount = 0; //Debug.Log("Decals count: " + Count); for (int i = 0; i < Count; i++) { CreateGameObjectFromDecal(ScmapEditor.Current.map.Decals[i]); if (ScmapEditor.Current.map.Decals[i].Type != TerrainDecalType.TYPE_ALBEDO && ScmapEditor.Current.map.Decals[i].Type != TerrainDecalType.TYPE_NORMALS && ScmapEditor.Current.map.Decals[i].Type != TerrainDecalType.TYPE_NORMALS_ALPHA && ScmapEditor.Current.map.Decals[i].Type != TerrainDecalType.TYPE_GLOW && ScmapEditor.Current.map.Decals[i].Type != TerrainDecalType.TYPE_GLOW_MASK) { Debug.LogWarning("Found different decal type! " + ScmapEditor.Current.map.Decals[i].Type, ScmapEditor.Current.map.Decals[i].Obj.gameObject); } LoadedCount++; LoadCounter--; if (LoadCounter <= 0) { LoadCounter = YieldStep; yield return(null); } } //DecalsControler.Sort(); yield return(null); LoadingDecals = false; }
public IEnumerator LoadDecals() { Current = this; LoadingDecals = true; UnloadDecals(); MargeDecals(); List <Decal> Props = ScmapEditor.Current.map.Decals; const int YieldStep = 500; int LoadCounter = YieldStep; int Count = Props.Count; LoadedCount = 0; //Debug.Log("Decals count: " + Count); for (int i = 0; i < Count; i++) { CreateGameObjectFromDecal(ScmapEditor.Current.map.Decals[i]); /* * GameObject NewDecalObject = Instantiate(DecalPrefab, DecalPivot); * OzoneDecal Dec = NewDecalObject.GetComponent<OzoneDecal>(); * Decal Component = ScmapEditor.Current.map.Decals[i]; * Dec.Dec = Component; * Dec.tr = NewDecalObject.transform; * * Dec.tr.localRotation = Quaternion.Euler(Component.Rotation * Mathf.Rad2Deg); * Dec.tr.localScale = new Vector3(Component.Scale.x * 0.1f, Component.Scale.x * 0.1f, Component.Scale.z * 0.1f); * * Dec.CutOffLOD = Component.CutOffLOD; * Dec.NearCutOffLOD = Component.NearCutOffLOD; * * Dec.MovePivotPoint(ScmapEditor.ScmapPosToWorld(Component.Position)); * * Dec.Material = Component.Shared.SharedMaterial; */ if (ScmapEditor.Current.map.Decals[i].Type != TerrainDecalType.TYPE_ALBEDO && ScmapEditor.Current.map.Decals[i].Type != TerrainDecalType.TYPE_NORMALS && ScmapEditor.Current.map.Decals[i].Type != TerrainDecalType.TYPE_NORMALS_ALPHA && ScmapEditor.Current.map.Decals[i].Type != TerrainDecalType.TYPE_GLOW && ScmapEditor.Current.map.Decals[i].Type != TerrainDecalType.TYPE_GLOW_MASK) { Debug.LogWarning("Found different decal type! " + ScmapEditor.Current.map.Decals[i].Type, ScmapEditor.Current.map.Decals[i].Obj.gameObject); } LoadedCount++; LoadCounter--; if (LoadCounter <= 0) { LoadCounter = YieldStep; yield return(null); } } DecalsControler.Sort(); yield return(null); LoadingDecals = false; }
void Awake() { Current = this; }