private void HandleMultiTouch(Touch touch) { touchZero = Input.GetTouch(0); touchOne = Input.GetTouch(1); touchZeroPrevPos = touchZero.position - touchOnePrevPos.deltaPosition; touchOnePrevPos = touchOne.position - touchOnePrevPos.deltaPosition; prevTouchDeltaMag = (touchZeroPrevPos - touchOnePrevPos).magnitude; touchDeltaMag = (touchZero.position - touchOne.position).magnitude; // Find the difference in the distance between each frame // Tìm sự khác biệt về khoảng cách giữa mỗi frame deltaMagnitudeDiff = prevTouchDeltaMag - touchDeltaMag; // If the camera is orthographic. // if (camera.orthographic) { //change the orthographic size based on the change in distance between the touches. camera.orthographicSize += deltaMagnitudeDiff * orthoZoomSpeed; // Make sure the orthographic size never drops below zero. camera.orthographicSize = Mathf.Max(camera.orthographicSize, 10f); } else { //otherwise change the field of view based on the change in between the touches. camera.fieldOfView += deltaMagnitudeDiff * perspectiveZoomSpeed; // Clamp the field of view to make sure it's between 10 and 90: camera.fieldOfView = Math.Clamp(camera.fieldOfView, 10f, 90f); } }
void Start() { script = touch.GetComponent <touch> (); animator = camer.GetComponent <Animator>(); textfield.SetActive(false); }
// Start is called before the first frame update void Start() { //マウスポジションの取得 GameManeger = GameObject.Find("GameManeger"); Mouse = GameManeger.GetComponent <Mouse_Operation>(); // Astar初期化 RouteManager.Instance.Initialize(tileSize); ///////////////////////////////////// /*////////GameObjectFind///////////*/ ///////////////////////////////////// player = GameObject.Find("Char"); Tansu = GameObject.Find("NewWallManager"); deathTileMap = GameObject.Find("DeathTileMap"); Touch = Tansu.GetComponent <touch>(); anim = player.GetComponent <Animator>(); /////////////////////////////////////// /*//////////TileMapFind/////////////*/ ///////////////////////////////////// tilemap = GetComponent <Tilemap>(); Death = deathTileMap.GetComponent <Tilemap>(); //当たり判定の初期化 InitSetLock(tilemap); DeathTileMap(Death); _startNodeId.x = (int)player.transform.position.x; _startNodeId.y = (int)player.transform.position.y - 1; //最短経路の計算 RouteManager.Instance.SearchRoute(_startNodeId, goalNodeId, _routeList, tilemap); }
// Use this for initialization void Start() { //フォントさくせい this.labelStyle = new GUIStyle(); this.labelStyle.fontSize = Screen.height / 20; this.labelStyle.normal.textColor = Color.blue; touchScript = touch.GetComponent <touch>(); }
// Update is called once per frame void FixedUpdate() { isgrounded = Physics2D.OverlapCircle(ground.position, checkradius, isGround); touch script = GetComponent <touch> (); //getting groundcheck from touch script if (lpressed == true && script.vertical == false && script.side == 1 && isgrounded == true) //if left and horizontal { rb.velocity = new Vector2(-speed, 0); r.flipX = true; } else if (rpressed == true && script.vertical == false && script.side == 1 && isgrounded == true) //right and horizontal { rb.velocity = new Vector2(speed, 0); r.flipX = false; } else if (lpressed == true && script.vertical == false && script.side == 2 && isgrounded == true) //if left and horizontal side up { rb.velocity = new Vector2(-speed, 0); r.flipX = false; } else if (rpressed == true && script.vertical == false && script.side == 2 && isgrounded == true) //right and horizontal side up { rb.velocity = new Vector2(speed, 0); r.flipX = true; } else if (lpressed == true && script.vertical == true && script.side == 4 && isgrounded == true) //left and verticalm side left { rb.velocity = new Vector2(0, speed); r.flipX = true; } else if (rpressed == true && script.vertical == true && script.side == 4 && isgrounded == true) //right and vertical side left { rb.velocity = new Vector2(0, -speed); r.flipX = false; } else if (lpressed == true && script.vertical == true && script.side == 3 && isgrounded == true) //left and vertical side right { rb.velocity = new Vector2(0, -speed); r.flipX = true; } else if (rpressed == true && script.vertical == true && script.side == 3 && isgrounded == true) //right and vertical side right { rb.velocity = new Vector2(0, speed); r.flipX = false; } }
public float GetTouchInfrationLevel() { if (touch == null) { return(0); } touch tc = (touch)touch.GetComponent(typeof(touch)); return(tc.GetInfrationLevel()); }
public bool IsInTouchRadius(Vector3 position) { if (touch == null) { return(false); } touch tc = (touch)touch.GetComponent(typeof(touch)); return(tc.IsInRadius(position)); }
void OnTriggerExit(Collider other) { int pID = other.GetInstanceID(); for (int i = 0; i < touches.Count; i++) { if (touches[i].playerId == pID) { touch temp = touches[i]; temp.left = true; touches[i] = temp; break; } } }
void Start() { script = touch.GetComponent <touch> (); animator = camer.GetComponent <Animator>(); }
void Start() { script = touch.GetComponent <touch>(); textfield.SetActive(false); toggleObj.SetActive(false); }