public static bool CheckForChange(Light2D.LightType a, ref Light2D.LightType b) { var changed = a != b; b = a; return(changed); }
void OnShapeLight(Light2D.LightType lightType, SerializedObject serializedObject) { if (!m_AnyLightOperationEnabled) { EditorGUILayout.HelpBox(Styles.shapeLightNoLightDefined); } if (lightType == Light2D.LightType.Sprite) { EditorGUILayout.PropertyField(m_ShapeLightSprite, Styles.shapeLightSprite); } else if (lightType == Light2D.LightType.Parametric || lightType == Light2D.LightType.Freeform) { if (lightType == Light2D.LightType.Parametric) { EditorGUILayout.Slider(m_ShapeLightRadius, 0, 20, Styles.shapeLightParametricRadius); EditorGUILayout.IntSlider(m_ShapeLightParametricSides, 3, 24, Styles.shapeLightParametricSides); EditorGUILayout.Slider(m_ShapeLightParametricAngleOffset, 0, 359, Styles.shapeLightAngleOffset); } EditorGUILayout.Slider(m_ShapeLightFalloffSize, 0, 5, Styles.generalFalloffSize); EditorGUILayout.Slider(m_FalloffCurve, 0, 1, Styles.generalFalloffIntensity); if (lightType == Light2D.LightType.Parametric) { EditorGUILayout.PropertyField(m_ShapeLightFalloffOffset, Styles.shapeLightFalloffOffset); } } EditorGUILayout.PropertyField(m_ShapeLightOverlapMode, Styles.shapeLightOverlapMode); EditorGUILayout.PropertyField(m_ShapeLightOrder, Styles.shapeLightOrder); }
static void CreateLight(MenuCommand menuCommand, string name, Light2D.LightType type) { GameObject go = ObjectFactory.CreateGameObject(name, typeof(Light2D)); Light2D light2D = go.GetComponent <Light2D>(); light2D.lightType = type; var parent = menuCommand.context as GameObject; Place(go, parent); }
static void CreateLight(string name, Light2D.LightType type) { GameObject go = new GameObject(name); Light2D light2D = go.AddComponent <Light2D>(); light2D.lightType = type; if (Selection.activeGameObject != null) { go.transform.parent = Selection.activeGameObject.transform; } }
static void CreateLight(MenuCommand menuCommand, string name, Light2D.LightType type) { GameObject go = ObjectFactory.CreateGameObject(name, typeof(Light2D)); Light2D light2D = go.GetComponent <Light2D>(); light2D.lightType = type; var parent = menuCommand.context as GameObject; Place(go, parent); Analytics.Light2DData lightData = new Analytics.Light2DData(); lightData.was_create_event = true; lightData.instance_id = light2D.GetInstanceID(); lightData.light_type = light2D.lightType; Analytics.Renderer2DAnalytics.instance.SendData(Analytics.AnalyticsDataTypes.k_LightDataString, lightData); }
static void CreateLight(MenuCommand menuCommand, Light2D.LightType type, Vector3[] shapePath = null) { GameObject go = ObjectFactory.CreateGameObject("Light 2D", typeof(Light2D)); Light2D light2D = go.GetComponent <Light2D>(); light2D.lightType = type; if (shapePath != null && shapePath.Length > 0) { light2D.shapePath = shapePath; } var parent = menuCommand.context as GameObject; Place(go, parent); Analytics.Light2DData lightData = new Analytics.Light2DData(); lightData.was_create_event = true; lightData.instance_id = light2D.GetInstanceID(); lightData.light_type = light2D.lightType; Analytics.Renderer2DAnalytics.instance.SendData(Analytics.AnalyticsDataTypes.k_LightDataString, lightData); }