void Awake() { Joystick = FindObjectOfType <Joystick>(); TouchField = FindObjectOfType <TouchField>(); Button = GameObject.Find("FireButton"); //FindObjectOfType<Button>(); //UpButton = GameObject.Find("UpButton"); //DownButton = GameObject.Find("DownButton"); }
void Look(TouchField AimerOrShooter, float LookMultiplier) { //transform.Rotate(Vector3.up * Aimer.Horizontal* LookMultiplier); Rigidbody.MoveRotation(Rigidbody.rotation * Quaternion.Euler(new Vector3(0, AimerOrShooter.TouchDistance.x * LookMultiplier, 0))); verticalLookRotation += AimerOrShooter.TouchDistance.y * LookMultiplier;//Aimer.Vertical; verticalLookRotation = Mathf.Clamp(verticalLookRotation, -90f, 90f); PlayerCamera.transform.localEulerAngles = Vector3.left * verticalLookRotation; }
void Start() { _controller = GetComponent <CharacterController> (); _camAnimator = Camera.main.GetComponent <Animator> (); _input = GameObject.FindGameObjectWithTag("MobileJoystick").GetComponent <MobileInput> (); _field = GameObject.FindGameObjectWithTag("TouchField").GetComponent <TouchField> (); _transform = transform; }
// Start is called before the first frame update void Start() { Joystick = FindObjectOfType <Joystick>(); TouchField = FindObjectOfType <TouchField>(); var buttons = new List <Button>(FindObjectsOfType <Button>()); JumpButton = buttons.Find(b => b.gameObject.name == "btnJump"); ShootButton = buttons.Find(b => b.gameObject.name == "btnShoot"); Player = GetComponent <Play>(); }
// Use this for initialization void Start() { Joystick = FindObjectOfType <Joystick>(); var buttons = new List <Button>(FindObjectsOfType <Button>()); JumpButton = buttons.Find(b => b.gameObject.name == "JumpButton"); OpenButton = buttons.Find(b => b.gameObject.name == "OpenButton"); CarButton = buttons.Find(b => b.gameObject.name == "btnCar"); StealButton = buttons.Find(b => b.gameObject.name == "StealButton"); MarketButton = buttons.Find(b => b.gameObject.name == "MarketButton"); TouchField = FindObjectOfType <TouchField>(); Player = FindObjectOfType <Player>(); camera = GetComponentInChildren <Camera>(); TouchField.UseFixedUpdate = true; OpenB.SetActive(false); }
// Use this for initialization void Awake() { Joystick = FindObjectOfType <FixedJoystick>(); Button = FindObjectOfType <Button>(); TouchField = FindObjectOfType <TouchField>(); }
protected void Page_Load(object sender, EventArgs e) { if (Request.HttpMethod == "POST" && !IsPostBack) { //Gesture data was sent via POST request var jss = new System.Web.Script.Serialization.JavaScriptSerializer(); var inputStream = new StreamReader(Request.InputStream); var jsonData = inputStream.ReadToEnd(); var data = jss.Deserialize <List <object> >(jsonData); var userID = int.Parse((string)data[0]); var gestureID = int.Parse((string)data[1]); //var userID = 1; //var gestureID = 1; var deviceInfo = (Dictionary <string, object>)data[2]; var touchFieldInfo = (Dictionary <string, object>)data[3]; var gestureData = (object[])data[4]; DeviceInfo dInfo = new DeviceInfo(); dInfo.ScreenW = (int)deviceInfo["screenW"]; dInfo.ScreenH = (int)deviceInfo["screenH"]; dInfo.Platform = (string)deviceInfo["platform"]; dInfo.UserAgent = (string)deviceInfo["userAgent"]; TouchField tfInfo = new TouchField(); tfInfo.Top = (int)touchFieldInfo["top"]; tfInfo.Bottom = (int)touchFieldInfo["bottom"]; tfInfo.Left = (int)touchFieldInfo["left"]; tfInfo.Right = (int)touchFieldInfo["right"]; tfInfo.Width = (int)touchFieldInfo["width"]; tfInfo.Height = (int)touchFieldInfo["height"]; //var trace = new SortedList<long, Touch>(gestureData.Length); var trace = new LinkedList <Touch>(); foreach (object[] touchEvent in gestureData) { foreach (object touchData in touchEvent) { var touchObject = (Dictionary <string, object>)touchData; var touch = new Touch(); if (touchObject["id"] is long) { touch.FingerId = (long)touchObject["id"]; } else { touch.FingerId = (int)touchObject["id"]; } touch.X = (decimal)touchObject["x"]; touch.Y = (decimal)touchObject["y"]; /* * touch.RadiusX = (decimal)touchObject["radiusX"]; * touch.RadiusY = (decimal)touchObject["radiusY"]; * touch.RotationAngle = (decimal)touchObject["rotationAngle"]; * touch.Force = (decimal)touchObject["force"]; */ touch.Time = (long)touchObject["time"]; //trace.Add(touch.Time, touch); trace.AddLast(touch); } } GestureDatabase.addTrace(trace, gestureID, dInfo, tfInfo); Response.StatusCode = 200; Response.StatusDescription = "OK"; Response.SuppressContent = true; Response.ClearContent(); } /* * if (Request.HttpMethod == "GET") * { * string idStr = Request.Params.Get("GetTraceCount"); * if(!string.IsNullOrEmpty(idStr)) * { * int n = GestureDatabase.TraceCount(int.Parse(idStr)); * * Response.Clear(); * Response.StatusCode = 200; * Response.Status = "200 OK"; * Response.ContentType = "text/plain"; * Response.Output.Write(n); * Response. * } * } */ }