private void Open(GameObject obj, IEnumerable <IContextMenuOption> options, Vector2 position) { if (!HasActiveWindow(obj)) { GameObject menuObj = WindowManager.OpenWindow(MenuPrefab); if (menuObj) { HighlighterCollection highlighter = HighlighterCollection.Create(obj.transform.root.gameObject, Highlighter); highlighter.Highlight(); highlighter.Tint(Color.green); menuObj.transform.position = position; ContextMenu menu = menuObj.GetComponent <ContextMenu>(); menu.Open(options); menu.StickTo(obj.transform); AddActiveWindow(obj, menu); menu.OnClosed += () => { RemoveActiveWindow(obj); highlighter.EndHighlight(); }; } } }
private void OnHoverChanged(Collider2D cur, Collider2D prev) { if (_highlighters != null) { _highlighters.EndHighlight(); } if (cur != null) { _highlighters = HighlighterCollection.Create(cur.transform.root.gameObject, Highlighter); _highlighters.Highlight(); _highlighters.Tint(Color.green); } }
public bool Pickup(GameObject obj) { Structure objStructure = obj.GetComponent <Structure>(); if (objStructure) { GlobalStructureModManager.Instance.ApplyMods(objStructure); } _highlighters = HighlighterCollection.Create(obj, GetHighlighterSet()); _highlighters.Highlight(); _obj = obj; _obj.SetActive(false); _model = UnityUtils.InstantiateMockGO(_obj); _placeable = obj.GetComponent <IGridObject>(); return(_placeable != null); }