-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBodyGlowDrawLayer.cs
48 lines (42 loc) · 1.11 KB
/
BodyGlowDrawLayer.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
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Terraria.DataStructures;
using Terraria.ModLoader;
namespace JourneyTrend
{
public class BodyGlowmaskPlayer : ModPlayer
{
private static Dictionary<int, Func<Color>> BodyColor { get; set; }
/// <summary>
/// Add glowmask color associated with the body equip slot here, usually in <see cref="ModType.SetStaticDefaults"/>.
/// <para>Don't forget the !Main.dedServ check!</para>
/// </summary>
/// <param name="bodySlot">Body equip slot</param>
/// <param name="color">Color</param>
public static void RegisterData(int bodySlot, Func<Color> color)
{
if (!BodyColor.ContainsKey(bodySlot))
{
BodyColor.Add(bodySlot, color);
}
}
public override void Load()
{
BodyColor = new Dictionary<int, Func<Color>>();
}
public override void Unload()
{
BodyColor = null;
}
public override void ModifyDrawInfo(ref PlayerDrawSet drawInfo)
{
if (!BodyColor.TryGetValue(Player.body, out Func<Color> color))
{
return;
}
drawInfo.bodyGlowColor = color();
drawInfo.armGlowColor = color();
}
}
}