public CRPlayer(CNManager manager, CREntityManager entityManager) { manager_ = manager; entityManager_ = entityManager; stringStatuses_ = new string[] { "Editing", "Simulating", "Replaying" }; }
void OnEnable() { Instance = this; minSize = new Vector2(width_, height_); maxSize = new Vector2(width_, height_); Controller = CNManager.Instance; BuildEffectList(); }
//----------------------------------------------------------------------------------- public CNNodesController(CNFieldController fController, CommandNodeEditor ownerEditor) { fController_ = fController; field_ = fController.Field; manager_ = CNManager.Instance; hierarchy_ = manager_.Hierarchy; ownerNode_ = ownerEditor.Data; listCommandNodeAllowed_ = new List <CommandNode>(); listCommandNodeCurrent_ = new List <CommandNode>(); listSelectedIdx_ = new List <int>(); listTreeNodeAux_ = new List <CRTreeNode>(); SetSelectableNodes(); }
private void AssignBodyIds() { CNManager cnManager = CNManager.Instance; CREntityManager entityManager = cnManager.EntityManager; GameObject[] normalObjects = getNormalObjects(); arrIdBodyNormalGameObjects_ = new uint[normalObjects.Length]; for (int i = 0; i < normalObjects.Length; i++) { GameObject go = normalObjects[i]; if (entityManager.IsGameObjectAnimated(go)) { uint idBody = entityManager.GetIdBodyFromGo(go); arrIdBodyNormalGameObjects_[i] = idBody; } else { arrIdBodyNormalGameObjects_[i] = uint.MaxValue; } } GameObject[] skinnedObjects = getSkinnedObjects(); arrIdBodySkinnedGameObjects_ = new uint[skinnedObjects.Length]; for (int i = 0; i < skinnedObjects.Length; i++) { GameObject go = skinnedObjects[i]; if (entityManager.IsGameObjectAnimated(go)) { uint idBody = entityManager.GetIdBodyFromGo(go); arrIdBodySkinnedGameObjects_[i] = idBody; } else { arrIdBodySkinnedGameObjects_[i] = uint.MaxValue; } } }
//----------------------------------------------------------------------------------- void OnEnable() { InitEditor(); try { controller_ = CNManager.Instance; } catch { return; } if (controller_ != null) { controller_.SetManagerEditor(this); } titleContent = new GUIContent("Caronte FX"); wantsMouseMove = true; resourcesLoaded = false; autoRepaintOnSceneChange = true; firstOnGUI_ = true; }
public override void OnInspectorGUI() { serializedObject.Update(); bool isEditing = false; if (CRManagerEditor.IsOpen) { window_ = CRManagerEditor.Instance; window_.WantRepaint -= Repaint; window_.WantRepaint += Repaint; } if (CNManager.IsInitedStatic) { manager_ = CNManager.Instance; hierarchy_ = manager_.Hierarchy; manager_.GetBodiesData(listBodyData_); isEditing = manager_.Player.IsEditing; } else { listBodyData_.Clear(); } CRBodyData bdData = null; uint idBody = uint.MaxValue; int nBodyData = listBodyData_.Count; BodyType bodyType; string bodyTypeText; string bodyIdText; if (nBodyData == 0) { bodyType = BodyType.None; bodyTypeText = "-"; bodyIdText = "-"; } else { bdData = listBodyData_[0]; bodyType = bdData.bodyType_; bodyTypeText = GetBodyTypeString(bdData.bodyType_); idBody = bdData.idBody_; for (int i = 1; i < nBodyData; i++) { bdData = listBodyData_[i]; if (bdData.bodyType_ != bodyType) { bodyType = BodyType.None; bodyTypeText = "-"; bodyIdText = "-"; break; } } if (idBody == uint.MaxValue || nBodyData > 1) { bodyIdText = "-"; } else { bodyIdText = idBody.ToString(); } } HashSet <CommandNode> setBodyDefinition = new HashSet <CommandNode>(); HashSet <CommandNode> setBodyReference = new HashSet <CommandNode>(); for (int i = 0; i < nBodyData; i++) { bdData = listBodyData_[i]; List <CommandNode> bdDataNodes = bdData.listNode_; int nDataNodes = bdDataNodes.Count; for (int j = 0; j < nDataNodes; j++) { CommandNode node = bdDataNodes[j]; if (j == 0) { setBodyDefinition.Add(node); } else { setBodyReference.Add(node); } } } EditorGUILayout.Space(); EditorGUILayout.LabelField("Body type: ", bodyTypeText); EditorGUILayout.LabelField("Body id:", bodyIdText); EditorGUILayout.Space(); if (bodyType == BodyType.None) { DrawFullBodySection(); } else if (bodyType == BodyType.Ropebody) { DrawRopeColliderSection(isEditing); } else { DrawBodyColliderSection(); } EditorGUILayout.Space(); EditorGUILayout.LabelField("Body Definition: "); scrollVecDefinition_ = GUILayout.BeginScrollView(scrollVecDefinition_, GUILayout.ExpandHeight(false)); DrawNodeGUI(setBodyDefinition); GUILayout.EndScrollView(); EditorGUILayout.Space(); EditorGUILayout.LabelField("Referenced in: "); scrollVecReferenced_ = GUILayout.BeginScrollView(scrollVecReferenced_, GUILayout.ExpandHeight(false)); DrawNodeGUI(setBodyReference); GUILayout.EndScrollView(); CRGUIUtils.Splitter(); if (!CRManagerEditor.IsOpen) { EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.Space(); if (GUILayout.Button("Open CaronteFx Editor", GUILayout.Height(30f))) { window_ = (CRManagerEditor)CRManagerEditor.Init(); } EditorGUILayout.Space(); EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); } serializedObject.ApplyModifiedProperties(); }
//----------------------------------------------------------------------------------- void OnDisable() { controller_ = null; RepaintSubscribers(); SceneView.RepaintAll(); }
public static CommandNode GetSelectedNode() { CNManager manager = Instance.Controller; return(manager.GetSelectedNode()); }
public static CommandNode GetNodeAtListIdx(int listIdx) { CNManager manager = Instance.Controller; return(manager.GetNodeAtListIdx(listIdx)); }