private void CreateCharacterSavedGraphFile(NewCharacterCreationData _data, EditorConfig _config) { CharacterSavedGraph savedGraph = ScriptableObject.CreateInstance <CharacterSavedGraph>(); string path = _config.CharacterSavedGraphsPath + "/" + _data.CharacterName.ToString() + ".asset"; AssetDatabase.CreateAsset(savedGraph, path); }
public NewCharacterSubView(EditorConfig _config, CharacterViewData _viewData) : base(_viewData, _config) { m_creationData = new NewCharacterCreationData(); m_creationFactory = new NewCharacterCreationFactory(); CreateBreadcrumbs(); PopulateNextBreadcrumb(); }
private void CreateCharacterDataFolders(NewCharacterCreationData _data, EditorConfig _config) { string rootCharfolder = OTGEditorUtility.GetCharacterRootFolder(_data.CharacterName, _config.CharacterPathRoot); AssetDatabase.CreateFolder(_config.CharacterPathRoot, _data.CharacterName); AssetDatabase.CreateFolder(rootCharfolder, "Configurations"); AssetDatabase.CreateFolder(rootCharfolder, "Prefabs"); AssetDatabase.CreateFolder(rootCharfolder, "States"); }
public NewCharacterSlideBase(NewCharacterCreationData _creationData) { m_creationData = _creationData; SetStrings(); VisualTreeAsset visualTree = AssetDatabase.LoadAssetAtPath <VisualTreeAsset>(m_templatePath); StyleSheet style = AssetDatabase.LoadAssetAtPath <StyleSheet>(m_stylePath); ContainerElement = new VisualElement(); visualTree.CloneTree(ContainerElement); ContainerElement.styleSheets.Add(style); }
private void CreateAndAttachHandlerDataGroup(NewCharacterCreationData _data, EditorConfig _config) { HandlerDataGroup dataGrp = ScriptableObject.CreateInstance <HandlerDataGroup>(); dataGrp.name = _data.CharacterName + "_HanderDataGroup"; string path = OTGEditorUtility.GetCharacterConfigurationsFolder(_data.CharacterName, _config.CharacterPathRoot); AssetDatabase.CreateAsset(dataGrp, path + dataGrp.name + ".asset"); m_characterSMCObj.FindProperty("m_handlerDataGroup").objectReferenceValue = dataGrp; m_characterSMCObj.ApplyModifiedProperties(); }
private void SetLayers(NewCharacterCreationData _data, EditorConfig _config) { if (_data.CharacterType == e_CombatantType.Player) { m_characterGameObject.layer = Mathf.RoundToInt(Mathf.Log(_config.GlobalCombatConfig.PlayerPushBox.value, 2)); m_hitColliderObj.gameObject.layer = Mathf.RoundToInt(Mathf.Log(_config.GlobalCombatConfig.PlayerHitBox.value, 2)); } else if (_data.CharacterType == e_CombatantType.Enemy) { m_characterGameObject.layer = Mathf.RoundToInt(Mathf.Log(_config.GlobalCombatConfig.EnemyPushBox.value, 2)); m_hitColliderObj.gameObject.layer = Mathf.RoundToInt(Mathf.Log(_config.GlobalCombatConfig.EnemyHitBox.value, 2)); } }
private void ApplyCharacterModel(NewCharacterCreationData _data) { GameObject characterModel = (GameObject)PrefabUtility.InstantiatePrefab(_data.CharacterObject); Animator anim = characterModel.GetComponent <Animator>(); if (anim != null) { GameObject.DestroyImmediate(anim); } characterModel.transform.SetParent(m_characterGameObject.transform); characterModel.transform.rotation = Quaternion.Euler(new Vector3(0, 90, 0)); }
private void CreateInitialState(NewCharacterCreationData _data, EditorConfig _config) { OTGCombatState initialState = ScriptableObject.CreateInstance <OTGCombatState>(); initialState.name = OTGEditorUtility.GetCombatStateName(_data.CharacterName, "Inititial"); string stateFolder = OTGEditorUtility.GetCharacterStateFolder(_data.CharacterName, _config.CharacterPathRoot); string initialStateGUID = AssetDatabase.CreateFolder(stateFolder, "InitialState"); string initialStatePath = AssetDatabase.GUIDToAssetPath(initialStateGUID); AssetDatabase.CreateAsset(initialState, initialStatePath + "/" + initialState.name + ".asset"); m_characterSMCObj.FindProperty("m_startingState").objectReferenceValue = initialState; m_characterSMCObj.ApplyModifiedProperties(); }
public void CreateCharacterWithData(NewCharacterCreationData _data, EditorConfig _config) { CreateCharacterDataFolders(_data, _config); CreateCharacterGameObject(_data); CreateCharacterSavedGraphFile(_data, _config); AttachCombatSMC(); CreateAndAttachHandlerDataGroup(_data, _config); LinkGlobalCombatConfig(_data, _config); CreateInitialState(_data, _config); ApplyCharacterType(_data); ApplyCharacterModel(_data); AdjustCharacterControllerCapsule(); AddHitBoxCollider(); AddTargetingBox(_data, _config); AddSFXControllers(); SetLayers(_data, _config); FocusOnAddedCharacter(); Cleanup(); }
private void AddTargetingBox(NewCharacterCreationData _data, EditorConfig _config) { GameObject targeting = new GameObject(); m_targetingObj = targeting.AddComponent <OTGTargetingController>(); targeting.GetComponent <BoxCollider>().isTrigger = true; targeting.name = "TargetingController"; targeting.transform.parent = m_characterGameObject.transform; targeting.transform.position = new Vector3(1, 1, 0); SerializedObject obj = new SerializedObject(m_targetingObj); SerializedProperty prop = obj.FindProperty("m_validTargets"); if (_data.CharacterType == e_CombatantType.Player) { prop.intValue = _config.GlobalCombatConfig.EnemyPushBox; } if (_data.CharacterType == e_CombatantType.Enemy) { prop.intValue = _config.GlobalCombatConfig.PlayerPushBox; } obj.ApplyModifiedProperties(); }
public CharacterNameSlide(NewCharacterCreationData _data) : base(_data) { }
public CharacterModelSlide(NewCharacterCreationData _data) : base(_data) { }
private void LinkGlobalCombatConfig(NewCharacterCreationData _data, EditorConfig _config) { m_characterSMCObj.FindProperty("m_globalConfig").objectReferenceValue = _config.GlobalCombatConfig; m_characterSMCObj.ApplyModifiedProperties(); }
private void CreateCharacterGameObject(NewCharacterCreationData _data) { m_characterGameObject = new GameObject(_data.CharacterName); m_characterGameObject.transform.position = Vector3.zero; }
private void ApplyCharacterType(NewCharacterCreationData _data) { m_characterSMCObj.FindProperty("m_combatantType").enumValueIndex = (int)_data.CharacterType; m_characterSMCObj.ApplyModifiedProperties(); }
public CharacterSummarySlide(NewCharacterCreationData _data) : base(_data) { }