Add lighting other torches with torches

This commit is contained in:
Jens Pitkänen 2020-04-30 03:50:47 +03:00
parent 726c670522
commit f7cbfd9442
2 changed files with 51 additions and 3 deletions

View File

@ -58,11 +58,11 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 443632513096267316}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0.384, z: 0.15199998}
m_LocalPosition: {x: 0.011, y: 0.248, z: -0.008}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 2899778610982221264}
m_RootOrder: 2
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!108 &8748250233633719603
Light:
@ -5098,6 +5098,7 @@ MonoBehaviour:
FireParticles: {fileID: 3254426058832931568}
TorchLight: {fileID: 8748250233633719603}
WarnColor: {r: 1, g: 0.6509804, b: 0.44705883, a: 1}
FireVolume: {fileID: 7969813197317806167}
TorchFuel: 0
--- !u!114 &3611004544794653208
MonoBehaviour:
@ -5141,6 +5142,7 @@ Transform:
m_Children:
- {fileID: 5462489599864937972}
- {fileID: 492264085053241644}
- {fileID: 5403364364719854795}
- {fileID: 8021664233870439167}
- {fileID: 3231062120356253589}
m_Father: {fileID: 4537129283620474398}
@ -5175,7 +5177,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 2899778610982221264}
m_RootOrder: 3
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!82 &6154545472424041098
AudioSource:
@ -5274,6 +5276,50 @@ AudioSource:
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
--- !u!1 &7969813197317806167
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5403364364719854795}
- component: {fileID: 287708470093378576}
m_Layer: 17
m_Name: Fire Volume
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &5403364364719854795
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7969813197317806167}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0.012, y: 0.265, z: -0.015}
m_LocalScale: {x: 0.13, y: 0.13, z: 0.13}
m_Children: []
m_Father: {fileID: 2899778610982221264}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!65 &287708470093378576
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7969813197317806167}
m_Material: {fileID: 0}
m_IsTrigger: 1
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!1 &8047787840955207861
GameObject:
m_ObjectHideFlags: 0

View File

@ -19,6 +19,7 @@ public class ItemVR : MonoBehaviour {
public ParticleSystem FireParticles;
public Light TorchLight;
public Color WarnColor;
public GameObject FireVolume;
[Header("Runtime values")]
public float TorchFuel;
@ -45,6 +46,7 @@ public class ItemVR : MonoBehaviour {
}
if (TorchFuel <= 0) {
FireParticles.Stop();
FireVolume.layer = gameObject.layer;
TorchLight.range = Mathf.Lerp(TorchLight.range, 0, 10f * Time.deltaTime);
if (TorchLight.range < 0.01f) {
TorchLight.enabled = false;