blob: 58beb6f63c7e40711f15370230e1e1dc6f137baa (
plain)
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;
using System.Collections;
using UnityEngine;
public class DummyBehaviour : MonoBehaviour
{
private PlayerControl myPlayer;
private FloatRange voteTime = new FloatRange(3f, 8f);
private bool voted;
public void Start()
{
this.myPlayer = base.GetComponent<PlayerControl>();
}
public void Update()
{
if (this.myPlayer.Data.IsDead)
{
return;
}
if (MeetingHud.Instance)
{
if (!this.voted)
{
this.voted = true;
base.StartCoroutine(this.DoVote());
return;
}
}
else
{
this.voted = false;
}
}
private IEnumerator DoVote()
{
yield return new WaitForSeconds(this.voteTime.Next());
sbyte suspectIdx = -1;
int num = 0;
while (num < 100 && num != 99)
{
int num2 = IntRange.Next(-1, GameData.Instance.PlayerCount);
if (num2 < 0)
{
suspectIdx = (sbyte)num2;
break;
}
GameData.PlayerInfo playerInfo = GameData.Instance.AllPlayers[num2];
if (!playerInfo.IsDead)
{
suspectIdx = (sbyte)playerInfo.PlayerId;
break;
}
num++;
}
MeetingHud.Instance.CmdCastVote(this.myPlayer.PlayerId, suspectIdx);
yield break;
}
}
|