-
Notifications
You must be signed in to change notification settings - Fork 1
/
LightNPCs.cs
48 lines (42 loc) · 1.16 KB
/
LightNPCs.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
namespace LightingEssentials;
public class LightNPCs : GlobalNPC
{
private float red = 0f;
public override bool InstancePerEntity
{
get => true;
}
public override void DrawEffects(NPC npc, ref Color drawColor)
{
if (LightingEssentials.Config.Experimental)
{
if (npc.type == NPCID.EyeofCthulhu)
{
for (int x = 0; x < 10; x++)
{
for (int y = 0; y < 10; y++)
{
Lighting.AddLight(npc.position + new Vector2(16 * x, 16 * y), new Vector3(1.0f, 0, 0));
}
}
}
}
if (LightingEssentials.Config.EntityRedHitLight)
{
if (red > 0.0f)
{
Lighting.AddLight(npc.position, new Vector3(red, 0, 0));
red -= 0.01f;
}
}
}
public override void HitEffect(NPC npc, NPC.HitInfo hit)
{
if (!LightingEssentials.Config.EntityRedHitLight)
{
return;
}
float ratio = (float) npc.life / npc.lifeMax;
red = (ratio - 1) * -1;
}
}