-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIsolateManager.cs
More file actions
126 lines (113 loc) · 6.71 KB
/
IsolateManager.cs
File metadata and controls
126 lines (113 loc) · 6.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class IsolateManager : MonoBehaviour
{
private void Awake()
{
//hom3r.quickLinks.scriptsObject.GetComponent<OcclusionCommandReceiver>().isolateManager = this.GetComponent<IsolateManager>();
}
/// <summary> Isolate the selected objects. Make transparent all the objets not confirmed. </summary> //
public void StartIsolateMode()
{
//1. Update Core mode
hom3r.state.currentIsolateMode = THom3rIsolationMode.ISOLATE;
hom3r.quickLinks.scriptsObject.GetComponent<RemoveManager>().RemoveNotCorfirmedNodes(); //Remove all not confirmed objects
//this.FocusIsolatedGameObjects(); //Focus the list of confirmed objects objects
this.GetComponent<Core>().EmitEvent(new CCoreEvent(TCoreEvent.Occlusion_Isolate_Enabled), 1.6f);
}
/// <summary> Isolate the selected objects. Make transparent all the objets not confirmed. </summary> //
public void IsolateAGivenGOList_ModeON(List<GameObject> goToRemoveList)
{
//Remove the object of the given list
foreach (var obj in goToRemoveList)
{
// obj.GetComponent<ObjectStateManager>().SendEvent(TObjectVisualStateCommands.Remove_On);
obj.GetComponent<ObjectStateManager>().Do(new CObjectVisualStateCommand(TObjectVisualStateCommands.Remove_On));
}
//Focus the visible objects
ReFocusIsolatedGO();
}
/// <summary> Navigate to focus the isolated gameobject or group of game objects </summary>
public void FocusIsolatedGameObjects()
{
//Check that we have at least one confirmed object
int nConfirmed = this.GetComponent<SelectionManager>().GetNumberOfConfirmedGameObjects();
// Do when we have something selected
if (nConfirmed > 0)
{
// Bounding box containing all confirmed objects, for approximation
//Bounds totalBB = new Bounds();
// Get info from all confirmed objects to compute targets
//List<GameObject> listConfirmedObjets = this.GetComponent<SelectionManager>().GetListOfComponentConfirmedObjects();
//totalBB = hom3r.quickLinks.orbitPlane.GetComponent<NavigationManager>().ComputeBoundingBox(listConfirmedObjets);//FIXME after Navigation Refactoring
//Move the camera to focus the isolated object
//StartCoroutine(hom3r.quickLinks.orbitPlane.GetComponent<NavigationManager>().NavigateToFocusObject_BothNavSystems(totalBB));//-->ORIGINAL //FIXME after Navigation Refactoring
//StartCoroutine(camera_OrbitPlane.GetComponent<Navigation_Script>().NavigateToFocusObject_andResetPos_withoutRotation(totalBB));
//StartCoroutine(camera_OrbitPlane.GetComponent<Navigation_Script>().NavigateToFocusObject_andResetPos_BothNavSystems(totalBB));
// Launch command to core
//this.GetComponent<Core>().EmitEvent(new CCoreEvent(TCoreEvent.Occlusion_Isolate_Enabled), 1.6f);
}
else
{
//Debug.LogError("ANY GameObject selected");
//TODO: show messege in UI
//this.GetComponent<Core>().Do(new UICoreCommand(TUICommands.ShowAlertText, "No product was selected: there is nothing to focus"), Constants.undoNotAllowed);
}
}
/// <summary> Navigate to focus the visible gameobjects </summary>
public void ReFocusIsolatedGO()
{
//Get list of visible objects
List<GameObject> objVisibleList = this.GetComponent<ModelManager>().GetAreaNodeList().FindAll(x => !this.GetComponent<RemoveManager>().GetRemovedList().Contains(x));
// Do when we have something selected
if (objVisibleList.Count > 0)
{
// Bounding box containing all confirmed objects, for approximation
//Bounds totalBB = hom3r.quickLinks.orbitPlane.GetComponent<NavigationManager>().ComputeBoundingBox(objVisibleList); //FIXME after Navigation Refactoring
//Move the camera to focus the isolated object
//StartCoroutine(hom3r.quickLinks.orbitPlane.GetComponent<NavigationManager>().NavigateToFocusObject_BothNavSystems(totalBB));//-->ORIGINAL //FIXME after Navigation Refactoring
//StartCoroutine(camera_OrbitPlane.GetComponent<Navigation_Script>().NavigateToFocusObject_andResetPos_withoutRotation(totalBB));
// Launch command to core
this.GetComponent<Core>().EmitEvent(new CCoreEvent(TCoreEvent.Occlusion_Isolate_Enabled));
}
else
{
//Debug.LogError("ANY GameObject selected");
//TODO: Show messege in UI
//this.GetComponent<Core>().Do(new UICoreCommand(TUICommands.ShowAlertText, "No product was selected: there is nothing to focus"), Constants.undoNotAllowed);
}
}
public void ReFocusIsolatedGO_withRotation()
{
//Get list of visible objects
List<GameObject> objVisibleList = this.GetComponent<ModelManager>().GetAreaNodeList().FindAll(x => !this.GetComponent<RemoveManager>().GetRemovedList().Contains(x));
// Do when we have something selected
if (objVisibleList.Count > 0)
{
// Bounding box containing all confirmed objects, for approximation
//Bounds totalBB = hom3r.quickLinks.orbitPlane.GetComponent<NavigationManager>().ComputeBoundingBox(objVisibleList); //FIXME after Navigation Refactoring
// Move the camera to focus the isolated object
//StartCoroutine(hom3r.quickLinks.orbitPlane.GetComponent<NavigationManager>().NavigateToFocusObject_andResetPos_BothNavSystems(totalBB)); //FIXME after Navigation Refactoring
// Launch command to core
this.GetComponent<Core>().EmitEvent(new CCoreEvent(TCoreEvent.Occlusion_Isolate_Enabled));
}
else
{
//Debug.LogError("ANY GameObject selected");
//TODO: Show messege in UI
//this.GetComponent<Core>().Do(new UICoreCommand(TUICommands.ShowAlertText, "No product was selected: there is nothing to focus"), Constants.undoNotAllowed);
}
}
/// <summary> Deactivate the Isolate Mode and reset the View </summary>
public void StopIsolateMode()
{
//1. Reset View
// hom3r.quickLinks.orbitPlane.GetComponent<NavigationManager>().ResetView_BothNavSystems(); //FIXME after Navigation Refactoring
//2. Reset object materials (show every components)
this.GetComponent<TransparencyManager>().AllGameObjectTransparencyOff();
this.GetComponent<RemoveManager>().RevealAllRemovedGameObjects();
// Launch command to core
this.GetComponent<Core>().EmitEvent(new CCoreEvent(TCoreEvent.Occlusion_Isolate_Disabled), 0.1f);
}
}