public static void Initialise() { DivisionData.Setup(); FormationData.Setup(); TeamData.Setup(); PlayerData.Setup(); }
public override void OnInspectorGUI() { EditorGUILayout.BeginVertical(GUI.skin.box); EditorGUI.indentLevel++; EditorGUILayout.LabelField("阵型编辑器:"); EditorGUILayout.LabelField("在任意场景使用这个东西编辑一个阵型,"); EditorGUILayout.LabelField("然后将阵型保存为数据文件"); EditorGUI.indentLevel--; EditorGUILayout.EndVertical(); EditorGUILayout.Space(); if (GUILayout.Button("Add Node")) { self.AddNode(); } EditorGUILayout.Space(); base.OnInspectorGUI(); EditorGUILayout.Space(); if (GUILayout.Button("Reset")) { self.ClearNodes(); } EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.BeginVertical(GUI.skin.box); EditorGUI.indentLevel++; EditorGUILayout.LabelField("- 点击\"Save Current Formation\"将把当前阵型保存为位置数据"); EditorGUILayout.LabelField("- 保存的数据文件在: Assets-Set it when you use this system"); EditorGUI.indentLevel--; EditorGUILayout.EndVertical(); if (GUILayout.Button("Save Current Formation")) { FormationData formation = ScriptableObject.CreateInstance("FormationData") as FormationData; Vector3[] data = new Vector3[self.nodes.Count]; for (int i = 0; i < self.nodes.Count; i++) { data[i] = self.nodes[i].position; //save world position } formation.Setup(self.formationName, data); AssetDatabase.CreateAsset(formation, "Assets/Prefabs/FormationData/" + self.formationName.ToString() + ".asset"); AssetDatabase.SaveAssets(); self.SetDefaultName(); } }