forked from stevefan1999-personal/rustpseudo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAIPoint.cs
59 lines (51 loc) · 1.05 KB
/
AIPoint.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
using System;
using UnityEngine;
public class AIPoint : BaseMonoBehaviour
{
private BaseEntity currentUser;
public bool InUse()
{
return (Object)(object)currentUser != (Object)null;
}
public bool IsUsedBy(BaseEntity user)
{
if (!InUse())
{
return false;
}
if ((Object)(object)user == (Object)null)
{
return false;
}
return (Object)(object)user == (Object)(object)currentUser;
}
public bool CanBeUsedBy(BaseEntity user)
{
if ((Object)(object)user != (Object)null && (Object)(object)currentUser == (Object)(object)user)
{
return true;
}
return !InUse();
}
public void SetUsedBy(BaseEntity user, float duration = 5f)
{
currentUser = user;
((FacepunchBehaviour)this).CancelInvoke((Action)ClearUsed);
((FacepunchBehaviour)this).Invoke((Action)ClearUsed, duration);
}
public void SetUsedBy(BaseEntity user)
{
currentUser = user;
}
public void ClearUsed()
{
currentUser = null;
}
public void ClearIfUsedBy(BaseEntity user)
{
if ((Object)(object)currentUser == (Object)(object)user)
{
ClearUsed();
}
}
}