diff options
Diffstat (limited to 'Client/Assembly-CSharp/TutorialManager.cs')
-rw-r--r-- | Client/Assembly-CSharp/TutorialManager.cs | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/Client/Assembly-CSharp/TutorialManager.cs b/Client/Assembly-CSharp/TutorialManager.cs new file mode 100644 index 0000000..ba89235 --- /dev/null +++ b/Client/Assembly-CSharp/TutorialManager.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections; +using InnerNet; +using UnityEngine; + +public class TutorialManager : DestroyableSingleton<TutorialManager> +{ + public PlayerControl PlayerPrefab; + + public Transform[] DummyLocations; + + public override void Awake() + { + base.Awake(); + StatsManager.Instance = new TutorialStatsManager(); + base.StartCoroutine(this.RunTutorial()); + } + + public override void OnDestroy() + { + StatsManager.Instance = new StatsManager(); + base.OnDestroy(); + } + + private IEnumerator RunTutorial() + { + while (!ShipStatus.Instance) + { + yield return null; + } + ShipStatus.Instance.enabled = false; + ShipStatus.Instance.Timer = 15f; + while (!PlayerControl.LocalPlayer) + { + yield return null; + } + if (DestroyableSingleton<DiscordManager>.InstanceExists) + { + DestroyableSingleton<DiscordManager>.Instance.SetHowToPlay(); + } + PlayerControl.GameOptions = new GameOptionsData + { + NumImpostors = 0, + DiscussionTime = 0 + }; + PlayerControl.LocalPlayer.RpcSetInfected(new GameData.PlayerInfo[0]); + for (int i = 0; i < this.DummyLocations.Length; i++) + { + PlayerControl playerControl = UnityEngine.Object.Instantiate<PlayerControl>(this.PlayerPrefab); + playerControl.PlayerId = (byte)GameData.Instance.GetAvailableId(); + GameData.Instance.AddPlayer(playerControl); + AmongUsClient.Instance.Spawn(playerControl, -2, SpawnFlags.None); + playerControl.transform.position = this.DummyLocations[i].position; + playerControl.GetComponent<DummyBehaviour>().enabled = true; + playerControl.NetTransform.enabled = false; + playerControl.SetName("Dummy " + (i + 1)); + playerControl.SetColor((byte)((i < (int)SaveManager.BodyColor) ? i : (i + 1))); + GameData.Instance.RpcSetTasks(playerControl.PlayerId, new byte[0]); + } + ShipStatus.Instance.Begin(); + yield break; + } +} |