public static void CreateNewRadialLight() { Light2D light = Light2D.Create(Vector3.zero, new Color(0f, 0f, 1f, 0f)); light.ShadowLayer = -1; Selection.activeGameObject = light.gameObject; }
public static void CreateNewRadialLight() { Light2D light = Light2D.Create(Vector3.zero, (Material)Resources.Load("RadialLightMaterial"), Color.blue); light.ShadowLayer = LayerMask.NameToLayer("Default"); Selection.activeGameObject = light.gameObject; }
public static void CreateNewRadialLight() { Light2D light = Light2D.Create(GetPlacement(), (Material)Resources.Load("RadialLight", typeof(Material)), new Color(1f, 0.6f, 0f, 0f), GetSize(), 360, Light2D.LightDetailSetting.Rays_500, false, Light2D.LightTypeSetting.Radial); light.ShadowLayer = -1; Selection.activeGameObject = light.gameObject; Undo.RegisterCreatedObjectUndo(light.gameObject, "Created 2D Radial Light"); }
public static void CreateNewShadowLight() { Light2D light = Light2D.Create(GetPlacement(), (Material)Resources.Load("RadialShadow", typeof(Material)), Color.black, GetSize(), 360, Light2D.LightDetailSetting.Rays_500, false, Light2D.LightTypeSetting.Shadow); light.ShadowLayer = -1; Selection.activeGameObject = light.gameObject; Undo.RegisterCreatedObjectUndo(light.gameObject, "Created 2D Shadow Emitter"); }
public static void CreateNewSpotLight() { Light2D light = Light2D.Create(Vector3.zero, new Color(0f, 1f, 0f, 0f)); light.LightConeAngle = 45; light.LightDetail = Light2D.LightDetailSetting.Rays_100; light.ShadowLayer = -1; Selection.activeGameObject = light.gameObject; }
public static void CreateNewShadowLight() { Light2D light = Light2D.Create(Vector3.zero, new Color(1f, 0f, 0f, 0f)); light.ShadowLayer = -1; light.LightColor = Color.black; light.IsShadowEmitter = true; light.LightMaterial = (Material)Resources.Load("RadialShadow", typeof(Material)); Selection.activeGameObject = light.gameObject; }
public static void CreateNewSpotLight() { Light2D light = Light2D.Create(Vector3.zero, (Material)Resources.Load("RadialLightMaterial"), Color.green); light.SweepSize = 45; light.SweepStart = -110; light.LightDetail = Light2D.LightDetailSetting.VeryLow; light.ShadowLayer = LayerMask.NameToLayer("Default"); Selection.activeGameObject = light.gameObject; }
void CreateLight(Vector3 position) { selectedLight = Light2D.Create(position, new Color(1f, 0.5f, 0f, 0f), initialRadius); selectedLight.EnableEvents = true; if (isPro) { selectedLight.gameObject.layer = 31; } lightsInScene.Add(selectedLight); }
private void AddLight() { for (int i = 0; i < transform.childCount; i++) { light2d = transform.GetChild(i).gameObject.GetComponent <Light2D>(); if (light2d) { return; } } light2d = Light2D.Create(transform.position, Color.red, range, (int)fieldOfView); light2d.gameObject.transform.parent = transform; }
void CreateLight(Vector3 pos) { CurrentLight = Light2D.Create(pos, new Color(0.5f, 0.7f, 1f, 0.3f), 5, 360, Light2D.LightDetailSetting.Rays_800, false, false); CurrentLight.gameObject.AddComponent <SphereCollider>().radius = 1f; CurrentLight.gameObject.AddComponent <DragLight_VLS>(); CurrentLight.ShadowLayer = 1; CurrentLight.gameObject.layer = LayerMask.NameToLayer("IgnoreShadow"); GameObject p = (GameObject)Instantiate((Object)gizmoPrefab, CurrentLight.transform.position, Quaternion.Euler(0, 0, 180)); p.transform.parent = CurrentLight.transform; lights.Add(CurrentLight); }
void OnLightExit(Light2D l, GameObject g) { if (g.GetInstanceID() == id) { c -= l.LightColor; if ((GetComponent <Renderer>().material.color.r > 0.95f) && (GetComponent <Renderer>().material.color.g > 0.95f) && (GetComponent <Renderer>().material.color.b > 0.95f)) { AudioSource.PlayClipAtPoint(whiteSound, transform.position, 0.5f); Light2D l2d = Light2D.Create(transform.position, hitLightMaterial, new Color(.8f, .8f, 0.6f), Random.Range(3, 5f)); l2d.ShadowLayer = 0; l2d.transform.Rotate(0, 0, Random.Range(10, 80f)); GameObject.Destroy(l2d.gameObject, 0.2f); } } }
void AddNewLight(Vector3 position) { Light2D l2d = Light2D.Create(position, (Material)Resources.Load("RadialLightMaterial"), new Color((float)Random.Range(0, 1f), 0, (float)Random.Range(0, 1f), 1f), Random.Range(lightMinScale, lightMaxScale)); l2d.LightDetail = Light2D.LightDetailSetting.Medium; GameObject obj = (GameObject)Instantiate(lightIcon, l2d.transform.position + new Vector3(0, 0, -1), Quaternion.identity); obj.transform.localScale = new Vector3(-3, 3, 3); /* * Orbit_VLS orbit = l2d.gameObject.AddComponent<Orbit_VLS>(); * orbit.pointToOrbit = l2d.transform.position - new Vector3(1, 0, 0); * orbit.orbitSpeed = Random.Range(-100, 100); * //l2d.allowHideInsideColliders = true; */ lightCount++; }
void Update() { if (lightObjs.Length > 0) { for (int i = 0; i < lightsPerIteration; i++) { Destroy(lightObjs[i].gameObject); } } lightObjs = new Light2D[lightsPerIteration]; lightsGenerated += lightsPerIteration; for (int i = 0; i < lightsPerIteration; i++) { lightObjs[i] = Light2D.Create(new Vector3(Random.Range(-5, 5), Random.Range(-4, 4), 0), GetRandColor(), Random.Range(1f, 2f)); } TickFPSCounter(); }
IEnumerator AddLight() { while (spawnLights) { Light2D l2d = Light2D.Create(new Vector3((x * lightMinScale), (y * lightMinScale), 0), new Color((float)Random.Range(0, 1f), 0, (float)Random.Range(0, 1f), 1f), Random.Range(lightMinScale, lightMaxScale), 360, Light2D.LightDetailSetting.Rays_300); lightCount++; l2d.gameObject.AddComponent <SineWave_VLS>(); if (++x >= XLightCount) { x = 0; if (++y >= YLightCount) { spawnLights = false; } } yield return(0); } }
void CreateLight(Vector3 position) { selectedLight = Light2D.Create(position, new Color(1f, 0.5f, 0f, 0.2f), initialRadius); selectedLight.EnableEvents = true; lightsInScene.Add(selectedLight); }