private void UpdateGraphComponent(ref AnimationGraphComponent animGraph) { if (animGraph.Value != null && animGraph.Value.IsActive) { animGraph.Value.Update(TimeManager.DeltaTime); } }
private void RunUpdate(ref AnimationGraphComponent graphComponent) { graphComponent.Value.SetVariable(GraphVariables.IsMoving, graphComponent.GetEntity().Tags.Contain(EntityTags.Moving)); }
private void OnGUI() { if (!Application.isPlaying) { Close(); return; } if (_inPointStyle == null || _nodeStyle == null || _nodeTextStyle == null) { SetupStyles(); } var list = EntityController.GetComponentArray <AnimationGraphComponent>(); _entityListing.Clear(); _smallerList.Clear(); int currentIndex = -1; foreach (var graphComponent in list) { if (graphComponent == _graph) { currentIndex = _entityListing.Count; } _entityListing.Add(graphComponent.GetEntity().DebugId); _smallerList.Add(graphComponent); } var newIndex = EditorGUILayout.Popup(currentIndex, _entityListing.ToArray()); if (newIndex != currentIndex) { _graph = _smallerList[newIndex]; } _scrollRect = new Rect(0, 0, position.width - Border, position.height); _scrollPosition = GUI.BeginScrollView(_scrollRect, _scrollPosition, new Rect(0, 0, MaxRectSize, MaxRectSize)); DrawGrid(20, 0.2f, Color.gray); DrawGrid(100, 0.4f, Color.gray); if (_graph == null) { EditorGUILayout.LabelField("No Graph Selected of " + _entityListing.Count); GUI.EndScrollView(); return; } if (_graph.Value == null) { EditorGUILayout.LabelField("Component has no Graph " + _graph.GetEntity()?.DebugId ?? "None"); GUI.EndScrollView(); return; } if (_graph.Value.Current is ExternalGraphNode.RuntimeNode externalGraphNode) { DrawGraph(externalGraphNode.ExternalGraph); } else if (_graph.Value.Current is SwitchExternalNode.RuntimeNode switchGraphNode) { DrawGraph(switchGraphNode.ExternalGraph); } else { DrawGraph(_graph.Value); } }