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>();
|
||||
public readonly Dictionary<int, ChildModel> portDict = new Dictionary<int, ChildModel>(); //for CMS marker
|
||||
|
||||
public MeshFilter meshFilter;
|
||||
public MeshRenderer meshRenderer;
|
||||
@@ -158,6 +159,7 @@ public class ModelBehaviour : MonoBehaviour, IResettable
|
||||
cmb.ChildModel = ModelManager.GetById(id);
|
||||
cmb.Parent = this;
|
||||
Model.Ports[portNum].Apply(_children[portNum].transform);
|
||||
portDict[portNum] = cmb.ChildModel;
|
||||
Exploder.HandleModelChange();
|
||||
}
|
||||
|
||||
@@ -197,6 +199,7 @@ public class ModelBehaviour : MonoBehaviour, IResettable
|
||||
cmb.Parent = this;
|
||||
cmb.ChildModel = childModel;
|
||||
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.RemoveOtherMarkers = RemoveOtherMarkers;
|
||||
cmsb.Model = childModel;
|
||||
if (modelManager.BaseModelBehaviour.portDict[PortIndex].NameId == childModel.NameId)
|
||||
{
|
||||
cmsb.marker.SetActive(true);
|
||||
}
|
||||
|
||||
Models.Add(go);
|
||||
Buttons.Add(cmsb);
|
||||
|
||||
Reference in New Issue
Block a user