private SkillFamily GetSkillFamily(List <ICustomSkill> skills)
        {
            var family = SkillFamily.CreateInstance <SkillFamily>();

            family.defaultVariantIndex      = 0;
            family.variants                 = GetVarients(skills);
            ((ScriptableObject)family).name = skills.First().SkillType.ToString();
            return(family);
        }
Exemple #2
0
        private void RegisterSkills(GameObject sephPrefab)
        {
            // first get the locator
            var locator = sephPrefab.GetComponentInChildren <SkillLocator>();

            // passive?
            locator.passiveSkill.enabled = true;
            locator.passiveSkill.skillDescriptionToken = "Attacks from Sephiroths Masamune leech life on hit.";
            locator.passiveSkill.skillNameToken        = "Masamune";
            locator.passiveSkill.icon = Assets.SephIcon;

            // create skill def for primary
            SkillDef primaryDef = SkillDef.CreateInstance <SkillDef>();

            primaryDef.activationState = new EntityStates.SerializableEntityStateType(typeof(EntityStates.Sephiroth.Primary));
            var field2 = typeof(EntityStates.SerializableEntityStateType)?.GetField("_typeName", BindingFlags.NonPublic | BindingFlags.Instance);

            field2?.SetValue(primaryDef.activationState, typeof(EntityStates.Sephiroth.Primary)?.AssemblyQualifiedName);
            primaryDef.baseRechargeInterval         = 1f;
            primaryDef.baseMaxStock                 = 1;
            primaryDef.rechargeStock                = 1;
            primaryDef.skillName                    = "SephSwipe";
            primaryDef.skillNameToken               = "Heartless Angel";
            primaryDef.skillDescriptionToken        = "Sephiroth unleashes a barrage of deadly precise attacks at high speed.";
            primaryDef.activationStateMachineName   = locator.secondary.skillFamily.variants[0].skillDef.activationStateMachineName;
            primaryDef.isBullets                    = false;
            primaryDef.beginSkillCooldownOnSkillEnd = true;
            primaryDef.interruptPriority            = EntityStates.InterruptPriority.Any;
            primaryDef.isCombatSkill                = true;
            primaryDef.noSprint = false;
            primaryDef.canceledFromSprinting = false;
            primaryDef.mustKeyPress          = true;
            primaryDef.requiredStock         = 1;
            primaryDef.stockToConsume        = 0;
            primaryDef.icon = Assets.SephIcon;

            // skill family for primary
            var primaryFam = SkillFamily.CreateInstance <SkillFamily>();

            primaryFam.defaultVariantIndex = 0;
            SkillFamily.Variant[] variantsPrimary = new SkillFamily.Variant[1];
            variantsPrimary[0] = new SkillFamily.Variant()
            {
                skillDef = primaryDef, unlockableName = "", viewableNode = new ViewablesCatalog.Node("M1", false)
            };
            primaryFam.variants = variantsPrimary;
            ((ScriptableObject)primaryFam).name = "sephPrimary";

            //primary
            SkillAPI.AddSkill(typeof(EntityStates.Sephiroth.Primary));
            SkillAPI.AddSkillDef(primaryDef);
            SkillAPI.AddSkillFamily(primaryFam);

            // add skills to player
            locator.primary.SetFieldValue <SkillFamily>("_skillFamily", primaryFam);
        }