public void UpdateSettings(FloraSettings settings, Transform t) { this.settings = settings; //Si no existe el objeto contenedor de la flora lo creamos if (flora == null) { flora = new GameObject("flora"); flora.transform.parent = t; flora.transform.localPosition = new Vector3(0f, 0f, 0f); } //Limpiamos la flora ClearFlora(); //Instanciamos todos los arboles meshFilters = new MeshFilter[settings.treesPerFace * 6]; for (int i = 0; i < meshFilters.Length; i++) { if (meshFilters[i] == null) { GameObject meshObj = GameObject.Instantiate(settings.tree); if (settings.scannable) { meshObj.layer = 10; } meshObj.transform.parent = flora.transform; meshObj.transform.localPosition = new Vector3(0f, 0f, 0f); meshFilters[i] = meshObj.GetComponent <MeshFilter>(); } } }
//Devuelve un nuevo objeto copia del invocante public FloraSettings Clone() { FloraSettings newFS = CreateInstance <FloraSettings>(); newFS.treesPerFace = this.treesPerFace; newFS.tree = this.tree; newFS.generateFlora = this.generateFlora; newFS.scannable = this.scannable; return(newFS); }