Skip to content
Snippets Groups Projects
Commit 55ad66d0 authored by John Schihada's avatar John Schihada
Browse files

Merge branch 'master' of https://github.com/UniFormal/UFrameIT

parents 6182137a 8b8783ec
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,7 @@
using UnityEngine;
using UnityEditor;
using static CommunicationEvents;
using System;
public class ShinyThings : MonoBehaviour
{
......@@ -45,16 +46,43 @@ public void Update()
RaycastHit Hit = Cursor.Hit;
if (Hit.transform != null)
Highlighting(Hit);
//LineRendering-Part
//@John before: hit.point
Debug.Log(this.transform.position);
if (this.lineDrawingActivated)
UpdateLineDrawing(this.transform.position);
else if (this.curveDrawingActivated)
UpdateCurveDrawing(this.transform.position);
}
private void Highlighting(RaycastHit hit)
{
if (hit.transform != null)
{
Transform selection = Hit.transform;
Transform selection = hit.transform;
//only do stuff if selection changes
//Set the last Fact unselected
if (this.lastFactSelection != null)
{
if (selection == this.lastFactSelection) return;
//Invoke the EndHighlightEvent that will be handled in FactSpawner
// CommunicationEvents.EndHighlightEvent.Invoke(this.lastFactSelection);
OnMouseOverFactEnd(lastFactSelection);
if (this.lastFactSelection.CompareTag(selectableTag))
OnMouseOverFactEnd(lastFactSelection);
else
OnMouseOverSnapZoneEnd(lastFactSelection);
this.lastFactSelection = null;
}
......@@ -66,16 +94,52 @@ public void Update()
//CommunicationEvents.HighlightEvent.Invoke(selection);
OnMouseOverFact(lastFactSelection);
}
//SELECTION-HIGHLIGHTING-PART-END
else if (selection.CompareTag("SnapZone"))
{
this.lastFactSelection = selection;
OnMouseOverSnapZone(lastFactSelection);
//LineRendering-Part
if (this.lineDrawingActivated)
UpdateLineDrawing(Hit.point);
else if (this.curveDrawingActivated)
UpdateCurveDrawing(Hit.point);
}
}
//SELECTION-HIGHLIGHTING-PART-END
}
private void OnMouseOverSnapZoneEnd(Transform selection)
{
Renderer selectionRenderer;
if (selection != null)
{
selectionRenderer = selection.GetComponent<Renderer>();
if (selectionRenderer != null)
{
//Add transparency
var oldCol = selectionRenderer.material.color;
oldCol.a = .25f;
selectionRenderer.material.color = oldCol;
//Unhide Mouse cursor
UnityEngine.Cursor.visible = true;
}
}
}
private void OnMouseOverSnapZone(Transform selection)
{
Renderer selectionRenderer;
selectionRenderer = selection.GetComponent<Renderer>();
if (selectionRenderer != null)
{
//Remove transparency
var oldCol = selectionRenderer.material.color;
oldCol.a = 1;
selectionRenderer.material.color = oldCol;
//Hide Mouse cursor
UnityEngine.Cursor.visible = false;
}
}
public void OnMouseOverFact(Transform selection)
......
......@@ -39,8 +39,9 @@ void Update()
{
Hit.point = Hit.collider.transform.position;
Hit.normal = Vector3.up;
Debug.Log("boom");
CheckMouseButtons(true);
transform.position = Hit.point;
transform.up = Hit.normal;
}
else
......@@ -57,7 +58,10 @@ void Update()
}
else
{
transform.position = Cam.ScreenToWorldPoint(Input.mousePosition);
var dist = 10f;
if (Hit.transform!=null)
dist = (Camera.main.transform.position - Hit.transform.position).magnitude;
transform.position = Cam.ScreenToWorldPoint(Input.mousePosition + new Vector3(0,0,1) *dist);
transform.up = -Cam.transform.forward;
}
......
......@@ -8,7 +8,7 @@ Material:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: CursorMaterial
m_Shader: {fileID: 10755, guid: 0000000000000000f000000000000000, type: 0}
m_Shader: {fileID: 4800000, guid: 2649b895a4c22d649852a0ca4c825c74, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
......@@ -57,6 +57,7 @@ Material:
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _ColorMask: 15
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
......@@ -70,6 +71,11 @@ Material:
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _Stencil: 0
- _StencilComp: 8
- _StencilOp: 0
- _StencilReadMask: 255
- _StencilWriteMask: 255
- _UVSec: 0
- _ZWrite: 1
m_Colors:
......
......@@ -8,7 +8,7 @@ Material:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: SeeThrough 1
m_Shader: {fileID: 4800000, guid: 2649b895a4c22d649852a0ca4c825c74, type: 3}
m_Shader: {fileID: 10760, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords: _ALPHAPREMULTIPLY_ON
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
......@@ -80,5 +80,5 @@ Material:
- _UseUIAlphaClip: 0
- _ZWrite: 0
m_Colors:
- _Color: {r: 0.972549, g: 0.30369413, b: 0, a: 0.11372549}
- _Color: {r: 0.972549, g: 0.30369413, b: 0, a: 0.2509804}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
......@@ -157,7 +157,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 5e9e851c0e142814dac026a256ba2ac0, type: 3}
propertyPath: m_RootOrder
value: 1
value: 3
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 5e9e851c0e142814dac026a256ba2ac0, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
......@@ -272,7 +272,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 45.118004, y: 115.065, z: 146.117}
--- !u!1 &144550594
GameObject:
......@@ -320,7 +320,7 @@ RectTransform:
m_Children:
- {fileID: 1920747393}
m_Father: {fileID: 0}
m_RootOrder: 8
m_RootOrder: 10
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
......@@ -396,7 +396,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: c91c1eb85782d5748ace27eb4d7415bb, type: 3}
propertyPath: m_LocalPosition.y
value: 0.08
value: -0.045
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: c91c1eb85782d5748ace27eb4d7415bb, type: 3}
propertyPath: m_LocalPosition.z
......@@ -420,7 +420,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: c91c1eb85782d5748ace27eb4d7415bb, type: 3}
propertyPath: m_RootOrder
value: 0
value: 2
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: c91c1eb85782d5748ace27eb4d7415bb, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
......@@ -707,7 +707,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 6
m_RootOrder: 8
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &422404977
GameObject:
......@@ -864,7 +864,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 7
m_RootOrder: 9
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &535944724
GameObject:
......@@ -1047,7 +1047,7 @@ Transform:
m_LocalScale: {x: 1, y: 4, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 5
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &684756691
GameObject:
......@@ -1079,7 +1079,7 @@ Transform:
- {fileID: 1675643438}
- {fileID: 1451305264}
m_Father: {fileID: 0}
m_RootOrder: 4
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &866436393
GameObject:
......@@ -1488,12 +1488,12 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1009368148}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0.48, z: 0}
m_LocalScale: {x: 3, y: 3, z: 3}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 2.6310663, y: 0, z: 2.165048}
m_LocalScale: {x: 1.5, y: 1.5, z: 1.5}
m_Children: []
m_Father: {fileID: 1347135377}
m_RootOrder: 17
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!135 &1009368150
SphereCollider:
......@@ -1841,7 +1841,7 @@ PrefabInstance:
- target: {fileID: 3052661700889384477, guid: 9cb473a50d07f1245b0f6a7ee2557d4f,
type: 3}
propertyPath: m_RootOrder
value: 3
value: 5
objectReference: {fileID: 0}
- target: {fileID: 3052661700889384477, guid: 9cb473a50d07f1245b0f6a7ee2557d4f,
type: 3}
......@@ -1955,12 +1955,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 38927f5b66d24cc428e39ffa454b0bfb, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!4 &1347135377 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 400000, guid: c91c1eb85782d5748ace27eb4d7415bb,
type: 3}
m_PrefabInstance: {fileID: 154206643}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1351049950
GameObject:
m_ObjectHideFlags: 0
......@@ -2094,12 +2088,12 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1563243733}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 16.97, z: 0}
m_LocalScale: {x: 3, y: 3, z: 3}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 2.6310663, y: 8.44, z: 2.165048}
m_LocalScale: {x: 1.5, y: 1.5, z: 1.5}
m_Children: []
m_Father: {fileID: 1347135377}
m_RootOrder: 18
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!23 &1563243735
MeshRenderer:
......@@ -2409,7 +2403,7 @@ Transform:
m_GameObject: {fileID: 1675643434}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 20, y: 0.5, z: 20}
m_LocalScale: {x: 20, y: 0.00001, z: 20}
m_Children: []
m_Father: {fileID: 684756692}
m_RootOrder: 0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment