-
Notifications
You must be signed in to change notification settings - Fork 294
/
Copy pathLightLayer.cs
57 lines (49 loc) · 1.06 KB
/
LightLayer.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
namespace SecondStar.LevelDesign
{
public class LightLayer : MonoBehaviour
{
public enum OverlayMode
{
SoftLight,
HardLight,
Overlay
}
public OverlayMode blendMode;
public float opacity = 1;
public Color lightColor;
public float lightVolume;
public Shader LightShader
{
get
{
return Shader.Find("Kbd/Lighting/" + blendMode);
}
}
public List<GameObject> attachedObjects = new List<GameObject>();
public void AttachObjectLight(GameObject targetObject)
{
attachedObjects.Add(targetObject);
targetObject.layer = gameObject.layer;
}
public void SetToActiveLightLayer()
{
SetToLayer(LayerMask.NameToLayer("active-light"));
}
public void SetToInactiveLightLayer()
{
SetToLayer(LayerMask.NameToLayer("light"));
}
void SetToLayer(int layer)
{
//Debug.Log("Set to layer " + layer);
gameObject.layer = layer;
foreach (GameObject attachedObject in attachedObjects)
{
attachedObject.layer = layer;
}
}
}
}