Created
September 25, 2015 21:54
-
-
Save boformer/1ede360cc0531eff5f07 to your computer and use it in GitHub Desktop.
(Saving Not Supported!) Custom light props in Cities: Skylines
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Warning: Lights made with this script can not be saved! | |
var lightEffect = EffectCollection.FindEffect("Flood Light Orange") as LightEffect; | |
// Final position in prop | |
Vector3 pos = new Vector3(0f,10f,0f); | |
// this would be in the center of the prop, 10m above ground | |
// Final direction in prop | |
Vector3 dir = new Vector3(0f,1f,0f); | |
// this would be up | |
var propEffect = new PropInfo.Effect {m_effect = lightEffect, m_position = pos, m_direction = dir }; | |
(GameObject.Find("Tool Controller").GetComponent<ToolController>().m_editPrefabInfo as PropInfo).m_effects = new PropInfo.Effect[] { propEffect}; | |
(GameObject.Find("Tool Controller").GetComponent<ToolController>().m_editPrefabInfo as PropInfo).m_hasEffects = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Warning: Lights made with this script can not be saved! | |
var existingLightEffect = EffectCollection.FindEffect("Flood Light Orange") as LightEffect; | |
LightEffect newLightEffect = LightEffect.Instantiate(existingLightEffect); | |
newLightEffect.transform.parent = existingLightEffect.transform.parent; | |
Light light = newLightEffect.gameObject.GetComponent<Light>(); | |
// ---------------- | |
// start of options | |
// create blinking lights | |
// Possible values: None, Blink_050_050, MildFade_0125_0125, MediumFade_500_500 | |
newLightEffect.m_blinkType = LightEffect.BlinkType.MildFade_0125_0125; | |
// light color | |
// (r, g, b, a) | |
light.color = new Color(0.0f, 1.0f, 1.0f, 1.0f); | |
// this would be 0% red, 100% green, 100% blue | |
// light type | |
// Possible values: Spot, Directional, Point, Area | |
light.type = LightType.Spot; | |
// more options | |
light.range = 70; | |
light.spotAngle = 35; | |
light.intensity = 8; | |
newLightEffect.m_spotLeaking = 0.5f; | |
newLightEffect.m_fadeStartDistance = 250; | |
newLightEffect.m_fadeEndDistance = 400; | |
newLightEffect.m_fadeSpeed = 10; | |
// Final position in prop | |
Vector3 pos = new Vector3(0f,10f,0f); | |
// this would be in the center of the prop, 10m above ground | |
// Final direction in prop | |
Vector3 dir = new Vector3(0f,1f,0f); | |
// this would be up | |
// end of options | |
// -------------- | |
newLightEffect.m_batchedLight = true; | |
typeof(EffectInfo).GetField("m_refCount", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(newLightEffect, 0); | |
newLightEffect.InitializeEffect(); | |
var propEffect = new PropInfo.Effect {m_effect = newLightEffect, m_position = pos, m_direction = dir }; | |
(GameObject.Find("Tool Controller").GetComponent<ToolController>().m_editPrefabInfo as PropInfo).m_effects = new PropInfo.Effect[] { propEffect}; | |
(GameObject.Find("Tool Controller").GetComponent<ToolController>().m_editPrefabInfo as PropInfo).m_hasEffects = true; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment