-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDogController.cs
32 lines (26 loc) · 1.11 KB
/
DogController.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
using CitizenFX.Core;
using PoliceMP.Core.Server.Communications.Interfaces;
using PoliceMP.Core.Server.Networking;
using PoliceMP.Shared.Constants;
using PoliceMP.Shared.Enums;
namespace PoliceMP.Server.Controllers
{
public class DogController : Controller
{
private readonly IServerCommunicationsManager _comms;
public DogController(IServerCommunicationsManager comms)
{
_comms = comms;
_comms.On<Player, int, DogSound>(ServerEvents.SendDogSoundEventToServer, OnReceiveSoundEventFromClient);
_comms.On<Player, int, DogFx>(ServerEvents.SendDogParticleFxEventToServer, OnReceiveDogFxEventFromClient);
}
private void OnReceiveSoundEventFromClient(Player player, int dogNetworkId, DogSound soundType)
{
_comms.ToClient(ClientEvents.SendDogSoundEventToClient, dogNetworkId, soundType);
}
private void OnReceiveDogFxEventFromClient(Player player, int dogNetworkId, DogFx dogFx)
{
_comms.ToClient(ClientEvents.SendDogParticleFxEventToClient, dogNetworkId, dogFx);
}
}
}