void OnLightEnter(Light2D l, GameObject g) { if (g.GetInstanceID() == id && !isDetected) { c = mMaterial.color; } }
void Update() { if (Input.GetKeyDown(KeyCode.F)) { Screen.SetResolution(Screen.currentResolution.width, Screen.currentResolution.height, !Screen.fullScreen); } if (Input.GetMouseButtonDown(0)) { foreach (Light2D l in lightsInScene) { Rect box = new Rect(l.transform.position.x - 1, l.transform.position.y - 1, 2, 2); wasHit = box.Contains(Camera.main.ScreenToWorldPoint(Input.mousePosition)); if (wasHit) { selectedLight = l; break; } } } if (Input.GetMouseButtonDown(1)) { CreateLight(Camera.main.ScreenToWorldPoint(Input.mousePosition) + new Vector3(0, 0, 10)); } if (wasHit && Input.GetMouseButton(0)) { selectedLight.transform.position = Vector3.Lerp(selectedLight.transform.position, Camera.main.ScreenToWorldPoint(Input.mousePosition) + new Vector3(0, 0, 10), Time.deltaTime * 20f); // new Vector3(Input.GetAxisRaw("Mouse X"), Input.GetAxisRaw("Mouse Y"), 0); } }
void OnLightStay(Light2D l, GameObject g) { if (g.tag == "Enemy" && beamOn){ if (!g.renderer.isVisible){ if (audioSource.isPlaying) audioSource.Stop(); g.GetComponent<MobBase>().Recover(); g.transform.GetComponentInChildren<ParticleSystem>().Stop(); ScreenShake2D.SetShake(0f); return; } float range = Mathf.Clamp(1f - ((g.transform.position - transform.position).magnitude / l.LightRadius), 0f, 1f); float compositeintensity = range * intensity; g.GetComponent<MobBase>().Petrify(compositeintensity); g.transform.GetComponentInChildren<ParticleSystem>().startSpeed = Mathf.Lerp(5f,10f,intensity); if (g.GetComponent<MobBase>().isPetrified){ g.transform.GetComponentInChildren<ParticleSystem>().Stop(); ScreenShake2D.Shake(0f,0f); if (audioSource.isPlaying) audioSource.Stop(); } else{ if (!g.transform.GetComponentInChildren<ParticleSystem>().isPlaying){ g.transform.GetComponentInChildren<ParticleSystem>().Play(); } ScreenShake2D.SetShake(Mathf.Clamp(intensity-.5f, 0f, 1f) * .1f); if (!audioSource.isPlaying) audioSource.Play(); audioSource.pitch = Mathf.Lerp(.25f, 2f, compositeintensity); audioSource.volume = Mathf.Lerp(0f, .75f, compositeintensity); } }if (g.tag == "Enemy" && !beamOn){ //g.GetComponent<MobBase>().Recover(); g.transform.GetComponentInChildren<ParticleSystem>().Stop(); if (audioSource.isPlaying) audioSource.Stop(); } }
private void OnLightEnter(Light2D l, GameObject g) { if (g.GetInstanceID() == id){ c += l.LightColor; AudioSource.PlayClipAtPoint(hitSound, transform.position, 0.1f); } }
void OnLightExit(Light2D l, GameObject o) { if (o.GetInstanceID() == id) { } }
void OnLightEnter(Light2D l, GameObject o) { if(o.GetInstanceID() == id) { Debug.Break(); } }
private void Start() { _cameraBeatTracker = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<BeatTracker>(); _light2D = GetComponent<Light2D>(); ScaleFrom = _light2D.LightRadius; ScaleTo = ScaleFrom + ScaleUpTo; }
void OnLightStay(Light2D l, GameObject g) { if (g.GetInstanceID() == id) { isDetected = true; } }
void OnLightExit(Light2D l, GameObject g) { if (g.GetInstanceID() == id) { Debug.Log("Exit"); } }
void OnLightStay(Light2D l, GameObject g) { if (g.GetInstanceID() == id) { Debug.Log("Stay"); isDetected = true; } }
// Use this for initialization void Awake() { light2d = GetComponent<Light2D>(); renderer = GetComponent<MeshRenderer>(); sprite = GetComponentInChildren<SpriteRenderer>(); collider = GetComponentInChildren<PolygonCollider2D>(); DrawSprite(); }
void OnLightEnter(Light2D l, GameObject g) { if (g.GetInstanceID() == id) { Debug.Log("Enter"); c = mOriginColor + l.LightColor; } }
void OnLightEnter(Light2D l, GameObject g) { //Debug.Log(g.name); if (g.tag == "Enemy" && beamOn && g.renderer.isVisible){ g.transform.GetComponentInChildren<ParticleSystem>().Play(); if (!audioSource.isPlaying) audioSource.Play(); } }
void OnStayEvent(Light2D light, GameObject go) { if (go.GetInstanceID() == colliderObject.GetInstanceID()) { float d = Vector3.Distance(light.gameObject.transform.position, colliderObject.transform.position) / light.LightRadius; Color c = new Color(light.LightColor.r, light.LightColor.g, light.LightColor.b); AddColor(Color.Lerp(c, new Color(0, 0, 0, 1f), Mathf.Clamp(d, 0, 1f))); } }
void OnLightExit(Light2D l, GameObject g) { if (g == null) return; if (g.tag == "Enemy"){ if (audioSource.isPlaying) audioSource.Stop(); g.GetComponent<MobBase>().Recover(); g.transform.GetComponentInChildren<ParticleSystem>().Stop(); ScreenShake2D.SetShake(0f); } }
// Use this for initialization public void Start() { base.Start(); mBounds = GetComponent<Collider2D>().bounds; mFlashLight = Light2D.Create(transform.position + new Vector3(mBounds.extents.x + EPILSON, 0, 0), Color.blue, 10.0f, 15); mFlashLight.EnableEvents = true; mFlashLight.LightConeStart = 0; mPlatformCharacter = GetComponent<PlatformerCharacter2D>(); }
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); }
// Use this for initialization private void Start() { _lightSource = GetComponent<Light2D>(); _startRadius = _lightSource.LightRadius; _lightScaler = GetComponent<BeatLightScaler>(); _goalX = 0; _levelManager = Camera.main.GetComponent<LevelManager>(); Camera.main.GetComponent<BeatTracker>().BeatEvent += (sender, args)=>LightBeat(); }
void OnLightStay(Light2D _lightObject, GameObject _gameObject) { if (_gameObject.GetInstanceID() == gameObject.GetInstanceID()) { Transform lightSource = _lightObject.transform.parent; if (lightSource.tag == "Guard") { BeChasedByGuard(lightSource); } } }
// Use this for initialization void Start() { player = Game.player; playerRenderer = player.GetComponent<Renderer>(); InvokeRepeating("LightActive", 5, 1); lightRenderer = GetComponent<Renderer>(); GameObject visionObject = GameObject.FindGameObjectWithTag("Vision"); playerVision = visionObject.GetComponent<Light2D>();; light3D = visionObject.GetComponent<Light>(); blackOut = false; }
void OnLightEnter(Light2D _light, GameObject _go) { if (_go.GetInstanceID() == gameObject.GetInstanceID()) { if (visible <= 0) { Debug.Log("Object Entered Light"); enemyRenderer.enabled = true; } visible += 1; } }
protected void OnLightEnter(Light2D light, GameObject go) { if (go.GetInstanceID() == gameObject.GetInstanceID()) { if(visible <= 0) { //Debug.Log("Object Entered Light"); enterLightEffect(); } visible += 1; } }
protected void OnLightExit(Light2D light, GameObject go) { if (go.GetInstanceID() == gameObject.GetInstanceID()) { visible -= 1; if(visible <= 0) { //Debug.Log("Object Exited Light"); exitLightEffect(); } } }
private void OnLightExit(Light2D _light, GameObject _go) { /* Function called everytime an object exits the light. * Use the _go object that is passed to determin if the current * gameObject is equal to the one this script is in (if needed) */ if (_go.GetInstanceID() == gameObject.GetInstanceID()){ // GameObject just left the visibility of the light object Debug.Log("Object Exited Light"); // Change color [For Visualization] gameObject.GetComponent<Renderer>().material.color = kColor; } }
void OnLightStay(Light2D _light, GameObject _go) { /* Function called every LateUpdate if an object is in the light. * Use the _go object that is passed to determin if the current * gameObject is equal to the one this script is in (if needed) */ if (_go.GetInstanceID() == gameObject.GetInstanceID()) { // GameObject is currently visible by light object Debug.Log("Object Inside Light"); // Change color [For Visualization] gameObject.renderer.material.color = Color.Lerp(gameObject.renderer.material.color, Color.red, Time.deltaTime * 0.5f); } }
void OnLightEnter(Light2D _light, GameObject _go) { /* Function called everytime a new object enters the light. * Use the _go object that is passed to determin if the current * gameObject is equal to the one this script is in (if needed) */ if (_go.GetInstanceID() == gameObject.GetInstanceID()) { // GameObject just became visible by light object Debug.Log("Object Entered Light"); // Change color [For Visualization] gameObject.renderer.material.color = Color.blue; } }
void OnLightEnter(Light2D light, GameObject go) { if (go.GetInstanceID() == gameObject.GetInstanceID()) { if(visible <= 0) { foreach(SpriteRenderer renderer in GetComponentsInChildren<SpriteRenderer>()) { renderer.enabled = true; } } visible += 1; } }
void OnLightExit(Light2D light, GameObject go) { if (go.GetInstanceID() == gameObject.GetInstanceID()) { visible -= 1; if(visible <= 0) { foreach(SpriteRenderer renderer in GetComponentsInChildren<SpriteRenderer>()) { renderer.enabled = false; } } } }
public static void Draw(Light2D light, LightCollider2D id) { if (id.InLight(light) == false) { return; } light.AddCollider(id); foreach (LightColliderShape shape in id.shapes) { List <Polygon2> polygons = shape.GetPolygonsWorld(); ShadowEngine.Draw(polygons, shape.shadowDistance, id.shadowTranslucency); } }
public Player(Vector2 positionInWorld) : base(GamePlayManager.MobManager, BuildBody()) { Light = new Light2D() { Texture = Game1.LightTexture, Range = 120, Color = Color.LightBlue, Intensity = .7f, Angle = MathHelper.TwoPi }; SetPhysicalBodyPosition(ConvertUnits.ToSimUnits(positionInWorld)); AnimatedSprite = new AnimatedSprite(@"Photon"); Speed = 5; }
virtual protected void OnLightStay(Light2D l, GameObject g) { if (g.GetInstanceID() == id) { //Debug.Log (l.LightColor+" "+errorLight); if (ColorUtil.colorCompareQuantRGB(l.LightColor, errorLight, 127)) { isCrazy = true; } else { isCrazy = false; } } }
void Start() { eyeLimitAngle.upRightAngle = 0.0f + limitEyeSightRange; eyeLimitAngle.upLeftAngle = 0.0f + limitEyeSightRange; eyeLimitAngle.downRightAngle = 180.0f - limitEyeSightRange; eyeLimitAngle.downLeftAngle = 180.0f - limitEyeSightRange; headLimitAngle.upRightAngle = 0.0f + limitEyeSightRange; headLimitAngle.upLeftAngle = 0.0f - limitEyeSightRange; headLimitAngle.downRightAngle = -90.0f + limitEyeSightRange; headLimitAngle.downLeftAngle = 90.0f - limitEyeSightRange; light2D = eyeSight.GetComponent <Light2D>(); innerAngle = light2D.pointLightInnerAngle; outerAngle = light2D.pointLightOuterAngle; }
private int tweenID; // LeanTween-operaatiolle annettava uniikki ID, jolla voidaan esim. pysäyttää operaatio // Start is called before the first frame update void Start() { player = UnityEngine.GameObject.FindGameObjectWithTag("Player"); cameraLight = GetComponentInChildren <Light2D>(); spriteRenderer = GetComponentInChildren <SpriteRenderer>(); enemyTriggerArea.SetActive(false); spriteRenderer.sprite = viewConeSafeSprite; originalSize = gameObject.transform.localScale; tweenID = 0; GetComponentInParent <BoxCollider2D>().enabled = false; StartCoroutine(Rotate(angle / 2, rotationTime / 2)); // Ensimmäinen rotaatio puolet tavallisesta }
void Start() { //Get a reference to the Light component on the child game object localLight = GetComponentInChildren <Light2D>(); if (localLight == null) { Debug.LogError("Error with LightFlicker script component " + this); Destroy(this); return; } //Record the intensity and pick a random seed number to start intensity = localLight.intensity; offset = Random.Range(0, 10000); }
void Awake() { if (controller == null) { controller = GetComponent <CharacterController>(); } ammoText = GameObject.Find("AmmoText").GetComponent <tk2dTextMesh>(); weaponText = GameObject.Find("WeaponText").GetComponent <tk2dTextMesh>(); health = maxHealth; stamina = maxStamina; flashlight = GetComponentInChildren <Light2D>(); UpdateAmmoHUD(); }
private void ToggleNightMode(Toggle toggle) { Light2D dayLight = GameObject.FindGameObjectWithTag("DayLight").GetComponent <Light2D>(); Light2D nightLight = GameObject.FindGameObjectWithTag("NightLight").GetComponent <Light2D>(); if (toggle.isOn) { dayLight.enabled = false; nightLight.enabled = true; } else { nightLight.enabled = false; dayLight.enabled = true; } }
/// <summary> /// Applied to Light2D to properly attribute lighting sources. /// </summary> private static bool AddToScenePartitioner_Prefix(Light2D __instance, ref IntHandle ___solidPartitionerEntry, ref IntHandle ___liquidPartitionerEntry) { var lm = PLightManager.Instance; bool cont = true; if (lm != null) { // Replace the whole method since the radius could use different algorithms lm.CallingObject = __instance.gameObject; cont = !PLightManager.AddScenePartitioner(__instance, ref ___solidPartitionerEntry, ref ___liquidPartitionerEntry); } return(cont); }
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 Awake() { noteAudio = GetComponent <AudioSource>(); spriteRenderer = GetComponent <SpriteRenderer>(); _light = GetComponent <Light2D>(); spriteRenderer.color = nodeBlockDisabled; spriteRenderer.sortingLayerName = _SortingLayerDisabled; blockEnabled = false; gameObject.layer = LayerMask.NameToLayer(_SortingLayerDisabled); _light.enabled = true; _light.intensity = 0; }
// Start is called before the first frame update void Start() { mainCamera = FindObjectOfType <Camera>(); cameraOriginSize = mainCamera.orthographicSize; animator = GetComponent <Animator>(); playerLight = GetComponentInChildren <Light2D>(); basicColor = playerLight.color; basicIntensity = playerLight.intensity; playerMovement = GetComponentInParent <Movement>(); levelMax = 1; currentLevel = 1; invicibility = false; }
public override void DoPostConfigureComplete(GameObject go) { go.AddOrGet<LoopingSounds>(); Light2D light2D = go.AddOrGet<Light2D>(); light2D.overlayColour = LIGHT2D.CEILINGLIGHT_OVERLAYCOLOR; light2D.Color = LIGHT2D.CEILINGLIGHT_COLOR; light2D.Range = 9f; light2D.Angle = 3f; light2D.Direction = LIGHT2D.CEILINGLIGHT_DIRECTION; light2D.Offset = LIGHT2D.CEILINGLIGHT_OFFSET; light2D.shape = LightShape.Cone; light2D.drawOverlay = true; light2D.Lux = 1800; BuildingTemplates.DoPostConfigure(go); go.GetComponent<KPrefabID>().prefabInitFn += game_object => new CeilingLamp.Instance(game_object.GetComponent<KPrefabID>()).StartSM(); }
public override void DoPostConfigureComplete(GameObject go) { Light2D light2D = go.AddOrGet <Light2D>(); light2D.Lux = 1; light2D.overlayColour = LIGHT2D.PLASMALAMP_OVERLAYCOLOR; light2D.Color = LIGHT2D.PLASMALAMP_COLOR; light2D.Range = 8f; light2D.Angle = 0.0f; light2D.Direction = LIGHT2D.PLASMALAMP_DIRECTION; light2D.Offset = LIGHT2D.PLASMALAMP_OFFSET; light2D.shape = LightShape.Circle; light2D.drawOverlay = true; go.AddOrGetDef <LightController.Def>(); }
public void SetNoActiveLight() { if (ActiveLight == null) { return; } if (Tracker != null) { Destroy(Tracker); } ActiveLight = null; OnNoLightSelected?.Invoke(); }
public Light2D CreateLight(Texture2D texture, float range, Color color, float intensity, float angle, Vector2 position, float fov) { Light2D light = new Light2D() { Texture = texture, Range = range, Color = color, Intensity = intensity, Angle = angle, Position = position, Fov = fov }; Krypton.Lights.Add(light); return(light); }
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 OnLightExit(Light2D _light, GameObject _go) { if (_go.GetInstanceID() == gameObject.GetInstanceID()) { visible -= 1; if (visible <= 0) { Debug.Log("Scream: Object Exited Light"); enemyRenderer.enabled = false; Destroy(gameObject); } } }
// Start is called before the first frame update void Start() { if (SceneManager.GetActiveScene().name == "Play") { pointLight = GetComponent <Light2D>(); globalLight = GameObject.Find("GlobalLight2D").GetComponent <Light2D>(); if (!isPlayer) { if (lightValue - globalLight.intensity >= 0) { pointLight.intensity = lightValue - globalLight.intensity; } } } }
protected virtual void Start() { gameSceneController = FindObjectOfType <GameSceneController>(); if (partToSpawn == null) { Debug.LogError("Assign a part to spawn to the snake head"); } positionsAfterTurn = new Queue <Vector3>(); myRigidbody = GetComponent <Rigidbody2D>(); myRenderer = GetComponentInChildren <SpriteRenderer>(); myLight = GetComponentInChildren <Light2D>(); if (speed < Mathf.Epsilon && editorSpeed > Mathf.Epsilon) { speed = editorSpeed / 2.0f; } if (front != null) { if (((snakeLength - 2) / 2) % 3 == 1) { foreach (Light2D light in GetComponentsInChildren <Light2D>()) { light.color = Color.HSVToRGB(316f / 360, 0.8f, 1); } } else if (((snakeLength - 2) / 2) % 3 == 2) { foreach (Light2D light in GetComponentsInChildren <Light2D>()) { light.color = Color.HSVToRGB(76f / 360, 0.8f, 1); } } else { foreach (Light2D light in GetComponentsInChildren <Light2D>()) { light.color = Color.HSVToRGB(196f / 360, 0.8f, 1); } } } }
protected override void Draw() { Camera.Update(); if (LightsEnabled) { _krypton.Matrix = Camera.View; this._krypton.LightMapPrepare(); } GraphicsDevice.Clear(new Color(240, 240, 240)); _spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, null, Camera.View); foreach (var layer in Map.Layers.Where(p => p.Order <= ActiveLayer.Order).OrderBy(p => p.Order)) { DrawLayer(layer); } _spriteBatch.End(); if (LightsEnabled) { this._krypton.Draw(); } _spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, null, Camera.View); ActiveTool.Draw(_spriteBatch, Camera, _currentMousePosition, _pixel); if (!mouseDown && _movingLight != null) { _movingLight = null; } foreach (Light2D light in _krypton.Lights) { if (light == SelectedLight) { _spriteBatch.Draw(_selectionTexture, light.Position + new Vector2(1, -1), Color.White); } _spriteBatch.Draw(_lightSymbolTexture, light.Position /* - new Vector2(_lightSymbolTexture.Width / 2, _lightSymbolTexture.Height / 2)*/, Color.White); } _spriteBatch.End(); }
static public void BumpedSprite(Light2D light, LightTilemapCollider2D id, Material material) { Texture bumpTexture = id.bumpMapMode.GetBumpTexture(); if (bumpTexture == null) { return; } material.SetTexture("_Bump", bumpTexture); Vector2 lightPosition = -light.transform.position; LightTilemapCollider.Base tilemapCollider = id.GetCurrentTilemap(); if (id.superTilemapEditor.tilemap != null) { if (id.superTilemapEditor.tilemap.Tileset != null) { material.mainTexture = id.superTilemapEditor.tilemap.Tileset.AtlasTexture; } } material.SetPass(0); GL.Begin(GL.QUADS); foreach (LightingTile tile in id.superTilemapEditor.mapTiles) { tile.UpdateTransform(tilemapCollider); Vector2 tilePosition = tile.GetWorldPosition(tilemapCollider); tilePosition += lightPosition; if (tile.NotInRange(tilePosition, light.size)) { continue; } Vector2 scale = tile.worldScale * 0.5f * tile.scale; Rendering.Universal.Texture.DrawPassSTE(tilePosition, scale, tile.uv, tile.worldRotation, 0); } GL.End(); material.mainTexture = null; }
//////////////////////////////////////////////////////////////// IEnumerator C_FaceInLightForSaveParticleSystem() { Light2D light = m_CurrentSaveParticleSystem.GetComponentInChildren <Light2D>(); float time = 0.0f; float totalTime = 0.7f; float maxIntensity = 1.1f; while (time < totalTime) { time += Time.deltaTime; light.intensity = (time / totalTime) * maxIntensity; yield return(new WaitForEndOfFrame()); } }
private static MeshObject GetMeshPixelPerfect(Light2D light) { if (pixelPerfectMeshObject == null) { Camera camera = Camera.main; Rect rect = CameraTransform.GetWorldRect(camera); CalculatePoints(); CalculateOffsets(rect.height * 1.1f / light.size); pixelPerfectMeshObject = GenerateMesh(); } return(pixelPerfectMeshObject); }
void Awake() { _rigidbody = GetComponent <Rigidbody2D>(); _animator = GetComponent <Animator>(); _maxSanity = sanity; _memorySpeed = moveSpeed; _initialCooldown = dashCooldown; //Lights _pointLight = transform.GetChild(0).gameObject; _light = _pointLight.GetComponent <Light2D>(); _maxLightIntensity = _light.intensity; _intensityLoss = (_light.intensity - _minLightIntensity) / lightDurationInSeconds * lightFallOff; _targetMask = LayerMask.GetMask("LightSource"); }
// Start is called before the first frame update void Start() { MainLight = transform.GetChild(0).gameObject; BulbLights = new Light2D[9]; BulbLights[0] = MainLight.transform.GetChild(0).GetComponent <Light2D>(); BulbLights[1] = MainLight.transform.GetChild(1).GetComponent <Light2D>(); BulbLights[2] = MainLight.transform.GetChild(2).GetComponent <Light2D>(); BulbLights[3] = MainLight.transform.GetChild(3).GetComponent <Light2D>(); BulbLights[4] = MainLight.transform.GetChild(4).GetComponent <Light2D>(); BulbLights[5] = MainLight.transform.GetChild(5).GetComponent <Light2D>(); BulbLights[6] = MainLight.transform.GetChild(6).GetComponent <Light2D>(); BulbLights[7] = MainLight.transform.GetChild(7).GetComponent <Light2D>(); BulbLights[8] = MainLight.transform.GetChild(8).GetComponent <Light2D>(); lightState = LightState.DIM; IdleSpores = transform.GetChild(1).gameObject.GetComponent <ParticleSystem>(); }
public static void Draw(Light2D light) { ShadowEngine.Prepare(light); LayerSetting[] layerSettings = light.GetLayerSettings(); if (layerSettings == null) { return; } if (layerSettings.Length < 1) { return; } for (int layerID = 0; layerID < layerSettings.Length; layerID++) { LayerSetting layerSetting = layerSettings[layerID]; if (layerSetting == null) { continue; } if (pass.Setup(light, layerSetting) == false) { continue; } ShadowEngine.SetPass(light, layerSetting); if (layerSetting.sorting == LightLayerSorting.None) { NoSort.Draw(pass); } else { pass.sortPass.SortObjects(); Sorted.Draw(pass); } } LightSource.Main.Draw(light); }
public override void DoPostConfigureComplete(GameObject go) { go.AddOrGet <LoopingSounds>(); Light2D light2D = go.AddOrGet <Light2D>(); light2D.overlayColour = LIGHT2D.CEILINGLIGHT_OVERLAYCOLOR; light2D.Color = new Color(0.5f, 0.5f, 0); light2D.Range = 4f; light2D.Angle = 0f; light2D.Direction = LIGHT2D.FLOORLAMP_DIRECTION; light2D.Offset = new Vector2(0f, 0.5f); light2D.shape = LightShape.Circle; light2D.drawOverlay = true; light2D.Lux = 1800; BuildingTemplates.DoPostConfigure(go); go.GetComponent <KPrefabID>().prefabInitFn += game_object => new LightController.Instance(game_object.GetComponent <KPrefabID>()).StartSM(); }
public static Light2D Create(Vector3 position, Material lightMaterial, Color lightColor, float lightRadius, float sweepStart, int sweepSize, LightDetailSetting detailSetting) { GameObject go = new GameObject("Created Light"); go.transform.position = position; Light2D nLight = go.AddComponent <Light2D>(); nLight.lightMaterial = lightMaterial; nLight.lightColor = lightColor; nLight.lightRadius = lightRadius; nLight.sweepStart = sweepStart; nLight.sweepSize = sweepSize; nLight.lightDetail = detailSetting; return(nLight); }
private IEnumerator Start() { Light2D light = GetComponent <Light2D>(); while (true) { float startIntensity = light.intensity; float targetIntensity = Random.Range(minIntensity, maxIntensity); float targetTime = Random.Range(minTime, maxTime); for (float t = 0; t < targetTime; t += Time.deltaTime) { light.intensity = Mathf.Lerp(startIntensity, targetIntensity, t / targetTime); yield return(null); } } }
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); }
void Start() { //fireParticleEffect = this.gameObject.GetComponent<ParticleSystem>(); torch2dLightComponent = this.gameObject.GetComponent <Light2D>(); minOuterRadius = torch2dLightComponent.pointLightOuterRadius - 0.05f; maxOuterRadius = torch2dLightComponent.pointLightOuterRadius + 0.05f; minInnerRadius = torch2dLightComponent.pointLightInnerRadius - 0.05f; maxInnerRadius = torch2dLightComponent.pointLightInnerRadius + 0.05f; minIntensity = torch2dLightComponent.intensity - 0.02f; maxIntensity = torch2dLightComponent.intensity + 0.02f; InvokeRepeating("Flicker", 0.0f, 0.2f); }