Add default selection marker on CMS
This commit is contained in:
@@ -26,6 +26,7 @@ public class ModelBehaviour : MonoBehaviour, IResettable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
readonly List<GameObject> _children = new List<GameObject>();
|
readonly List<GameObject> _children = new List<GameObject>();
|
||||||
|
public readonly Dictionary<int, ChildModel> portDict = new Dictionary<int, ChildModel>(); //for CMS marker
|
||||||
|
|
||||||
public MeshFilter meshFilter;
|
public MeshFilter meshFilter;
|
||||||
public MeshRenderer meshRenderer;
|
public MeshRenderer meshRenderer;
|
||||||
@@ -158,6 +159,7 @@ public class ModelBehaviour : MonoBehaviour, IResettable
|
|||||||
cmb.ChildModel = ModelManager.GetById(id);
|
cmb.ChildModel = ModelManager.GetById(id);
|
||||||
cmb.Parent = this;
|
cmb.Parent = this;
|
||||||
Model.Ports[portNum].Apply(_children[portNum].transform);
|
Model.Ports[portNum].Apply(_children[portNum].transform);
|
||||||
|
portDict[portNum] = cmb.ChildModel;
|
||||||
Exploder.HandleModelChange();
|
Exploder.HandleModelChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,6 +199,7 @@ public class ModelBehaviour : MonoBehaviour, IResettable
|
|||||||
cmb.Parent = this;
|
cmb.Parent = this;
|
||||||
cmb.ChildModel = childModel;
|
cmb.ChildModel = childModel;
|
||||||
port.Apply(child.transform); // move to correct position
|
port.Apply(child.transform); // move to correct position
|
||||||
|
portDict[i] = cmb.ChildModel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,6 +51,10 @@ public class ChildModelSelector : MonoBehaviour, IResettable
|
|||||||
cmsb.AssignModel = () => AssignModel(childModel);
|
cmsb.AssignModel = () => AssignModel(childModel);
|
||||||
cmsb.RemoveOtherMarkers = RemoveOtherMarkers;
|
cmsb.RemoveOtherMarkers = RemoveOtherMarkers;
|
||||||
cmsb.Model = childModel;
|
cmsb.Model = childModel;
|
||||||
|
if (modelManager.BaseModelBehaviour.portDict[PortIndex].NameId == childModel.NameId)
|
||||||
|
{
|
||||||
|
cmsb.marker.SetActive(true);
|
||||||
|
}
|
||||||
|
|
||||||
Models.Add(go);
|
Models.Add(go);
|
||||||
Buttons.Add(cmsb);
|
Buttons.Add(cmsb);
|
||||||
|
|||||||
Reference in New Issue
Block a user