forked from AgentBlackout/ARainbowTags
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathEventHandler.cs
More file actions
40 lines (33 loc) · 794 Bytes
/
Copy pathEventHandler.cs
File metadata and controls
40 lines (33 loc) · 794 Bytes
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
using System;
using Exiled.API.Features;
using Exiled.Events.EventArgs;
using UnityEngine;
namespace RainbowTags
{
public class EventHandler
{
public RainbowTagMod plugin;
public EventHandler(RainbowTagMod plugin) => this.plugin = plugin;
public void OnRoundStartEvent()
{
foreach (Player Ply in Player.List)
{
if (!Ply.IsRainbowTagUser())
continue;
AddRainbowController(Ply);
}
}
public void OnPlayerJoinEvent(JoinedEventArgs ev)
{
if (!ev.Player.IsRainbowTagUser())
return;
AddRainbowController(ev.Player);
}
public static void AddRainbowController(Player Ply)
{
if (Ply.ReferenceHub.TryGetComponent(out RainbowTagController RainbowTagCtrl))
return;
Ply.GameObject.AddComponent<RainbowTagController>();
}
}
}