summaryrefslogtreecommitdiff
path: root/Client/Assembly-CSharp/Scene1Controller.cs
blob: d1896ee565ffc2d47768646c632727fc81eb052c (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
using System;
using System.Collections;
using UnityEngine;

public class Scene1Controller : SceneController
{
	public PlayerAnimator[] players;

	public DummyConsole[] Consoles;

	public Vector2[] WayPoints;

	public Camera backupCam;

	public void OnDrawGizmos()
	{
		for (int i = 0; i < this.WayPoints.Length; i++)
		{
			Vector2 v = this.WayPoints[i];
			Vector2 v2 = this.WayPoints[(i + 1) % this.WayPoints.Length];
			Gizmos.DrawLine(v, v2);
		}
	}

	public void OnEnable()
	{
		this.backupCam.cullingMask = 0;
		base.StartCoroutine(this.RunPlayer(0));
		base.StartCoroutine(this.RunPlayer(1));
	}

	public void OnDisable()
	{
		this.backupCam.cullingMask = (int.MaxValue ^ LayerMask.GetMask(new string[]
		{
			"UI"
		}));
	}

	private IEnumerator RunPlayer(int idx)
	{
		PlayerAnimator myPlayer = this.players[idx];
		for (;;)
		{
			int num;
			for (int i = 0; i < this.WayPoints.Length; i = num)
			{
				bool willInterrupt = i == 2 || i == 5;
				yield return myPlayer.WalkPlayerTo(this.WayPoints[i], willInterrupt, 0.1f);
				if (willInterrupt)
				{
					yield return this.DoUse(idx, (i == 2) ? 0 : 1);
				}
				num = i + 1;
			}
		}
		yield break;
	}

	private IEnumerator DoUse(int idx, int consoleid)
	{
		PlayerAnimator myPlayer = this.players[idx];
		yield return Scene1Controller.WaitForSeconds(0.2f);
		if (idx == 0)
		{
			yield return myPlayer.finger.MoveTo(myPlayer.UseButton.transform.position, 0.75f);
		}
		else
		{
			yield return myPlayer.finger.MoveTo(this.Consoles[consoleid].transform.position, 0.75f);
		}
		yield return Scene1Controller.WaitForSeconds(0.2f);
		yield return myPlayer.finger.DoClick(0.4f);
		yield return Scene1Controller.WaitForSeconds(0.2f);
		if (!(myPlayer.joystick is DemoKeyboardStick))
		{
			yield return myPlayer.finger.MoveTo(myPlayer.joystick.transform.position, 0.75f);
		}
		else
		{
			yield return Scene1Controller.WaitForSeconds(0.75f);
		}
		yield break;
	}

	public static IEnumerator WaitForSeconds(float duration)
	{
		for (float time = 0f; time < duration; time += Time.deltaTime)
		{
			yield return null;
		}
		yield break;
	}
}