예제 #1
0
        private static GameObject CreateModel(GameObject main, string modelName)
        {
            FacelessJoePlugin.DestroyImmediate(main.transform.Find("ModelBase").gameObject);
            FacelessJoePlugin.DestroyImmediate(main.transform.Find("CameraPivot").gameObject);
            FacelessJoePlugin.DestroyImmediate(main.transform.Find("AimOrigin").gameObject);

            if (Modules.Assets.mainAssetBundle.LoadAsset <GameObject>(modelName) == null)
            {
                Debug.LogError("Trying to load a null model- check to see if the name in your code matches the name of the object in Unity");
                return(null);
            }

            return(GameObject.Instantiate(Modules.Assets.mainAssetBundle.LoadAsset <GameObject>(modelName)));
        }
예제 #2
0
        internal static void CreateSkillFamilies(GameObject targetPrefab)
        {
            foreach (GenericSkill obj in targetPrefab.GetComponentsInChildren <GenericSkill>())
            {
                FacelessJoePlugin.DestroyImmediate(obj);
            }

            SkillLocator skillLocator = targetPrefab.GetComponent <SkillLocator>();

            skillLocator.primary = targetPrefab.AddComponent <GenericSkill>();
            SkillFamily primaryFamily = ScriptableObject.CreateInstance <SkillFamily>();

            (primaryFamily as ScriptableObject).name = targetPrefab.name + "PrimaryFamily";
            primaryFamily.variants            = new SkillFamily.Variant[0];
            skillLocator.primary._skillFamily = primaryFamily;

            skillLocator.secondary = targetPrefab.AddComponent <GenericSkill>();
            SkillFamily secondaryFamily = ScriptableObject.CreateInstance <SkillFamily>();

            (secondaryFamily as ScriptableObject).name = targetPrefab.name + "SecondaryFamily";
            secondaryFamily.variants            = new SkillFamily.Variant[0];
            skillLocator.secondary._skillFamily = secondaryFamily;

            skillLocator.utility = targetPrefab.AddComponent <GenericSkill>();
            SkillFamily utilityFamily = ScriptableObject.CreateInstance <SkillFamily>();

            (utilityFamily as ScriptableObject).name = targetPrefab.name + "UtilityFamily";
            utilityFamily.variants            = new SkillFamily.Variant[0];
            skillLocator.utility._skillFamily = utilityFamily;

            skillLocator.special = targetPrefab.AddComponent <GenericSkill>();
            SkillFamily specialFamily = ScriptableObject.CreateInstance <SkillFamily>();

            (specialFamily as ScriptableObject).name = targetPrefab.name + "SpecialFamily";
            specialFamily.variants            = new SkillFamily.Variant[0];
            skillLocator.special._skillFamily = specialFamily;

            skillFamilies.Add(primaryFamily);
            skillFamilies.Add(secondaryFamily);
            skillFamilies.Add(utilityFamily);
            skillFamilies.Add(specialFamily);
        }