public void SetTool(EditorTool targetTool) { if (tileSelector == null) { tileSelector = new GameObject("TileSelector").AddComponent <TileSelector>(); tileSelector.transform.SetParent(ScenePrimer.curPrimerComponent.primerParrentObj.transform); } if (targetTool == curEditorTool) { curEditorTool.PreToolDeActivation(); tileSelector = curEditorTool.curTileSelector; tileSelector.gameObject.SetActive(false); curEditorTool = null; } else { if (curEditorTool != null) { curEditorTool.PreToolDeActivation(); tileSelector = curEditorTool.curTileSelector; tileSelector.gameObject.SetActive(false); } curEditorTool = targetTool; tileSelector.gameObject.SetActive(true); curEditorTool.curTileSelector = tileSelector; curEditorTool.PreToolActivation(); } }
public void DeActivateTool() { if (curEditorTool != null) { curEditorTool.PreToolDeActivation(); tileSelector = curEditorTool.curTileSelector; tileSelector.gameObject.SetActive(false); curEditorTool = null; } }