Compare commits
1 Commits
ui_menu
...
light_lurc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9da1f82f20 |
@@ -9,7 +9,7 @@ Material:
|
|||||||
m_Name: Lurch
|
m_Name: Lurch
|
||||||
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
|
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
|
||||||
m_ShaderKeywords:
|
m_ShaderKeywords:
|
||||||
m_LightmapFlags: 4
|
m_LightmapFlags: 6
|
||||||
m_EnableInstancingVariants: 0
|
m_EnableInstancingVariants: 0
|
||||||
m_DoubleSidedGI: 0
|
m_DoubleSidedGI: 0
|
||||||
m_CustomRenderQueue: -1
|
m_CustomRenderQueue: -1
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ GameObject:
|
|||||||
- component: {fileID: 4211561106277860}
|
- component: {fileID: 4211561106277860}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: Lurch
|
m_Name: Lurch
|
||||||
m_TagString: Untagged
|
m_TagString: Player
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
@@ -35,6 +35,9 @@ GameObject:
|
|||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 4349673492578080}
|
- component: {fileID: 4349673492578080}
|
||||||
- component: {fileID: 114123996009525022}
|
- component: {fileID: 114123996009525022}
|
||||||
|
- component: {fileID: 114729016115082176}
|
||||||
|
- component: {fileID: 114557432824313468}
|
||||||
|
- component: {fileID: 114003328164428386}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: CameraHolder
|
m_Name: CameraHolder
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@@ -71,6 +74,7 @@ GameObject:
|
|||||||
- component: {fileID: 23689017160285550}
|
- component: {fileID: 23689017160285550}
|
||||||
- component: {fileID: 65346116814365424}
|
- component: {fileID: 65346116814365424}
|
||||||
- component: {fileID: 54155385480013682}
|
- component: {fileID: 54155385480013682}
|
||||||
|
- component: {fileID: 108062020484346290}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: LurchTest
|
m_Name: LurchTest
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@@ -249,6 +253,63 @@ AudioListener:
|
|||||||
m_PrefabInternal: {fileID: 100100000}
|
m_PrefabInternal: {fileID: 100100000}
|
||||||
m_GameObject: {fileID: 1444907702125456}
|
m_GameObject: {fileID: 1444907702125456}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
|
--- !u!108 &108062020484346290
|
||||||
|
Light:
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInternal: {fileID: 100100000}
|
||||||
|
m_GameObject: {fileID: 1462012476334488}
|
||||||
|
m_Enabled: 1
|
||||||
|
serializedVersion: 8
|
||||||
|
m_Type: 2
|
||||||
|
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||||
|
m_Intensity: 5
|
||||||
|
m_Range: 20
|
||||||
|
m_SpotAngle: 30
|
||||||
|
m_CookieSize: 10
|
||||||
|
m_Shadows:
|
||||||
|
m_Type: 2
|
||||||
|
m_Resolution: -1
|
||||||
|
m_CustomResolution: -1
|
||||||
|
m_Strength: 1
|
||||||
|
m_Bias: 0.05
|
||||||
|
m_NormalBias: 0.4
|
||||||
|
m_NearPlane: 0.2
|
||||||
|
m_Cookie: {fileID: 0}
|
||||||
|
m_DrawHalo: 0
|
||||||
|
m_Flare: {fileID: 0}
|
||||||
|
m_RenderMode: 0
|
||||||
|
m_CullingMask:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 4294967295
|
||||||
|
m_Lightmapping: 4
|
||||||
|
m_LightShadowCasterMode: 0
|
||||||
|
m_AreaSize: {x: 1, y: 1}
|
||||||
|
m_BounceIntensity: 1
|
||||||
|
m_ColorTemperature: 6570
|
||||||
|
m_UseColorTemperature: 0
|
||||||
|
m_ShadowRadius: 0
|
||||||
|
m_ShadowAngle: 0
|
||||||
|
--- !u!114 &114003328164428386
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInternal: {fileID: 100100000}
|
||||||
|
m_GameObject: {fileID: 1444832767951054}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 167337a6a977deb408440dbf31acb6c9, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
respawnPoints:
|
||||||
|
- {fileID: 0}
|
||||||
|
- {fileID: 0}
|
||||||
|
- {fileID: 0}
|
||||||
|
lowerBounds: {fileID: 0}
|
||||||
|
lurch: {fileID: 1462012476334488}
|
||||||
|
UpdateFrequenzy: 15
|
||||||
|
maxFallDist: 25
|
||||||
|
respawnKey: 114
|
||||||
--- !u!114 &114123996009525022
|
--- !u!114 &114123996009525022
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 1
|
m_ObjectHideFlags: 1
|
||||||
@@ -275,3 +336,51 @@ MonoBehaviour:
|
|||||||
cooldown: 0
|
cooldown: 0
|
||||||
canGlide: 1
|
canGlide: 1
|
||||||
glideForce: 3
|
glideForce: 3
|
||||||
|
--- !u!114 &114557432824313468
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInternal: {fileID: 100100000}
|
||||||
|
m_GameObject: {fileID: 1444832767951054}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: b614d5a678d653549b924deec5548458, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
standardRadius: 20
|
||||||
|
standardIntensity: 5
|
||||||
|
tinyRadius: 7
|
||||||
|
tinyIntensity: 4
|
||||||
|
maxRadius: 150
|
||||||
|
maxIntensity: 6
|
||||||
|
emissionMultiplier: 1
|
||||||
|
maxEmission: 1.5
|
||||||
|
minEmission: 0.25
|
||||||
|
baseEmission: 0.5
|
||||||
|
triggerButton: 102
|
||||||
|
litDuration: 4
|
||||||
|
unLitDuration: 3
|
||||||
|
animationSpeed: 1
|
||||||
|
state: 0
|
||||||
|
t: 0
|
||||||
|
ldCounter: 0
|
||||||
|
--- !u!114 &114729016115082176
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInternal: {fileID: 100100000}
|
||||||
|
m_GameObject: {fileID: 1444832767951054}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 167337a6a977deb408440dbf31acb6c9, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
respawnPoints:
|
||||||
|
- {fileID: 0}
|
||||||
|
- {fileID: 0}
|
||||||
|
- {fileID: 0}
|
||||||
|
lowerBounds: {fileID: 0}
|
||||||
|
lurch: {fileID: 1462012476334488}
|
||||||
|
UpdateFrequenzy: 15
|
||||||
|
maxFallDist: 25
|
||||||
|
respawnKey: 114
|
||||||
|
|||||||
1206
Assets/Scenes/LightLurchTest.unity
Normal file
1206
Assets/Scenes/LightLurchTest.unity
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/Scenes/LightLurchTest.unity.meta
Normal file
7
Assets/Scenes/LightLurchTest.unity.meta
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b5f8c6ef1eb4bb846a5380eaf975ffa7
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
131
Assets/Scripts/LightLurch.cs
Normal file
131
Assets/Scripts/LightLurch.cs
Normal file
@@ -0,0 +1,131 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class LightLurch : MonoBehaviour {
|
||||||
|
|
||||||
|
private enum states { standard, lit, unlit }
|
||||||
|
[Header("Distances")]
|
||||||
|
[SerializeField]
|
||||||
|
private float standardRadius, standardIntensity;
|
||||||
|
[SerializeField]
|
||||||
|
private float tinyRadius, tinyIntensity;
|
||||||
|
[SerializeField]
|
||||||
|
private float maxRadius, maxIntensity;
|
||||||
|
[Header("Emission")]
|
||||||
|
[SerializeField]
|
||||||
|
private float emissionMultiplier = 1;
|
||||||
|
private float emissionValue;
|
||||||
|
[SerializeField]
|
||||||
|
private float maxEmission, minEmission, baseEmission = 1;
|
||||||
|
|
||||||
|
private float intensitySnapshot;
|
||||||
|
private Light lightSource;
|
||||||
|
private Renderer lurchRenderer;
|
||||||
|
|
||||||
|
[SerializeField]
|
||||||
|
private KeyCode triggerButton;
|
||||||
|
[SerializeField]
|
||||||
|
private float litDuration;
|
||||||
|
[SerializeField]
|
||||||
|
private float unLitDuration;
|
||||||
|
[SerializeField]
|
||||||
|
private float animationSpeed;
|
||||||
|
|
||||||
|
[Header("Debug")]
|
||||||
|
[SerializeField]
|
||||||
|
private states state;
|
||||||
|
[SerializeField]
|
||||||
|
private float t = 0;
|
||||||
|
[SerializeField]
|
||||||
|
private float ldCounter;
|
||||||
|
private float llCounter;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Use this for initialization
|
||||||
|
void Start () {
|
||||||
|
state = states.standard;
|
||||||
|
GameObject lurch = GetComponent<LurchMovement>().theLurch.gameObject;
|
||||||
|
lightSource = lurch.GetComponent<Light>();
|
||||||
|
lurchRenderer = lurch.GetComponent<Renderer>();
|
||||||
|
lightSource.color = lurchRenderer.material.GetColor("_Color");
|
||||||
|
intensitySnapshot = lightSource.intensity;
|
||||||
|
lurchRenderer.material.SetColor("_EmissionColor", lightSource.color * (emissionMultiplier * emissionValue));
|
||||||
|
emissionValue = baseEmission;
|
||||||
|
lurchRenderer.material.EnableKeyword("_EMISSION");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update is called once per frame
|
||||||
|
void Update () {
|
||||||
|
t += Time.deltaTime * animationSpeed;
|
||||||
|
lurchRenderer.material.SetColor("_EmissionColor", lightSource.color * (emissionMultiplier * emissionValue));
|
||||||
|
switch (state)
|
||||||
|
{
|
||||||
|
case states.standard:
|
||||||
|
StandardGlow();
|
||||||
|
break;
|
||||||
|
case states.lit:
|
||||||
|
LightUp();
|
||||||
|
break;
|
||||||
|
case states.unlit:
|
||||||
|
GlowLow();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (Input.GetKeyDown(triggerButton) && state == states.standard)
|
||||||
|
{
|
||||||
|
t = 0;
|
||||||
|
ldCounter = litDuration;
|
||||||
|
llCounter = animationSpeed;
|
||||||
|
state = states.lit;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void StandardGlow()
|
||||||
|
{
|
||||||
|
lightSource.intensity = Mathf.Lerp(tinyIntensity, standardIntensity, t);
|
||||||
|
lightSource.range = Mathf.Lerp(tinyRadius, standardRadius, t);
|
||||||
|
emissionValue = Mathf.Lerp(minEmission, baseEmission, t);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LightUp()
|
||||||
|
{
|
||||||
|
lightSource.intensity = Mathf.Lerp(standardIntensity, maxIntensity, t);
|
||||||
|
lightSource.range = Mathf.Lerp(standardRadius, maxRadius, t);
|
||||||
|
emissionValue = Mathf.Lerp(baseEmission, maxEmission, t);
|
||||||
|
|
||||||
|
if (ldCounter <= 0)
|
||||||
|
{
|
||||||
|
t = 0;
|
||||||
|
state = states.unlit;
|
||||||
|
ldCounter = unLitDuration;
|
||||||
|
llCounter = animationSpeed;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ldCounter -= Time.deltaTime;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GlowLow()
|
||||||
|
{
|
||||||
|
lightSource.intensity = Mathf.Lerp(maxIntensity, tinyIntensity, t);
|
||||||
|
lightSource.range = Mathf.Lerp(maxRadius, tinyRadius, t);
|
||||||
|
emissionValue = Mathf.Lerp(maxEmission, minEmission, t);
|
||||||
|
|
||||||
|
|
||||||
|
if (llCounter <= 0)
|
||||||
|
{
|
||||||
|
if (ldCounter <= 0)
|
||||||
|
{
|
||||||
|
t = 0;
|
||||||
|
state = states.standard;
|
||||||
|
llCounter = animationSpeed;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ldCounter -= Time.deltaTime;
|
||||||
|
}
|
||||||
|
llCounter -= Time.deltaTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/LightLurch.cs.meta
Normal file
11
Assets/Scripts/LightLurch.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b614d5a678d653549b924deec5548458
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 681795e0efcef2f49b1daca1f3fa92ab
|
guid: b8b7c82b907af1c45a4d5abd120ab492
|
||||||
folderAsset: yes
|
folderAsset: yes
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
63
Assets/Scripts/TriggerEffects/DarkAmbience.cs
Normal file
63
Assets/Scripts/TriggerEffects/DarkAmbience.cs
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class DarkAmbience : MonoBehaviour {
|
||||||
|
|
||||||
|
private float defaultEnvLightingIntensity, defaultEnfReflectionIntensity;
|
||||||
|
[SerializeField]
|
||||||
|
private float targetEnvLightingIntensity, targetEnfReflectionIntensity;
|
||||||
|
[SerializeField]
|
||||||
|
private float lerpSpeed;
|
||||||
|
[SerializeField]
|
||||||
|
private bool isDark = false;
|
||||||
|
private float t = 0;
|
||||||
|
|
||||||
|
// Use this for initialization
|
||||||
|
void Start () {
|
||||||
|
defaultEnvLightingIntensity = RenderSettings.ambientIntensity;
|
||||||
|
defaultEnfReflectionIntensity = RenderSettings.reflectionIntensity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SwitchDarkness(bool dark)
|
||||||
|
{
|
||||||
|
isDark = dark;
|
||||||
|
t = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnValidate()
|
||||||
|
{
|
||||||
|
t = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnTriggerEnter(Collider other)
|
||||||
|
{
|
||||||
|
if(other.transform.root.tag == "Player")
|
||||||
|
{
|
||||||
|
SwitchDarkness(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnTriggerExit(Collider other)
|
||||||
|
{
|
||||||
|
if (other.transform.root.tag == "Player")
|
||||||
|
{
|
||||||
|
SwitchDarkness(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Update is called once per frame
|
||||||
|
void Update () {
|
||||||
|
|
||||||
|
if(isDark)
|
||||||
|
{
|
||||||
|
RenderSettings.ambientIntensity = Mathf.Lerp(defaultEnvLightingIntensity, targetEnvLightingIntensity, t);
|
||||||
|
RenderSettings.reflectionIntensity = Mathf.Lerp(defaultEnfReflectionIntensity, targetEnfReflectionIntensity, t);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RenderSettings.ambientIntensity = Mathf.Lerp(targetEnvLightingIntensity, defaultEnvLightingIntensity, t);
|
||||||
|
RenderSettings.reflectionIntensity = Mathf.Lerp(targetEnfReflectionIntensity, defaultEnfReflectionIntensity , t);
|
||||||
|
}
|
||||||
|
t += Time.deltaTime * lerpSpeed;
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/TriggerEffects/DarkAmbience.cs.meta
Normal file
11
Assets/Scripts/TriggerEffects/DarkAmbience.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9f0436f919a77164da3e5047c1b7795f
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Reference in New Issue
Block a user