using System; using UnityEngine; public class KeyboardJoystick : MonoBehaviour, IVirtualJoystick { public Vector2 Delta { get { return this.del; } } private Vector2 del; private void Update() { if (!PlayerControl.LocalPlayer) { return; } this.del.x = (this.del.y = 0f); if (Input.GetKey(KeyCode.RightArrow) || Input.GetKey(KeyCode.D)) { this.del.x = this.del.x + 1f; } if (Input.GetKey(KeyCode.LeftArrow) || Input.GetKey(KeyCode.A)) { this.del.x = this.del.x - 1f; } if (Input.GetKey(KeyCode.UpArrow) || Input.GetKey(KeyCode.W)) { this.del.y = this.del.y + 1f; } if (Input.GetKey(KeyCode.DownArrow) || Input.GetKey(KeyCode.S)) { this.del.y = this.del.y - 1f; } if (Input.GetKeyDown(KeyCode.R)) { DestroyableSingleton.Instance.ReportButton.DoClick(); } if (Input.GetKeyDown(KeyCode.Space) || Input.GetKeyDown(KeyCode.E)) { DestroyableSingleton.Instance.UseButton.DoClick(); } if (Input.GetKeyDown(KeyCode.Tab)) { DestroyableSingleton.Instance.ShowMap(delegate(MapBehaviour m) { m.ShowNormalMap(); }); } if (PlayerControl.LocalPlayer.Data.IsImpostor && Input.GetKeyDown(KeyCode.Q)) { DestroyableSingleton.Instance.KillButton.PerformKill(); } if (Input.GetKeyDown(KeyCode.Escape)) { if (Minigame.Instance) { Minigame.Instance.Close(); } else if (DestroyableSingleton.InstanceExists && MapBehaviour.Instance && MapBehaviour.Instance.IsOpen) { MapBehaviour.Instance.Close(); } else { CustomPlayerMenu customPlayerMenu = UnityEngine.Object.FindObjectOfType(); if (customPlayerMenu) { customPlayerMenu.Close(true); } } } this.del.Normalize(); } }