-
Notifications
You must be signed in to change notification settings - Fork 1
/
VehicleServices.cs
63 lines (47 loc) · 1.51 KB
/
VehicleServices.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
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace GarageLite
{
public class VehicleServices : MonoBehaviour
{
public Dictionary<string, List<VehicleInfo>> CodesCooldown { get; set; }
public VehicleDatabase database => MQSPlugin.Instance.VehiclesStoreDatabase;
void Awake()
{
CodesCooldown = new Dictionary<string, List<VehicleInfo>>();
}
void Start()
{
}
void OnDestroy()
{
}
public bool HasVehicles(string playerId, string name)
{
var hasVehicles = database.Data.FirstOrDefault(x => x.PlayerId.Equals(playerId) && x.Name == name);
if (hasVehicles == null)
{
return false;
}
return true;
}
public void RegisterVehicle(string playerId, string name, ushort id, ushort health, ushort battery, ushort fuel)
{
var vehicleinfo = new VehicleInfo
{
PlayerId = playerId,
Name = name,
VehicleId = id,
VehicleHealth = health,
VehicleBattery = battery,
VehicleFuel = fuel,
};
database.AddVehicle(vehicleinfo);
}
public void QuitVehicle(string name, string id)
{
database.RetrieveVehicle(name, id);
}
}
}