17 private Vector3 targetPosition;
18 private Vector3 defaultOffset;
19 private Vector3 hiddenOffset;
20 private Vector3 manipulationOffset;
22 private Renderer highlightMeshRenderer;
25 private AppBar parentToolBar;
26 private bool initialized =
false;
28 public const float ButtonWidth = 0.12f;
29 public const float ButtonDepth = 0.0001f;
30 const float MoveSpeed = 5f;
34 template = newTemplate;
35 customIconProfile = newCustomProfile;
36 parentToolBar = newParentToolBar;
38 cButton = GetComponent<CompoundButton>();
40 text = GetComponent<CompoundButtonText>();
41 text.
Text =
template.Text;
42 icon = GetComponent<CompoundButtonIcon>();
45 if (customIconProfile != null)
47 icon.
Profile = customIconProfile;
54 if (newTemplate.EventTarget != null)
57 newTemplate.EventTarget.Registerinteractable(gameObject);
77 switch (parentToolBar.
State)
82 targetPosition = defaultOffset;
83 switch (
template.Type)
101 targetPosition = hiddenOffset;
102 switch (
template.Type)
117 targetPosition = manipulationOffset;
118 switch (
template.Type)
132 transform.localPosition = Vector3.Lerp(transform.localPosition, targetPosition, 0.5f);
142 cButton.enabled =
false;
143 highlightMeshRenderer.enabled =
false;
144 cButton.gameObject.layer = LayerMask.NameToLayer(
"Ignore Raycast");
154 cButton.enabled =
true;
155 highlightMeshRenderer.enabled =
true;
156 cButton.gameObject.layer = LayerMask.NameToLayer(
"UI");
159 private void RefreshOffsets()
168 xDefaultOffset -= (ButtonWidth / 2);
172 xManipulationOffset -= (ButtonWidth / 2);
175 defaultOffset =
new Vector3(
176 template.DefaultPosition * ButtonWidth - xDefaultOffset,
178 template.DefaultPosition * ButtonDepth);
179 manipulationOffset =
new Vector3(
180 template.ManipulationPosition * ButtonWidth - xManipulationOffset,
182 template.ManipulationPosition * ButtonDepth);
183 hiddenOffset = Vector3.zero;
bool DisableText
Turn off text entirely