Skip to content
Snippets Groups Projects
Commit d12feb9b authored by Richard Marcus's avatar Richard Marcus
Browse files

90degree angle now requires two steps

parent b057f217
No related branches found
No related tags found
No related merge requests found
......@@ -22,7 +22,7 @@ void Start()
{
CommunicationEvents.ToolModeChangedEvent.AddListener(OnToolModeChanged);
CommunicationEvents.TriggerEvent.AddListener(OnHit);
CommunicationEvents.SnapEvent.AddListener(Rocket);
// CommunicationEvents.SnapEvent.AddListener(Rocket);
//We dont want to have this here anymore...
//CommunicationEvents.RemoveFactEvent.AddListener(DeleteFact);
......@@ -176,6 +176,10 @@ public void OnToolModeChanged(ToolMode ActiveToolMode)
}
}
//automatic 90 degree angle construction
public void Rocket(RaycastHit hit)
{
......@@ -207,11 +211,31 @@ public void Rocket(RaycastHit hit)
//90degree angle
CommunicationEvents.AddFactEvent.Invoke(this.AddAngleFact(idB,idA,idC, GetFirstEmptyID()));
}
public void SmallRocket(RaycastHit hit, int idA)
{
int idB = this.GetFirstEmptyID();
CommunicationEvents.AddFactEvent.Invoke(this.AddPointFact(hit, idB));
//third point with unknown height
int idC = this.GetFirstEmptyID();
var skyHit = hit;
skyHit.point = (Facts[idA] as PointFact).Point+ Vector3.up * 20;
CommunicationEvents.AddFactEvent.Invoke(this.AddPointFact(skyHit, idC));
//lines
CommunicationEvents.AddFactEvent.Invoke(this.AddLineFact(idA, idB, this.GetFirstEmptyID()));
//lines
CommunicationEvents.AddFactEvent.Invoke(this.AddLineFact(idA, idC, this.GetFirstEmptyID()));
//90degree angle
CommunicationEvents.AddFactEvent.Invoke(this.AddAngleFact(idB, idA, idC, GetFirstEmptyID()));
}
public void OnHit(RaycastHit hit)
{
......@@ -251,13 +275,14 @@ public void OnHit(RaycastHit hit)
{
if (this.lineModeIsFirstPointSelected)
{
//Event for end of line-drawing in "ShinyThings"
int id = this.GetFirstEmptyID();
CommunicationEvents.AddFactEvent.Invoke(this.AddPointFact(hit,id ));
CommunicationEvents.StopLineDrawingEvent.Invoke(null);
//Create LineFact
CommunicationEvents.AddFactEvent.Invoke(this.AddLineFact(this.lineModeFirstPointSelected.Id,id, this.GetFirstEmptyID()));
SmallRocket(hit,this.lineModeFirstPointSelected.Id);
this.lineModeIsFirstPointSelected = false;
this.lineModeFirstPointSelected = null;
}
......
......@@ -79,7 +79,8 @@ void CheckMouseButtons(bool OnSnap=false)
}
else {
Hit.collider.enabled = false;
CommunicationEvents.SnapEvent.Invoke(Hit);
CommunicationEvents.TriggerEvent.Invoke(Hit);
// CommunicationEvents.SnapEvent.Invoke(Hit);
}
......
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