public void OnSceneGUI() { if (decorMap && currentDecor) { var e = Event.current; var controlID = GUIUtility.GetControlID(FocusType.Passive); var placedecor = false; var incrementdecor = false; var decrementdecor = false; var removedecor = false; HandleEvent(e, controlID, ref placedecor, ref removedecor, ref incrementdecor, ref decrementdecor); float x; float y; CalculatePosition(e, out x, out y); if (e.shift) { DrawDeleteBox(x, y); } else { DrawPlacementBox(x, y); } if (placedecor) { decorMap.PlaceDecor(x + brushInformation.decorWidth / 2, y + brushInformation.decorHeight / 2, brushInformation.randomRotation, currentDecor); } if (removedecor) { if (brushInformation.overrideDefaultDeleteBrush) { CycleThroughDeleteBrush(x, y); } else { decorMap.RemoveDecor(x + brushInformation.decorWidth / 2, y + brushInformation.decorHeight / 2); } } if (incrementdecor) { GoToNextDecor(); } if (decrementdecor) { GoToPreviousDecor(); } } else { decorMap = (DecorMap)target; } SceneView.RepaintAll(); }
public void OnEnable() { decorMap = (DecorMap)target; if (!decorMap.Initialized) { decorMap.Initialize(); } }