public void ReplaceCelestialBodySettings(CelestialBodySettings newValue) { var index = MetaComponentsLookup.CelestialBodySettings; var component = CreateComponent <CelestialBodySettingsComponent>(index); component.value = newValue; ReplaceComponent(index, component); }
public MetaEntity SetCelestialBodySettings(CelestialBodySettings newValue) { if (hasCelestialBodySettings) { throw new Entitas.EntitasException("Could not set CelestialBodySettings!\n" + this + " already has an entity with CelestialBodySettingsComponent!", "You should check if the context already has a celestialBodySettingsEntity before setting it or use context.ReplaceCelestialBodySettings()."); } var entity = CreateEntity(); entity.AddCelestialBodySettings(newValue); return(entity); }
public void ReplaceCelestialBodySettings(CelestialBodySettings newValue) { var entity = celestialBodySettingsEntity; if (entity == null) { entity = SetCelestialBodySettings(newValue); } else { entity.ReplaceCelestialBodySettings(newValue); } }
private void AddCelestialBodyLayer(int width, int height, int layerIndex, Color[] colorMap, Texture2D nightGlowMask, CelestialBodySettings celestialBodySettings) { GameObject planetLayer = Instantiate(planetLayerPrefab, transform); planetLayer.name = "Celestial Body Layer " + layerIndex; Texture2D planetLayerTexture = new Texture2D(width, height, TextureFormat.RGBA32, false); planetLayerTexture.filterMode = FilterMode.Point; planetLayerTexture.SetPixels(colorMap); planetLayerTexture.Apply(); CelestialBodyLayer celestialBodyLayer = planetLayer.GetComponent <CelestialBodyLayer>(); celestialBodyLayer.Configure(layerIndex, planetLayerTexture, nightGlowMask, celestialBodySettings.shapeSettings, celestialBodySettings.colorSettings); planetLayer.transform.localPosition = new Vector3(0, 0.01f * layerIndex, 0); }