File size: 1,073 Bytes
24b81cb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#ifdef GAME_TEMPLATE

[EditorAttribute("box", "GameLib/Scripted", "Script light", "-0.25 -0.25 -0.25", "0.25 0.25 0.25", "255 0 0 255")]
class ScriptLightClass
{

}

ScriptLightClass ScriptLightSource;

class ScriptLight: GenericEntity
{
	[Attribute("1", "flags", "Flags", "", { ParamEnum("Point", "1"), ParamEnum("Spot", "2"), ParamEnum("Directional", "4") } )]
	int Flags;
	[Attribute("1", "combobox", "Type", "", { ParamEnum("Point", "1"), ParamEnum("Spot", "2"), ParamEnum("Directional", "3") } )]
	int Type;
	[Attribute("1", "editbox", "Radius", "", NULL )]
	float Radius;
	[Attribute("1 1 1", "color", "Color", "", NULL )]
	vector Color;
	[Attribute("1", "editbox", "Intensity", "", NULL )]
	float Intensity;
	HLIGHT m_light;
	
	void ScriptLight(IEntitySource src, IEntity parent)
	{
		//SetFlags(this, EntityFlags.ACTIVE | EntityFlags.SOLID | EntityFlags.VISIBLE);
		m_light = AddLight(this, LightType.POINT, LightFlags.DYNAMIC|LightFlags.CASTSHADOW, Radius, Color * Intensity);
	}

	void ~ScriptLight()
	{
		if(m_light)
		{
			RemoveLight(m_light);
		}
	}
}

#endif