示例#1
0
 /// <summary>
 /// Unlocks the given states for the specified skill. Also unlocks the skill if
 /// any states exist.
 /// </summary>
 /// <param name="skillType">Type of skill to unlock states for.</param>
 /// <param name="stateIndicies">States of the specified skill to unlock.</param>
 private void UnlockSkillStatesForPlayer(SkillController.SkillEnum skillType, int[] stateIndicies)
 {
     if (stateIndicies.Length > 0)
     {
         skillController.UnlockSkill(skillType);
     }
     for (int i = 0; i < stateIndicies.Length; ++i)
     {
         skillController.UnlockSkillState(skillType, i);
     }
 }
示例#2
0
    /// <summary>
    /// Creates an array of indices of the unlocked states of the given skill.
    /// </summary>
    /// <param name="skillType">Which skill to check the states of.</param>
    /// <returns>Array of indices of the unlocked states of the given skill.</returns>
    private int[] GetUnlockedStatesArray(SkillController.SkillEnum skillType)
    {
        // Create a temporary list to hold the states.
        List <int> unlockedStates = new List <int>();
        Skill      skill          = skillController.GetSkill(skillType);

        // Iterate over the states and check if each one is unlocked.
        for (int i = 0; i < skill.GetAmountStates(); ++i)
        {
            if (skill.IsStateUnlocked(i))
            {
                unlockedStates.Add(i);
            }
        }
        return(unlockedStates.ToArray());
    }