public override void UpdateView(Event e, vFSMBehaviour curGraph) { base.UpdateView(e, curGraph); if (!backgroundTexture) { this.backgroundTexture = Resources.Load("grid") as Texture; } var color = GUI.color; GUI.color = vFSMBehaviourPreferences.gridBackgroundColor; if (!indrag) { if (curGraph) { curGraph.panOffset.x = curGraph.panOffset.x.NearestRound(vFSMHelper.dragSnap); curGraph.panOffset.y = curGraph.panOffset.y.NearestRound(vFSMHelper.dragSnap); } } GUI.Box(viewRect, GUIContent.none); if (Event.current.type == EventType.Repaint) { // Draw Background when Repainting // Offset from origin in tile units Vector2 tileOffset = new Vector2(-(1 + (curGraph ? curGraph.panOffset.x : 0)) / backgroundTexture.width, ((1 + (curGraph ? curGraph.panOffset.y : 0))) / backgroundTexture.height); // Amount of tiles Vector2 tileAmount = new Vector2(Mathf.Round(viewRect.width * 1) / backgroundTexture.width, Mathf.Round(viewRect.height * 1) / backgroundTexture.height); // Draw tiled background GUI.color = vFSMBehaviourPreferences.gridLinesColor; GUI.DrawTextureWithTexCoords(viewRect, backgroundTexture, new Rect(tileOffset, tileAmount)); if (curGraph == null) { GUI.Label(viewRect, "NO BEHAVIOUR", viewSkin.GetStyle("ViewMessage")); } } GUI.color = color; if (inDrawRect) { GUI.Box(selectorRect, "", viewSkin.GetStyle("SelectorArea")); } if (curGraph) { if (curGraph.onSelectState == null) { curGraph.onSelectState = OnSelectState; } curGraph.UpdateGraphGUI(e, viewRect, viewSkin); } #region Draw Work View Icons GUI.BeginGroup(viewRect); GUI.color = new Color(1, 1, 1, 0.2f); GUI.DrawTexture(new Rect(viewRect.width - 105, viewRect.height - 105, 100, 100), Resources.Load("Textures/Editor/logo") as Texture2D); if (currentFSM != null && currentFSM.icon != null) { GUI.DrawTexture(new Rect(viewRect.width - 105, viewRect.y + 5, 100, 100), currentFSM ? currentFSM.icon : null); } GUI.color = color; #endregion GUI.EndGroup(); GUI.Box(viewRect, "", viewSkin.GetStyle("BoxShadown")); ProcessEvents(e); }