forked from darkmyregaming/EmergencyV
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PlayerManager.cs
95 lines (81 loc) · 2.73 KB
/
PlayerManager.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
namespace EmergencyV
{
// System
using System;
using System.Linq;
// RPH
using Rage;
using Rage.Native;
public enum FirefighterRole
{
None = 0,
Engine,
Battalion,
Rescue,
}
public enum PlayerStateType
{
Normal = 0,
Firefighter = 1,
EMS = 2,
}
internal class PlayerManager
{
private static PlayerManager instance;
public static PlayerManager Instance
{
get
{
if (instance == null)
instance = new PlayerManager();
return instance;
}
}
private Model normalStateModel;
private PlayerStateType playerState;
public PlayerStateType PlayerState { get { return playerState; } }
public bool IsEMS { get { return playerState == PlayerStateType.EMS; } }
public bool IsFirefighter { get { return playerState == PlayerStateType.Firefighter; } }
public FirefighterRole FirefighterRole { get; set; }
private PlayerManager()
{
playerState = PlayerStateType.Normal;
normalStateModel = Game.LocalPlayer.Model;
}
public void Update()
{
}
public void SetPlayerToState(PlayerStateType type)
{
if (playerState == type)
return;
switch (type)
{
default:
case PlayerStateType.Normal:
Game.MaxWantedLevel = 5;
Game.LocalPlayer.Model = normalStateModel;
FirefighterRole = FirefighterRole.None;
break;
case PlayerStateType.Firefighter:
Game.MaxWantedLevel = 0;
normalStateModel = Game.LocalPlayer.Model;
Game.LocalPlayer.Model = Plugin.UserSettings.PEDS.FIREFIGHTER_MODEL;
FirefighterRole = FirefighterRole.Engine;
FireCalloutsManager.Instance.LoadCallouts();
FireCalloutsManager.Instance.ResetNextCalloutTimer();
break;
case PlayerStateType.EMS:
Game.MaxWantedLevel = 0;
normalStateModel = Game.LocalPlayer.Model;
Game.LocalPlayer.Model = Plugin.UserSettings.PEDS.EMS_MODEL;
FirefighterRole = FirefighterRole.None;
EMSCalloutsManager.Instance.LoadCallouts();
EMSCalloutsManager.Instance.ResetNextCalloutTimer();
break;
}
API.Functions.OnPlayerStateChanged(type, playerState);
playerState = type;
}
}
}