diff options
Diffstat (limited to 'Client/Assembly-CSharp/DummyBehaviour.cs')
-rw-r--r-- | Client/Assembly-CSharp/DummyBehaviour.cs | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/Client/Assembly-CSharp/DummyBehaviour.cs b/Client/Assembly-CSharp/DummyBehaviour.cs new file mode 100644 index 0000000..58beb6f --- /dev/null +++ b/Client/Assembly-CSharp/DummyBehaviour.cs @@ -0,0 +1,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; + } +} |