Ejemplo n.º 1
0
	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!";
			}
		}
	}
Ejemplo n.º 2
0
    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);

        }
    }
Ejemplo n.º 3
0
	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!");
		}
	}
Ejemplo n.º 4
0
	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);
					}
				} 

			}
		}
	}
Ejemplo n.º 5
0
	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
	}
Ejemplo n.º 6
0
    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;
 }
Ejemplo n.º 9
0
	public void OnFingerUp(Lean.LeanFinger finger)
	{
		// Was the current finger lifted from the screen?
		if (finger == draggingFinger)
		{
			// Unset the current finger
			draggingFinger = null;
		}
	}
Ejemplo n.º 10
0
 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();
         
     }
 }
Ejemplo n.º 11
0
 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>();
 }
Ejemplo n.º 12
0
	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);
			}
		}
	}
Ejemplo n.º 13
0
    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);

        }
    }
Ejemplo n.º 14
0
	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();
		}
	}
Ejemplo n.º 15
0
	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;
			}
		}
	}
Ejemplo n.º 16
0
	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);
			}
		}
	}
Ejemplo n.º 17
0
	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!");
			}
		}
	}
Ejemplo n.º 18
0
	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;
				}
			}
		}
	}
Ejemplo n.º 19
0
	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;
			}
		}
	}
Ejemplo n.º 20
0
	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);
			}
		}
	}
Ejemplo n.º 21
0
        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);
                }
        }
Ejemplo n.º 22
0
	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);
			}
		}
	}
Ejemplo n.º 23
0
        /// <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;
        }
Ejemplo n.º 24
0
	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;
				}
			}
		}
	}
Ejemplo n.º 25
0
    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];

        }
    }
Ejemplo n.º 26
0
    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;
            }
        }
    }
Ejemplo n.º 27
0
    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();

            }
        }
    }
Ejemplo n.º 28
0
	public void OnFingerTap(Lean.LeanFinger finger)
	{
		Debug.Log("Finger " + finger.Index + " tapped the screen");
	}
Ejemplo n.º 29
0
 /// <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;
 }
Ejemplo n.º 30
0
 public Mirror(Lean lean, ReflectiveSide reflectiveSide)
 {
     Lean           = lean;
     ReflectiveSide = reflectiveSide;
 }
Ejemplo n.º 31
0
	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;
					}
				}
			}*/
		}
	}
Ejemplo n.º 32
0
	public void OnFingerSwipe(Lean.LeanFinger finger)
	{
		Debug.Log("Finger " + finger.Index + " swiped the screen");
	}
Ejemplo n.º 33
0
	public void OnFingerHeldDown(Lean.LeanFinger finger)
	{
		Debug.Log("Finger " + finger.Index + " began touching the screen for a long time");
	}
Ejemplo n.º 34
0
	public void OnFingerHeld(Lean.LeanFinger finger)
	{
		Debug.Log("Finger " + finger.Index + " is still touching the screen for a long time");
	}
Ejemplo n.º 35
0
	public void OnFingerHeldUp(Lean.LeanFinger finger)
	{
		Debug.Log("Finger " + finger.Index + " stopped touching the screen for a long time");
	}
Ejemplo n.º 36
0
	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;
					}
				}
			}
		}
	}