public static void CB_ModifyInvectorFiles(bool disable_files = false) { List <E_Helpers.CB_Additions> modifications = new List <E_Helpers.CB_Additions>(); #region HeadTrack modifications.Add(new E_Helpers.CB_Additions( in_target: "private float _currentHeadWeight, _currentbodyWeight;", in_add: "protected float _currentHeadWeight, _currentbodyWeight;", in_nextline: "", in_type: E_Helpers.CB_FileAddtionType.Replace )); E_Helpers.ModifyFile(@"Assets/Invector-3rdPersonController/Basic Locomotion/Scripts/HeadTrack/Scripts/vHeadTrack.cs", modifications); Debug.Log("Modified file at: Assets/Invector-3rdPersonController/Basic Locomotion/Scripts/HeadTrack/Scripts/vHeadTrack.cs"); #endregion #region vItemManagerUtilities_Shooter try { modifications.Clear(); modifications.Add(new E_Helpers.CB_Additions( in_target: "if (equipPointL.onInstantiateEquiment.GetPersistentTarget(i).GetType().Equals(typeof(vShooterManager)) && equipPointL.onInstantiateEquiment.GetPersistentMethodName(i).Equals(\"SetLeftWeapon\"))", in_add: "if ((equipPointL.onInstantiateEquiment.GetPersistentTarget(i).GetType().Equals(typeof(vShooterManager)) || equipPointL.onInstantiateEquiment.GetPersistentTarget(i).GetType().IsSubclassOf(typeof(vShooterManager))) && equipPointL.onInstantiateEquiment.GetPersistentMethodName(i).Equals(\"SetLeftWeapon\"))", in_nextline: "", in_type: E_Helpers.CB_FileAddtionType.Replace )); modifications.Add(new E_Helpers.CB_Additions( in_target: "if (equipPointR.onInstantiateEquiment.GetPersistentTarget(i).GetType().Equals(typeof(vShooterManager)) && equipPointR.onInstantiateEquiment.GetPersistentMethodName(i).Equals(\"SetRightWeapon\"))", in_add: "if ((equipPointR.onInstantiateEquiment.GetPersistentTarget(i).GetType().Equals(typeof(vShooterManager)) || equipPointR.onInstantiateEquiment.GetPersistentTarget(i).GetType().IsSubclassOf(typeof(vShooterManager))) && equipPointR.onInstantiateEquiment.GetPersistentMethodName(i).Equals(\"SetRightWeapon\"))", in_nextline: "", in_type: E_Helpers.CB_FileAddtionType.Replace )); E_Helpers.ModifyFile(@"Assets/Invector-3rdPersonController/Shooter/Scripts/Shooter/Editor/vItemManagerUtilities_Shooter.cs", modifications); Debug.Log("Modified file at: Assets/Invector-3rdPersonController/Shooter/Scripts/Shooter/Editor/vItemManagerUtilities_Shooter.cs"); } catch (Exception ex) { Debug.Log("FAILED TO CONVERT Assets/Invector-3rdPersonController/Shooter/Scripts/Shooter/Editor/vItemManagerUtilities_Shooter.cs"); Debug.Log("If you don't have the Shooter Template imported this is why you're recieving this error and can safely ignore it if you're not using this."); Debug.Log(ex); } #endregion #region E_ConvertPlayer E_Helpers.CommentOutRegionInFile("InvectorMultiplayer/Editor/Scripts/Windows/ConvertPlayer/E_ConvertPlayer.cs", "InvectorModification", disable_files); #endregion #region MP_HeadTrack string results = E_Helpers.CommentOutFile("InvectorMultiplayer/Scripts/Player/Basic/MP_HeadTrack.cs", disable_files); Debug.Log(results); #endregion #region vGenericAction modifications.Clear(); modifications.Add(new E_Helpers.CB_Additions( in_target: "private float animationBehaviourDelay;", in_add: "protected float animationBehaviourDelay;", in_nextline: "", in_type: E_Helpers.CB_FileAddtionType.Replace )); E_Helpers.ModifyFile(@"Assets/Invector-3rdPersonController/Basic Locomotion/Scripts/CharacterController/Actions/vGenericAction.cs", modifications); Debug.Log("Modified file at: Assets/Invector-3rdPersonController/Basic Locomotion/Scripts/CharacterController/Actions/vGenericAction.cs"); #endregion #region MP_vGenericActions results = E_Helpers.CommentOutFile("InvectorMultiplayer/Scripts/Player/Basic/MP_vGenericAction.cs", disable_files); Debug.Log(results); #endregion #region E_InvectorConvertPlayer results = E_Helpers.CommentOutFile("InvectorMultiplayer/Editor/Scripts/Windows/ConvertPlayer/E_InvectorConvertPlayer.cs", disable_files); Debug.Log(results); #endregion #region E_InvectorTests results = E_Helpers.CommentOutFile("InvectorMultiplayer/Editor/Scripts/Windows/SceneTests/E_InvectorTests.cs", disable_files); Debug.Log(results); #endregion if (results.Contains("Success")) { if (EditorUtility.DisplayDialog("Success!", "You have successfully modified the invector files. You may have to click out of unity and back in (or close it " + "and open it again) to re-compile the scripts. If you see the little gear icon in the lower right corner spin " + "that means that unity is compiling.", "Ok, thanks")) { } } }
private static void CB_AddonFSMAI(bool e_disable_fsm_ai = false) { if (EditorUtility.DisplayDialog("Do you have the \"FSM AI\" addon?", "**WARNING: This is a one way operation. Please be aware that this is in \"Beta\".\n\n" + "That means some of this is subject to change in the future. There also may be some missing " + "features. If that IS the case, please let me know immediately on Discord!**\n\n" + "Do you have the \"FSM AI\" add-on imported? If you don't own this add-on or don't " + "have this imported into your project yet DO NOT CONTINUE! If you do have it imported " + "into your project you may safetly continue.", "Continue", "Cancel")) { bool ShooterEnabled = !E_Helpers.FileContainsText( @"InvectorMultiplayer/Editor/Scripts/Windows/ConvertPlayer/E_ShooterConvertPlayer.cs", "/*" ); List <E_Helpers.CB_Additions> modifications = new List <E_Helpers.CB_Additions>(); string results = ""; #region ArrowView if (ShooterEnabled == false && e_disable_fsm_ai == true || e_disable_fsm_ai == false) { results = E_Helpers.CommentOutFile("InvectorMultiplayer/Scripts/Objects/Shooter/ArrowView.cs", e_disable_fsm_ai); Debug.Log(results); } else { Debug.Log("ArrowView.cs is needed for shooter template, skipping."); } #endregion #region AI_MP_ShooterWeapon results = E_Helpers.CommentOutFile("InvectorMultiplayer/Scripts/AI/AI_MP_ShooterWeapon.cs", e_disable_fsm_ai); Debug.Log(results); #endregion #region MP_BaseShooterWeapon if (ShooterEnabled == false) { results = E_Helpers.CommentOutFile("InvectorMultiplayer/Scripts/Objects/Shooter/MP_BaseShooterWeapon.cs", e_disable_fsm_ai); Debug.Log(results); } #endregion #region MP_vShooterManager if (ShooterEnabled == false && e_disable_fsm_ai == true || ShooterEnabled == true && e_disable_fsm_ai == false) { results = E_Helpers.CommentOutFile("InvectorMultiplayer/Scripts/Player/Shooter/MP_vShooterManager.cs", e_disable_fsm_ai); Debug.Log(results); } else { Debug.Log("MP_vShooterManager.cs is needed for shooter template, skipping."); } #endregion #region vAIHeadTrack modifications.Clear(); modifications.Add(new E_Helpers.CB_Additions( in_target: "private float _currentHeadWeight, _currentbodyWeight;", in_add: "protected float _currentHeadWeight, _currentbodyWeight;", in_nextline: "", in_type: E_Helpers.CB_FileAddtionType.Replace )); E_Helpers.ModifyFile(@"Assets/Invector-AIController/Scripts/AI/vAIHeadTrack.cs", modifications); Debug.Log("Modified file at: Assets/Invector-AIController/Scripts/AI/vAIHeadTrack.cs"); #endregion #region vAIShooterManager modifications.Clear(); modifications.Add(new E_Helpers.CB_Additions( in_target: "private float currentShotTime;", in_add: "protected float currentShotTime;", in_nextline: "", in_type: E_Helpers.CB_FileAddtionType.Replace )); modifications.Add(new E_Helpers.CB_Additions( in_target: "public void ReloadWeapon()", in_add: "public virtual void ReloadWeapon()", in_nextline: "", in_type: E_Helpers.CB_FileAddtionType.Replace )); E_Helpers.ModifyFile(@"Assets/Invector-AIController/Scripts/AI/vAIShooterManager.cs", modifications); Debug.Log("Modified file at: Assets/Invector-AIController/Scripts/AI/vAIShooterManager.cs"); #endregion #region MP_vAIShooterManager results = E_Helpers.CommentOutFile("InvectorMultiplayer/Scripts/AI/MP_vAIShooterManager.cs", e_disable_fsm_ai); Debug.Log(results); #endregion #region MP_AI results = E_Helpers.CommentOutFile("InvectorMultiplayer/Scripts/AI/MP_AI.cs", e_disable_fsm_ai); Debug.Log(results); #endregion #region MP_vAIHeadTrack results = E_Helpers.CommentOutFile("InvectorMultiplayer/Scripts/AI/MP_vAIHeadTrack.cs", e_disable_fsm_ai); Debug.Log(results); #endregion #region MP_vControlAIShooter results = E_Helpers.CommentOutFile("InvectorMultiplayer/Scripts/AI/MP_vControlAIShooter.cs", e_disable_fsm_ai); Debug.Log(results); #endregion #region E_ConvertPlayer E_Helpers.CommentOutRegionInFile("InvectorMultiplayer/Editor/Scripts/Windows/E_ConvertPlayer.cs", "vAIHeadTrack", e_disable_fsm_ai); #endregion #region MP_vAIHeadTrack results = E_Helpers.CommentOutFile("InvectorMultiplayer/Scripts/AI/MP_vAIHeadTrack.cs", e_disable_fsm_ai); Debug.Log(results); results = E_Helpers.CommentOutFile("InvectorMultiplayer/Editor/Scripts/Windows/ConvertAI/E_ConvertAI.cs", e_disable_fsm_ai); Debug.Log(results); results = E_Helpers.CommentOutFile("InvectorMultiplayer/Editor/Scripts/Windows/SceneTests/E_AITests.cs", e_disable_fsm_ai); Debug.Log(results); #endregion #region vControlAIShooter modifications.Clear(); modifications.Add(new E_Helpers.CB_Additions( in_target: "private Quaternion upperArmRotation, handRotation;", in_add: "protected Quaternion upperArmRotation, handRotation;", in_nextline: "", in_type: E_Helpers.CB_FileAddtionType.Replace )); modifications.Add(new E_Helpers.CB_Additions( in_target: "private float handIKWeight;", in_add: "protected float handIKWeight;", in_nextline: "", in_type: E_Helpers.CB_FileAddtionType.Replace )); modifications.Add(new E_Helpers.CB_Additions( in_target: "private float _onlyArmsLayerWeight;", in_add: "protected float _onlyArmsLayerWeight;", in_nextline: "", in_type: E_Helpers.CB_FileAddtionType.Replace )); modifications.Add(new E_Helpers.CB_Additions( in_target: "private float weaponIKWeight;", in_add: "protected float weaponIKWeight;", in_nextline: "", in_type: E_Helpers.CB_FileAddtionType.Replace )); modifications.Add(new E_Helpers.CB_Additions( in_target: "private readonly float rightRotationWeight;", in_add: "protected float rightRotationWeight;", in_nextline: "", in_type: E_Helpers.CB_FileAddtionType.Replace )); modifications.Add(new E_Helpers.CB_Additions( in_target: "private Vector3 aimTarget;", in_add: "protected Vector3 aimTarget;", in_nextline: "", in_type: E_Helpers.CB_FileAddtionType.Replace )); E_Helpers.ModifyFile(@"Assets/Invector-AIController/Scripts/AI/AI Controllers/vControlAIShooter.cs", modifications); Debug.Log("Modified file at: Assets/Invector-AIController/Scripts/AI/AI Controllers/vControlAIShooter.cs"); #endregion #region Shooter FSM AI Shared CB_AddonShooterFSMAIShared(); #endregion if (results.Contains("Success")) { if (EditorUtility.DisplayDialog("Success!", "You have successfully enabled FSM AI support! You may have to click out of unity and back in (or close it " + "and open it again) to re-compile the scripts. If you see the little gear icon in the lower right corner spin " + "that means that unity is compiling.", "Ok, thanks")) { } } } }