public void OnFingerSwipe(Lean.LeanFinger finger) { // Make sure the info text exists if (InfoText != null) { // Store the swipe delta in a temp variable var swipe = finger.SwipeDelta; if (swipe.x < -Mathf.Abs(swipe.y)) { InfoText.text = "You swiped left!"; } if (swipe.x > Mathf.Abs(swipe.y)) { InfoText.text = "You swiped right!"; } if (swipe.y < -Mathf.Abs(swipe.x)) { InfoText.text = "You swiped down!"; } if (swipe.y > Mathf.Abs(swipe.x)) { InfoText.text = "You swiped up!"; } } }
public void OnFingerSwipe(Lean.LeanFinger finger) { // Make sure the info text exists if (gameObject != null) { // Store the swipe delta in a temp variable var swipe = finger.SwipeDelta; Debug.Log(swipe); float h=swipe.normalized.x; float v=swipe.normalized.y; //move direction direction=new Vector3(-v,0f,h).normalized; // rotate float angle=Mathf.Acos(h/Mathf.Sqrt(h*h+v*v)); float a=angle/Mathf.PI*180f; if(v>0f){ a=-a; } Rotate(a); } }
public void OnFingerSwipe(Lean.LeanFinger finger) { // Store the swipe delta in a temp variable var swipe = finger.SwipeDelta; if (swipe.x < -Mathf.Abs(swipe.y)) { Debug.Log ("You swiped left!"); } if (swipe.x > Mathf.Abs(swipe.y)) { Debug.Log ("You swiped right!"); } if (swipe.y < -Mathf.Abs(swipe.x)) { Debug.Log ("You swiped down!"); } if (swipe.y > Mathf.Abs(swipe.x)) { Debug.Log ("You swiped up!"); } }
public void OnFingerTap(Lean.LeanFinger finger) { if(Input.GetMouseButtonDown(1)) { return; } // Does the prefab exist? if (selectedTowerPrefab != null) { // Make sure the finger isn't over any GUI elements if (finger.IsOverGui == false) { // Soft Build this tower, show it's range and stuff but don't let it shoot until we've held down for a second. if(towerBeingPlaced!=null) { Destroy(towerBeingPlaced); towerBeingPlaced = null; } if(lastObjectHovered!=null&&lastObjectHovered.name=="Terrain") { GameObject b = buildTower((int) lastMousePoint.x,(int) lastMousePoint.z); } else { WWTD_Tower t = lastObjectHovered.GetComponent<WWTD_Tower>(); if(t!=null) { t.centerCameraOnMe(); InterfaceManagerUtils.showUpgradeTower(t); } } } } }
public void OnFingerSet(Lean.LeanFinger finger) { // Right side of the screen? if (finger.ScreenPosition.x > Screen.width / 2) { // Does it exist? if (RightObject != null) { // Position it in front of the finger RightObject.position = finger.GetWorldPosition(10.0f); } } // Left side? else { // Does it exist? if (RightObject != null) { // Position it in front of the finger LeftObject.position = finger.GetWorldPosition(10.0f); } } // NOTE: If you want to prevent fingers from crossing sides then you can check finger.StartScreenPosition first }
public void OnFingerTap(Lean.LeanFinger finger) { // Does the prefab exist? if (Prefab != null) { // Make sure the finger isn't over any GUI elements if (finger.IsOverGui == false) { // Clone the prefab, and place it on the spawning plane where the finger was tapped Ray hit = finger.GetRay(); RaycastHit hitResult; if (mSpawningCollider.Raycast(hit, out hitResult, 100.0f)) { Transform clone = GameObject.Instantiate(Prefab) as Transform; clone.transform.position = hitResult.point; // Set image target as parent clone.transform.parent = transform; // Set image target's TrackableBehaviour component as parent (in the event that the above does not work) //clone.transform.parent = mTrackableBehaviour.transform; clone.rotation = Quaternion.identity; clones.Add(clone); } } } }
public void OnFingerSwipe(Lean.LeanFinger finger) { // Get the rigidbody component var rigidbody = GetComponent<Rigidbody>(); // Add force to the rigidbody based on the swipe force rigidbody.AddForce(finger.ScaledSwipeDelta * ForceMultiplier); }
public BaseClass(Vector3 v, int p, string n, TotalMeshes t, Lean le) { Total = t; PublicName = n; points = p; lean = le; StartPoint = v; }
public void OnFingerUp(Lean.LeanFinger finger) { // Was the current finger lifted from the screen? if (finger == draggingFinger) { // Unset the current finger draggingFinger = null; } }
public void OnFingerTap(Lean.LeanFinger finger) { // Does the prefab exist? if (player != null) { // Make sure the finger isn't over any GUI elements player.GetComponent<PlayerController>().Tap(); } }
void Awake() { _firstPersonController = GetComponent <FirstPersonController>(); _actionController = GetComponent <ActionController>(); _visionToggler = GetComponent <VisionToggler>(); _leanScript = GetComponentInChildren <Lean>(); _camera = GetComponentInChildren <Camera>(); _postProcessingBehaviour = GetComponentInChildren <PostProcessingBehaviour>(); _audioListener = GetComponentInChildren <AudioListener>(); _playerHudController = GetComponent <PlayerHUDController>(); _glitchEffect = GetComponentInChildren <GlitchEffect>(); }
public void OnFingerTap(Lean.LeanFinger finger) { if (finger.IsOverGui == false && mButtonCollider != null) { Ray hit = finger.GetRay(); RaycastHit hitResult; if (mButtonCollider.Raycast(hit, out hitResult, 10.0f)) { Application.LoadLevel(Scene); } } }
public void OnFingerSwipe(Lean.LeanFinger finger) { // Make sure the info text exists if (gameObject != null) { Vector3 rbForce=finger.GetDeltaWorldPosition(force,cam); //rbForce+=new Vector3(0f,force,0f); GetComponent<Rigidbody>().AddForce(rbForce); } }
public void OnFingerSwipe( Lean.LeanFinger finger ) { Vector2 swipe = finger.SwipeDelta; if ( swipe.x < -Mathf.Abs( swipe.y ) ) { //swipe left character.model.MoveLeft(); } if ( swipe.x > Mathf.Abs( swipe.y ) ) { //swipe right character.model.MoveRight(); } }
public void OnFingerTap(Lean.LeanFinger finger) { if (finger.IsOverGui == false && mButtonCollider != null) { Ray hit = finger.GetRay(); RaycastHit hitResult; if (mButtonCollider.Raycast(hit, out hitResult, 10.0f)) { newCam.enabled = !newCam.enabled; oldCam.enabled = !oldCam.enabled; } } }
public void OnFingerTap(Lean.LeanFinger finger) { if (finger.IsOverGui == false && mButtonCollider != null) { Ray hit = finger.GetRay(); RaycastHit hitResult; if (mButtonCollider.Raycast(hit, out hitResult, 10.0f)) { mButtonCollider = null; mEnterScene = true; Play.gameObject.SetActive(false); } } }
public void OnFingerTap(Lean.LeanFinger finger) { // Does the prefab exist? if (Prefab != null) { // Make sure the finger isn't over any GUI elements if (finger.IsOverGui == false) { // Clone the prefab, and place it where the finger was tapped var position = finger.GetWorldPosition(50.0f); var rotation = Quaternion.identity; Debug.Log ("Finger Tap!"); } } }
public void OnHeldDown(Lean.LeanFinger finger) { // Does the prefab exist? if (selectedTowerPrefab != null) { // Make sure the finger isn't over any GUI elements if (finger.IsOverGui == false) { // Clone the prefab, and place it where the finger was tapped if(towerBeingPlaced!=null) { towerBeingPlaced.GetComponent<WWTD_Tower>().hardPlace(); towerBeingPlaced = null; } } } }
public void OnFingerDown(Lean.LeanFinger finger) { // Raycast information var ray = finger.GetRay(); var hit = default(RaycastHit); // Was this finger pressed down on a collider? if (Physics.Raycast(ray, out hit, float.PositiveInfinity, LayerMask) == true) { // Was that collider this one? if (hit.collider.gameObject == gameObject) { // Set the current finger to this one draggingFinger = finger; } } }
public void OnFingerTap(Lean.LeanFinger finger) { // Does the prefab exist? if (Prefab != null) { // Make sure the finger isn't over any GUI elements if (finger.IsOverGui == false) { // Clone the prefab, and place it where the finger was tapped var position = finger.GetWorldPosition(50.0f); var rotation = Quaternion.identity; var clone = (GameObject)Instantiate(Prefab, position, rotation); // Make sure the prefab gets destroyed after some time Destroy(clone, 2.0f); } } }
static Maze GetMaze(string fileName) { const string RECORD_DELIMITER = "-1"; using (var fs = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) using (var sr = new StreamReader(fs, Encoding.Default)) { var dimensions = GetDimensions(sr.ReadLine()); var maze = new Maze(dimensions.First(), dimensions.Last()); if (sr.ReadLine() != RECORD_DELIMITER) { throw new Exception("Invalid Definition File Format!!"); } string line = sr.ReadLine(); while (line != RECORD_DELIMITER) { var mirrorRegex = new Regex("(?:RR|RL|LR|LL|R|L)"); var mirrorMatch = mirrorRegex.Match(line); var mirrorDetails = mirrorRegex.Match(line).Value; Lean lean = mirrorDetails.Substring(0, 1) == "R" ? Lean.Right : Lean.Left; ReflectiveSide side = mirrorDetails.Length == 2 ? mirrorDetails.Substring(1, 1) == "R" ? ReflectiveSide.Right : ReflectiveSide.Left : ReflectiveSide.Both; var mirrorDimensions = GetDimensions(line.Substring(0, mirrorMatch.Index)); maze.AddMirror(new Mirror(lean, side), new Room(mirrorDimensions.First(), mirrorDimensions.Last())); line = sr.ReadLine(); } line = sr.ReadLine(); var entryRoomRegex = new Regex("(?:V|H)"); var entryRoomMatch = entryRoomRegex.Match(line); var entryRoomDetails = entryRoomRegex.Match(line).Value; var entryRoomDimensions = GetDimensions(line.Substring(0, entryRoomMatch.Index)); maze.EntryRoom = new Room(entryRoomDimensions.First(), entryRoomDimensions.Last()); maze.LazerOrientation = entryRoomDetails == "V" ? LaserOrientation.Vertical : LaserOrientation.Horizontal; return(maze); } }
public void OnFingerSwipe(Lean.LeanFinger finger) { // Raycast information var ray = finger.GetStartRay(); var hit = default(RaycastHit); // Was this finger pressed down on a collider? if (Physics.Raycast(ray, out hit, float.PositiveInfinity, LayerMask) == true) { // Was that collider this one? if (hit.collider.gameObject == gameObject) { // Get the rigidbody component var rigidbody = GetComponent<Rigidbody>(); // Add force to the rigidbody based on the swipe force rigidbody.AddForce(finger.ScaledSwipeDelta * ForceMultiplier); } } }
/// <summary> /// Adds the collider to the lean ability. /// </summary> /// <param name="leanAbility">The ability to add the collider to.</param> /// <param name="parent">The parent of the lean ability.</param> private void AddLeanCollider(Lean leanAbility, GameObject parent) { // Position the collider under the Colliders GameObject if it exists. Transform collidersTransform; if ((collidersTransform = parent.transform.Find("Colliders"))) { parent = collidersTransform.gameObject; } var leanCollider = new GameObject("Lean Collider"); leanCollider.layer = LayerManager.SubCharacter; leanCollider.transform.SetParentOrigin(parent.transform); leanCollider.transform.localPosition = new Vector3(0, 1.5f, 0); var leanCapsuleCollider = leanCollider.AddComponent <CapsuleCollider>(); leanCapsuleCollider.radius = 0.3f; leanCapsuleCollider.height = 1; leanAbility.Collider = leanCapsuleCollider; }
public void OnFingerTap(Lean.LeanFinger finger) { // Does the prefab exist? if (selectedTowerPrefab != null) { // Make sure the finger isn't over any GUI elements if (finger.IsOverGui == false) { // Soft Build this tower, show it's range and stuff but don't let it shoot until we've held down for a second. if(towerBeingPlaced!=null) { Destroy(towerBeingPlaced); towerBeingPlaced = null; } GameObject b = buildTower((int) lastMousePoint.x,(int) lastMousePoint.z); if(b!=null) { WWTD_Tower tower = b.GetComponent<WWTD_Tower>(); tower.softPlace(); towerBeingPlaced = tower.gameObject; } } } }
public void OnFingerSwipe(Lean.LeanFinger finger) { // Store the swipe delta in a temp variable var swipe = finger.SwipeDelta; if (swipe.x < -Mathf.Abs(swipe.y)) { Debug.Log ("You swiped left!"); currentImage++; LoopArray(); rawImage.texture = imageArray[currentImage]; } if (swipe.x > Mathf.Abs(swipe.y)) { Debug.Log ("You swiped right!"); currentImage--; LoopArray(); rawImage.texture = imageArray[currentImage]; } }
public void OnFingerSwipe(Lean.LeanFinger finger) { // Store the swipe delta in a temp variable var swipe = finger.SwipeDelta; if(swipe.magnitude>SwipeThreshold ){ if (swipe.x < -Mathf.Abs(swipe.y)) { Debug.Log( "You swiped left!"); //_thisY+=SensitivityRotation; newQuaternion=Quaternion.AngleAxis(90,Vector3.up)*transform.rotation; } if (swipe.x > Mathf.Abs(swipe.y)) { newQuaternion=Quaternion.AngleAxis(-90,Vector3.up)*transform.rotation; } if (swipe.y < -Mathf.Abs(swipe.x)) { //_parentX+=SensitivityRotation; newQuaternion=Quaternion.AngleAxis(90,Vector3.right)*transform.rotation; } if (swipe.y > Mathf.Abs(swipe.x)) { newQuaternion=Quaternion.AngleAxis(-90,Vector3.right)*transform.rotation; } } }
public void OnFingerSwipe(Lean.LeanFinger finger) { // Store the swipe delta in a temp variable var swipe = finger.SwipeDelta; if(swipe.magnitude>SwipeThreshold ){ if (swipe.x < -Mathf.Abs(swipe.y)) { Debug.Log( "You swiped left!"); RotateLeft(); } if (swipe.x > Mathf.Abs(swipe.y)) { RotateRight(); } if (swipe.y < -Mathf.Abs(swipe.x)) { //_parentX+=SensitivityRotation; RotateDown(); } if (swipe.y > Mathf.Abs(swipe.x)) { RotateUp(); } } }
public void OnFingerTap(Lean.LeanFinger finger) { Debug.Log("Finger " + finger.Index + " tapped the screen"); }
/// <summary> /// Removes the collider from the lean ability. /// </summary> /// <param name="leanAbility">The ability to remove the collider from.</param> /// <param name="parent">The parent of the lean ability.</param> private void RemoveLeanCollider(Lean leanAbility, GameObject parent) { UnityEngine.Object.DestroyImmediate(leanAbility.Collider.gameObject, true); leanAbility.Collider = null; }
public Mirror(Lean lean, ReflectiveSide reflectiveSide) { Lean = lean; ReflectiveSide = reflectiveSide; }
public void OnFingerTap(Lean.LeanFinger finger) { if (finger.IsOverGui == false && !finished) { if (!placeClip.isPlaying){ placeClip.Play(); } Ray hit = finger.GetRay(); RaycastHit hitResult; bool hitFirst = false; bool hitPlay = false; if (direction == 1) { for (int i = 0; i < frontView.transform.childCount; i++) { if (frontView.transform.GetChild (i).GetComponent<BoxCollider> ().Raycast (hit, out hitResult, 1000.0f)) { if (frontView.transform.GetChild (i).GetComponent<Renderer> ().material.renderQueue == 2000) { frontView.transform.GetChild (i).GetComponent<Renderer> ().material = notPlaced; frontView.transform.GetChild (i).GetComponent<Renderer> ().material.renderQueue = 2001; } else if (frontView.transform.GetChild (i).GetComponent<Renderer> ().material.renderQueue == 2001) { frontView.transform.GetChild (i).GetComponent<Renderer> ().material = placed; frontView.transform.GetChild (i).GetComponent<Renderer> ().material.renderQueue = 2000; } hitFirst = true; hitPlay = true; break; } } for (int i = 0; i < backView.transform.childCount; i++) { if (hitFirst) break; if (backView.transform.GetChild (i).GetComponent<BoxCollider> ().Raycast (hit, out hitResult, 1000.0f)) { if (backView.transform.GetChild (i).GetComponent<Renderer> ().material.renderQueue == 2000) { backView.transform.GetChild (i).GetComponent<Renderer> ().material = notPlaced; backView.transform.GetChild (i).GetComponent<Renderer> ().material.renderQueue = 2001; } else if (backView.transform.GetChild (i).GetComponent<Renderer> ().material.renderQueue == 2001) { backView.transform.GetChild (i).GetComponent<Renderer> ().material = placed; backView.transform.GetChild (i).GetComponent<Renderer> ().material.renderQueue = 2000; } hitPlay = true; break; } } } else { for (int i = 0; i < backView.transform.childCount; i++) { if (backView.transform.GetChild (i).GetComponent<BoxCollider> ().Raycast (hit, out hitResult, 1000.0f)) { if (backView.transform.GetChild (i).GetComponent<Renderer> ().material.renderQueue == 2000) { backView.transform.GetChild (i).GetComponent<Renderer> ().material = notPlaced; backView.transform.GetChild (i).GetComponent<Renderer> ().material.renderQueue = 2001; } else if (backView.transform.GetChild (i).GetComponent<Renderer> ().material.renderQueue == 2001) { backView.transform.GetChild (i).GetComponent<Renderer> ().material = placed; backView.transform.GetChild (i).GetComponent<Renderer> ().material.renderQueue = 2000; } hitFirst = true; hitPlay = true; break; } } for (int i = 0; i < frontView.transform.childCount; i++) { if (hitFirst) break; if (frontView.transform.GetChild (i).GetComponent<BoxCollider> ().Raycast (hit, out hitResult, 1000.0f)) { if (frontView.transform.GetChild (i).GetComponent<Renderer> ().material.renderQueue == 2000) { frontView.transform.GetChild (i).GetComponent<Renderer> ().material = notPlaced; frontView.transform.GetChild (i).GetComponent<Renderer> ().material.renderQueue = 2001; } else if (frontView.transform.GetChild (i).GetComponent<Renderer> ().material.renderQueue == 2001) { frontView.transform.GetChild (i).GetComponent<Renderer> ().material = placed; frontView.transform.GetChild (i).GetComponent<Renderer> ().material.renderQueue = 2000; } hitPlay = true; break; } } } /*Renderer[] renderF = frontView.GetComponentsInChildren<Renderer> (); foreach (Renderer f in renderF){ if (f.material.renderQueue == 2000 || f.material.renderQueue == 2001) { if (f.GetComponent<BoxCollider> ().Raycast (hit, out hitResult, 1000.0f)) { if (f.material == notPlaced) { f.material = placed; f.material.renderQueue = 2000; } else { f.material = notPlaced; f.material.renderQueue = 2001; } break; } } } Renderer[] renderB = backView.GetComponentsInChildren<Renderer> (); foreach (Renderer b in renderB){ if (b.material.renderQueue == 2000 || b.material.renderQueue == 2001) { if (b.GetComponent<BoxCollider> ().Raycast (hit, out hitResult, 1000.0f)) { if (b.material == notPlaced) { b.material = placed; b.material.renderQueue = 2000; } else { b.material = notPlaced; b.material.renderQueue = 2001; } break; } } }*/ } }
public void OnFingerSwipe(Lean.LeanFinger finger) { Debug.Log("Finger " + finger.Index + " swiped the screen"); }
public void OnFingerHeldDown(Lean.LeanFinger finger) { Debug.Log("Finger " + finger.Index + " began touching the screen for a long time"); }
public void OnFingerHeld(Lean.LeanFinger finger) { Debug.Log("Finger " + finger.Index + " is still touching the screen for a long time"); }
public void OnFingerHeldUp(Lean.LeanFinger finger) { Debug.Log("Finger " + finger.Index + " stopped touching the screen for a long time"); }
public void OnFingerTap(Lean.LeanFinger finger) { // Does the prefab exist? if (Prefab != null) { // Make sure the finger isn't over any GUI elements if (finger.IsOverGui == false) { Ray hit = finger.GetRay(); RaycastHit hitResult; var position = hit.origin; Vector3 referenceForward; Vector3 newDirection; float angle1, angle2, angle3; for (int i = 0; i < 7; i++) { if (mPieceCollider[i] == null) continue; if (mPieceCollider[i].Raycast(hit, out hitResult, 100.0f)) // see if collide { int j = i * 6; referenceForward = Vertices[j].transform.position - position; newDirection = Vertices[j+3].transform.position - position; angle1 = Vector3.Angle(newDirection, referenceForward); referenceForward = Vertices[j+1].transform.position - position; newDirection = Vertices[j+4].transform.position - position; angle2 = Vector3.Angle(newDirection, referenceForward); referenceForward = Vertices[j+2].transform.position - position; newDirection = Vertices[j+5].transform.position - position; angle3 = Vector3.Angle(newDirection, referenceForward); if (angle1 < Treshold && angle2 < Treshold && angle3 < Treshold) { //position = hitResult.point; //var rotation = Quaternion.identity; //var clone = (GameObject)Instantiate(Prefab, position, rotation); // Make sure the prefab gets destroyed after some time //Destroy(clone, 2.0f); swap (i); mPieceCollider[i] = null; break; } break; } } } } }