Exemplo n.º 1
0
    /// <summary>
    /// Called when the script object is loaded
    /// </summary>
    void OnEnable()
    {
        // Grab the serialized objects
        mTarget   = (BasicAttributes)target;
        mTargetSO = new SerializedObject(target);

        // Initialize the cache
        if (!Application.isPlaying)
        {
            mTarget.Awake();
        }

        // Temporary
        int lCount = 0;

        for (int i = mTarget.Items.Count - 1; i >= 0; i--)
        {
            if (mTarget.Items[i] == null)
            {
                lCount++;  mTarget.Items.RemoveAt(i);
            }
        }

        if (lCount > 0 && mTarget.Items.Count == 0)
        {
            mTarget.SetAttributeValue <float>("Health", 100f);
        }

        // Create the list of items to display
        InstantiateAttributeItemList();
    }
        void ModifyAttribute()
        {
            GameObject go = Fsm.GetOwnerDefaultTarget(gameObject);

            if (go == null)
            {
                return;
            }

            mBasicAttributes = go.GetComponent <BasicAttributes>();

            if (mBasicAttributes != null)
            {
                if (!perSecond)
                {
                    float lValue = mBasicAttributes.GetAttributeValue <float>(attribute.Value);
                    mBasicAttributes.SetAttributeValue(attribute.Value, lValue + floatValue.Value);
                }
                else
                {
                    float lValue = mBasicAttributes.GetAttributeValue <float>(attribute.Value);
                    mBasicAttributes.SetAttributeValue(attribute.Value, lValue + floatValue.Value * Time.deltaTime);
                }
            }
        }
Exemplo n.º 3
0
    /// <summary>
    /// Called when the script object is loaded
    /// </summary>
    void OnEnable()
    {
        // Grab the serialized objects
        mTarget   = (BasicAttributes)target;
        mTargetSO = new SerializedObject(target);

        // Create the list of items to display
        InstantiateItemList();
    }
Exemplo n.º 4
0
        /// <summary>
        /// Initializes the MonoBehaviour
        /// </summary>
        private void Awake()
        {
            mCombatant        = gameObject.GetComponent <Combatant>();
            mMotionController = gameObject.GetComponent <MotionController>();
            mBasicAttributes  = gameObject.GetComponent <BasicAttributes>();
            mBasicInventory   = gameObject.GetComponent <BasicInventory>();
            mSpellInventory   = gameObject.GetComponent <SpellInventory>();

            if (Target != null)
            {
                mTargetMotionController = Target.gameObject.GetComponent <MotionController>();
            }
        }
        void SetAttribute()
        {
            GameObject go = Fsm.GetOwnerDefaultTarget(gameObject);

            if (go == null)
            {
                return;
            }

            mBasicAttributes = go.GetComponent <BasicAttributes>();

            if (mBasicAttributes != null)
            {
                float lValue = mBasicAttributes.GetAttributeValue <float>(attribute.Value);
                mBasicAttributes.SetAttributeValue(attribute.Value, floatValue.Value);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Create the BasicAttributes and add the Health attribute
        /// </summary>
        /// <param name="rMotionController"></param>
        /// <param name="rHealth">Health value to set; if the Health attribute already exist, then its value
        /// is not overwritten</param>
        /// <param name="rMana"></param>
        /// <param name="rStamina"></param>
        /// <returns></returns>
        public static BasicAttributes CreateBasicAttributes(MotionController rMotionController, float rHealth, float rMana = 0, float rStamina = 0)
        {
            BasicAttributes lAttributes = rMotionController.GetOrAddComponent <BasicAttributes>();

            if (!lAttributes.AttributeExists("Health"))
            {
                lAttributes.SetAttributeValue <float>("Health", rHealth);
                BasicAttributeFloat lHealth = lAttributes.GetAttribute("Health") as BasicAttributeFloat;
                if (lHealth != null)
                {
                    lHealth.MinValue = 0;
                    lHealth.MaxValue = rHealth;
                }
            }

            if (rMana > 0 && !lAttributes.AttributeExists("Mana"))
            {
                lAttributes.SetAttributeValue <float>("Mana", rMana);
                BasicAttributeFloat lMana = lAttributes.GetAttribute("Mana") as BasicAttributeFloat;
                if (lMana != null)
                {
                    lMana.MinValue = 0;
                    lMana.MaxValue = rMana;
                }
            }

            if (rStamina > 0 && !lAttributes.AttributeExists("Stamina"))
            {
                lAttributes.SetAttributeValue <float>("Stamina", rStamina);
                BasicAttributeFloat lStamina = lAttributes.GetAttribute("Stamina") as BasicAttributeFloat;
                if (lStamina != null)
                {
                    lStamina.MinValue = 0;
                    lStamina.MaxValue = rMana;
                }
            }

            lAttributes.OnBeforeSerialize();

            return(lAttributes);
        }
Exemplo n.º 7
0
        protected virtual void Start()
        {
            // If no Slider was assigned or found, don't continue initializing
            if (_HealthBar == null)
            {
                return;
            }

            // If this HUD is for the player, attempt to find the player
            if (_UsePlayer)
            {
                var player = GameObject.FindGameObjectWithTag("Player");
                if (player != null)
                {
                    _BasicAttributes = player.GetComponent <BasicAttributes>();
                }
            }
            if (_BasicAttributes == null)
            {
                return;
            }

            BasicAttributeFloat lHealthAttribute = _BasicAttributes.GetAttribute(_HealthKey) as BasicAttributeFloat;

            if (lHealthAttribute == null)
            {
                return;
            }

            // Set the slider min and max values
            SetupSlider(lHealthAttribute, _HealthBar);

            // Subscribe to change notifications
            _BasicAttributes.OnAttributeValueChangedEvent += OnAttributeValueChanged;

            mIsInitialized = true;

            SetVisibility(CheckVisibilityState());
        }
Exemplo n.º 8
0
        public virtual void SetupMocks()
        {
            mockContext = Org.Mockito.Mockito.Mock <DirContext>();
            Org.Mockito.Mockito.DoReturn(mockContext).When(mappingSpy).GetDirContext();
            SearchResult mockUserResult = Org.Mockito.Mockito.Mock <SearchResult>();

            // We only ever call hasMoreElements once for the user NamingEnum, so
            // we can just have one return value
            Org.Mockito.Mockito.When(mockUserNamingEnum.MoveNext()).ThenReturn(true);
            Org.Mockito.Mockito.When(mockUserNamingEnum.Current).ThenReturn(mockUserResult);
            Org.Mockito.Mockito.When(mockUserResult.GetNameInNamespace()).ThenReturn("CN=some_user,DC=test,DC=com"
                                                                                     );
            SearchResult mockGroupResult = Org.Mockito.Mockito.Mock <SearchResult>();

            // We're going to have to define the loop here. We want two iterations,
            // to get both the groups
            Org.Mockito.Mockito.When(mockGroupNamingEnum.MoveNext()).ThenReturn(true, true, false
                                                                                );
            Org.Mockito.Mockito.When(mockGroupNamingEnum.Current).ThenReturn(mockGroupResult);
            // Define the attribute for the name of the first group
            Attribute group1Attr = new BasicAttribute("cn");

            group1Attr.Add(testGroups[0]);
            Attributes group1Attrs = new BasicAttributes();

            group1Attrs.Put(group1Attr);
            // Define the attribute for the name of the second group
            Attribute group2Attr = new BasicAttribute("cn");

            group2Attr.Add(testGroups[1]);
            Attributes group2Attrs = new BasicAttributes();

            group2Attrs.Put(group2Attr);
            // This search result gets reused, so return group1, then group2
            Org.Mockito.Mockito.When(mockGroupResult.GetAttributes()).ThenReturn(group1Attrs,
                                                                                 group2Attrs);
        }
Exemplo n.º 9
0
        /// <summary>
        /// Draws the inspector for the pack
        /// </summary>
        /// <returns></returns>
        public static bool OnPackInspector(MotionController rMotionController)
        {
            EditorHelper.DrawSmallTitle(GroupName());
            EditorHelper.DrawLink("Mixamo Pro Magic Pack Animations", "http://www.ootii.com/Unity/MotionPacks/SpellCasting/SpellCastingUsersGuide.pdf");

            GUILayout.Space(5f);

            EditorGUILayout.LabelField("See included documentation:", EditorHelper.SmallBoldLabel);
            EditorGUILayout.LabelField("1. Download and import animations.", EditorHelper.SmallLabel);
            EditorGUILayout.LabelField("2. Unzip and replace animation meta files.", EditorHelper.SmallLabel);
            EditorGUILayout.LabelField("3. Select options and create motions.", EditorHelper.SmallLabel);

            EditorHelper.DrawLine();

            EditorHelper.BoolField("Create Mecanim States", "Determines if we create/override the existing sub-state machine", sCreateSubStateMachines);
            sCreateSubStateMachines = EditorHelper.FieldBoolValue;

            EditorHelper.BoolField("Create Input Aliases", "Determines if we create input aliases", sCreateInputAliases);
            sCreateInputAliases = EditorHelper.FieldBoolValue;

            EditorHelper.BoolField("Create Inventory", "Determines if we create/override the existing inventory", sCreateInventory);
            sCreateInventory = EditorHelper.FieldBoolValue;

            EditorHelper.BoolField("Create Attributes", "Determines if we create/override the existing attributes", sCreateAttributes);
            sCreateAttributes = EditorHelper.FieldBoolValue;

            EditorHelper.BoolField("Create Spell Inventory", "Create the spell inventory for the caster", sCreateSpellInventory);
            sCreateSpellInventory = EditorHelper.FieldBoolValue;

            EditorHelper.BoolField("Create Combatant", "Determines if we create/override the existing core", sCreateCore);
            sCreateCore = EditorHelper.FieldBoolValue;

            EditorHelper.BoolField("Create Motions", "Determines if we create the archery motions", sCreateMotions);
            sCreateMotions = EditorHelper.FieldBoolValue;

            GUILayout.Space(5f);

            if (GUILayout.Button(new GUIContent("Setup Pack", "Create and setup the motion pack."), EditorStyles.miniButton))
            {
                if (sCreateInventory)
                {
                    BasicInventory lInventory = rMotionController.gameObject.GetComponent <BasicInventory>();
                    if (lInventory == null)
                    {
                        lInventory = rMotionController.gameObject.AddComponent <BasicInventory>();
                    }

                    BasicInventoryItem lItem = lInventory.GetInventoryItem("Spell_01");
                    if (lItem != null)
                    {
                        lInventory.Items.Remove(lItem);
                    }

                    lInventory.Items.Add(new BasicInventoryItem());
                    lInventory.Items[lInventory.Items.Count - 1].ID          = "Spell_01";
                    lInventory.Items[lInventory.Items.Count - 1].EquipMotion = "PMP_EquipSpell";
                    lInventory.Items[lInventory.Items.Count - 1].StoreMotion = "PMP_StoreSpell";

                    BasicInventorySlot lSlot = lInventory.GetInventorySlot("RIGHT_HAND");
                    if (lSlot == null)
                    {
                        lInventory.Slots.Add(new BasicInventorySlot());
                        lInventory.Slots[lInventory.Slots.Count - 1].ID     = "RIGHT_HAND";
                        lInventory.Slots[lInventory.Slots.Count - 1].ItemID = "";
                    }

                    if (lInventory.GetInventorySlot("LEFT_HAND") == null)
                    {
                        lInventory.Slots.Add(new BasicInventorySlot());
                        lInventory.Slots[lInventory.Slots.Count - 1].ID     = "LEFT_HAND";
                        lInventory.Slots[lInventory.Slots.Count - 1].ItemID = "";
                    }

                    lSlot = lInventory.GetInventorySlot("LEFT_LOWER_ARM");
                    if (lSlot == null)
                    {
                        lInventory.Slots.Add(new BasicInventorySlot());
                        lInventory.Slots[lInventory.Slots.Count - 1].ID     = "LEFT_LOWER_ARM";
                        lInventory.Slots[lInventory.Slots.Count - 1].ItemID = "";
                    }

                    if (lInventory.GetInventorySlot("READY_PROJECTILE") == null)
                    {
                        lInventory.Slots.Add(new BasicInventorySlot());
                        lInventory.Slots[lInventory.Slots.Count - 1].ID     = "READY_PROJECTILE";
                        lInventory.Slots[lInventory.Slots.Count - 1].ItemID = "";
                    }

                    BasicInventorySet lWeaponSet = lInventory.GetWeaponSet("Spell Casting");
                    if (lWeaponSet != null)
                    {
                        lInventory.WeaponSets.Remove(lWeaponSet);
                    }

                    lWeaponSet    = new BasicInventorySet();
                    lWeaponSet.ID = "Spell Casting";

                    BasicInventorySetItem lWeaponSetItem = new BasicInventorySetItem();
                    lWeaponSetItem.ItemID      = "";
                    lWeaponSetItem.SlotID      = "LEFT_HAND";
                    lWeaponSetItem.Instantiate = true;
                    lWeaponSet.Items.Add(lWeaponSetItem);

                    lWeaponSetItem             = new BasicInventorySetItem();
                    lWeaponSetItem.ItemID      = "";
                    lWeaponSetItem.SlotID      = "READY_PROJECTILE";
                    lWeaponSetItem.Instantiate = false;
                    lWeaponSet.Items.Add(lWeaponSetItem);

                    lWeaponSetItem             = new BasicInventorySetItem();
                    lWeaponSetItem.ItemID      = "Spell_01";
                    lWeaponSetItem.SlotID      = "RIGHT_HAND";
                    lWeaponSetItem.Instantiate = false;
                    lWeaponSet.Items.Add(lWeaponSetItem);

                    lWeaponSetItem             = new BasicInventorySetItem();
                    lWeaponSetItem.ItemID      = "";
                    lWeaponSetItem.SlotID      = "LEFT_LOWER_ARM";
                    lWeaponSetItem.Instantiate = false;
                    lWeaponSet.Items.Add(lWeaponSetItem);

                    if (lInventory.WeaponSets.Count == 0)
                    {
                        BasicInventorySet lFirstWeaponSet = new BasicInventorySet();
                        lFirstWeaponSet.ID = "Sword and Shield";

                        lInventory.WeaponSets.Add(lFirstWeaponSet);
                    }

                    if (lInventory.WeaponSets.Count == 1)
                    {
                        BasicInventorySet lSecondWeaponSet = new BasicInventorySet();
                        lSecondWeaponSet.ID = "Longbow";

                        lInventory.WeaponSets.Add(lSecondWeaponSet);
                    }

                    lInventory.WeaponSets.Insert(2, lWeaponSet);
                }

                if (sCreateAttributes)
                {
                    BasicAttributes lAttributes = rMotionController.gameObject.GetComponent <BasicAttributes>();
                    if (lAttributes == null)
                    {
                        lAttributes = rMotionController.gameObject.AddComponent <BasicAttributes>();
                    }

                    BasicAttribute lAttribute = lAttributes.GetAttribute("Health");
                    if (lAttribute != null)
                    {
                        lAttributes.Items.Remove(lAttribute);
                    }

                    lAttributes.Items.Add(new BasicAttribute());
                    lAttributes.Items[lAttributes.Items.Count - 1].ID = "Health";
                    lAttributes.Items[lAttributes.Items.Count - 1].SetValue <float>(100f);
                }

                if (sCreateSpellInventory)
                {
                    SpellInventory lAttributes = rMotionController.gameObject.GetComponent <SpellInventory>();
                    if (lAttributes == null)
                    {
                        lAttributes = rMotionController.gameObject.AddComponent <SpellInventory>();
                    }
                }

                if (sCreateCore)
                {
                    Combatant lCombatant = rMotionController.gameObject.GetComponent <Combatant>();
                    if (lCombatant == null)
                    {
                        lCombatant = rMotionController.gameObject.AddComponent <Combatant>();
                    }

                    if (rMotionController._ActorController == null || !rMotionController._ActorController.UseTransformPosition)
                    {
                        lCombatant.IsLockingEnabled = true;
                        lCombatant.TargetLockedIcon = AssetDatabase.LoadAssetAtPath <Texture>("Assets/ootii/Framework_v1/Content/Textures/UI/TargetIcon_2.png");
                    }

                    ActorCore lCore = rMotionController.gameObject.GetComponent <ActorCore>();
                    if (lCore == null)
                    {
                        lCore = rMotionController.gameObject.AddComponent <ActorCore>();
                    }

                    lCore.IsAlive = true;
                }

                if (sCreateInputAliases)
                {
                    // Sheathe
                    if (!InputManagerHelper.IsDefined("Spell Casting Equip"))
                    {
                        InputManagerEntry lEntry = new InputManagerEntry();
                        lEntry.Name           = "Spell Casting Equip";
                        lEntry.PositiveButton = "3"; // "3" key
                        lEntry.Gravity        = 1000;
                        lEntry.Dead           = 0.001f;
                        lEntry.Sensitivity    = 1000;
                        lEntry.Type           = InputManagerEntryType.KEY_MOUSE_BUTTON;
                        lEntry.Axis           = 0;
                        lEntry.JoyNum         = 0;
                        InputManagerHelper.AddEntry(lEntry, true);

                        lEntry             = new InputManagerEntry();
                        lEntry.Name        = "Spell Casting Equip";
                        lEntry.Gravity     = 1000;
                        lEntry.Dead        = 0.001f;
                        lEntry.Sensitivity = 1000;
                        lEntry.JoyNum      = 0;

#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
                        lEntry.PositiveButton = "joystick button 8";
                        lEntry.Type           = InputManagerEntryType.KEY_MOUSE_BUTTON; // D-pad Y
                        lEntry.Axis           = 0;
#else
                        lEntry.PositiveButton = "";
                        lEntry.Type           = InputManagerEntryType.JOYSTICK_AXIS; // D-pad Y
                        lEntry.Axis           = 7;
#endif

                        InputManagerHelper.AddEntry(lEntry, true);
                    }

                    // Fire
                    if (!InputManagerHelper.IsDefined("Spell Casting Cast"))
                    {
                        InputManagerEntry lEntry = new InputManagerEntry();
                        lEntry.Name              = "Spell Casting Cast";
                        lEntry.PositiveButton    = "left ctrl";
                        lEntry.AltPositiveButton = "mouse 0"; // Left mouse button
                        lEntry.Gravity           = 1000;
                        lEntry.Dead              = 0.001f;
                        lEntry.Sensitivity       = 1000;
                        lEntry.Type              = InputManagerEntryType.KEY_MOUSE_BUTTON;
                        lEntry.Axis              = 0;
                        lEntry.JoyNum            = 0;
                        InputManagerHelper.AddEntry(lEntry, true);

                        lEntry      = new InputManagerEntry();
                        lEntry.Name = "Spell Casting Cast";

#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
                        lEntry.PositiveButton = "joystick button 16"; // Green A
#else
                        lEntry.PositiveButton = "joystick button 0";  // Green A
#endif

                        lEntry.Gravity     = 1000;
                        lEntry.Dead        = 0.001f;
                        lEntry.Sensitivity = 1000;
                        lEntry.Type        = InputManagerEntryType.KEY_MOUSE_BUTTON;
                        lEntry.Axis        = 0;
                        lEntry.JoyNum      = 0;
                        InputManagerHelper.AddEntry(lEntry, true);
                    }

                    // Continue
                    if (!InputManagerHelper.IsDefined("Spell Casting Continue"))
                    {
                        InputManagerEntry lEntry = new InputManagerEntry();
                        lEntry.Name              = "Spell Casting Continue";
                        lEntry.PositiveButton    = "left ctrl";
                        lEntry.AltPositiveButton = "mouse 0"; // Left mouse button
                        lEntry.Gravity           = 1000;
                        lEntry.Dead              = 0.001f;
                        lEntry.Sensitivity       = 1000;
                        lEntry.Type              = InputManagerEntryType.KEY_MOUSE_BUTTON;
                        lEntry.Axis              = 0;
                        lEntry.JoyNum            = 0;
                        InputManagerHelper.AddEntry(lEntry, true);

                        lEntry      = new InputManagerEntry();
                        lEntry.Name = "Spell Casting Continue";

#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
                        lEntry.PositiveButton = "joystick button 16"; // Green A
#else
                        lEntry.PositiveButton = "joystick button 0";  // Green A
#endif

                        lEntry.Gravity     = 1000;
                        lEntry.Dead        = 0.001f;
                        lEntry.Sensitivity = 1000;
                        lEntry.Type        = InputManagerEntryType.KEY_MOUSE_BUTTON;
                        lEntry.Axis        = 0;
                        lEntry.JoyNum      = 0;
                        InputManagerHelper.AddEntry(lEntry, true);
                    }

                    // Cancel
                    if (!InputManagerHelper.IsDefined("Spell Casting Cancel"))
                    {
                        InputManagerEntry lEntry = new InputManagerEntry();
                        lEntry.Name           = "Spell Casting Cancel";
                        lEntry.PositiveButton = "escape";
                        lEntry.Gravity        = 1000;
                        lEntry.Dead           = 0.001f;
                        lEntry.Sensitivity    = 1000;
                        lEntry.Type           = InputManagerEntryType.KEY_MOUSE_BUTTON;
                        lEntry.Axis           = 0;
                        lEntry.JoyNum         = 0;
                        InputManagerHelper.AddEntry(lEntry, true);

                        lEntry      = new InputManagerEntry();
                        lEntry.Name = "Spell Casting Cancel";

#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
                        lEntry.PositiveButton = "joystick button 19"; // Yellow Y
#else
                        lEntry.PositiveButton = "joystick button 3";  // Yellow Y
#endif

                        lEntry.Gravity     = 1000;
                        lEntry.Dead        = 0.001f;
                        lEntry.Sensitivity = 1000;
                        lEntry.Type        = InputManagerEntryType.KEY_MOUSE_BUTTON;
                        lEntry.Axis        = 0;
                        lEntry.JoyNum      = 0;
                        InputManagerHelper.AddEntry(lEntry, true);
                    }

                    // Move Up
                    if (!InputManagerHelper.IsDefined("Move Up"))
                    {
                        InputManagerEntry lEntry = new InputManagerEntry();
                        lEntry.Name           = "Move Up";
                        lEntry.PositiveButton = "e";
                        lEntry.Gravity        = 1000;
                        lEntry.Dead           = 0.001f;
                        lEntry.Sensitivity    = 1000;
                        lEntry.Type           = InputManagerEntryType.KEY_MOUSE_BUTTON;
                        lEntry.Axis           = 0;
                        lEntry.JoyNum         = 0;

                        InputManagerHelper.AddEntry(lEntry, true);
                    }

                    // Move down
                    if (!InputManagerHelper.IsDefined("Move Down"))
                    {
                        InputManagerEntry lEntry = new InputManagerEntry();
                        lEntry.Name           = "Move Down";
                        lEntry.PositiveButton = "q";
                        lEntry.Gravity        = 1000;
                        lEntry.Dead           = 0.001f;
                        lEntry.Sensitivity    = 1000;
                        lEntry.Type           = InputManagerEntryType.KEY_MOUSE_BUTTON;
                        lEntry.Axis           = 0;
                        lEntry.JoyNum         = 0;

                        InputManagerHelper.AddEntry(lEntry, true);
                    }
                }

                if (sCreateMotions || sCreateSubStateMachines)
                {
                    IBaseCameraRig lCameraRig = rMotionController.CameraRig;
                    if (lCameraRig == null)
                    {
                        lCameraRig = rMotionController.ExtractCameraRig(rMotionController.CameraTransform);
                    }

                    if (rMotionController.MotionLayers.Count == 0)
                    {
                        MotionControllerLayer lMotionLayer = new MotionControllerLayer();
                        rMotionController.MotionLayers.Add(lMotionLayer);
                    }

                    PMP_Idle lIdle = rMotionController.GetMotion <PMP_Idle>();
                    if (lIdle == null)
                    {
                        lIdle = rMotionController.CreateMotion <PMP_Idle>(0);
                    }

                    PMP_EquipSpell lEquip = rMotionController.GetMotion <PMP_EquipSpell>(0);
                    if (lEquip == null)
                    {
                        lEquip = rMotionController.CreateMotion <PMP_EquipSpell>(0);
                    }

                    PMP_StoreSpell lStore = rMotionController.GetMotion <PMP_StoreSpell>(0);
                    if (lStore == null)
                    {
                        lStore = rMotionController.CreateMotion <PMP_StoreSpell>(0);
                    }

                    PMP_WalkRunPivot lPivot = rMotionController.GetMotion <PMP_WalkRunPivot>(0);
                    if (lPivot == null)
                    {
                        lPivot = rMotionController.CreateMotion <PMP_WalkRunPivot>(0);
                    }

                    PMP_WalkRunStrafe lStrafe = rMotionController.GetMotion <PMP_WalkRunStrafe>(0);
                    if (lStrafe == null)
                    {
                        lStrafe = rMotionController.CreateMotion <PMP_WalkRunStrafe>(0);
                    }

                    PMP_BasicSpellCastings lCast = rMotionController.GetMotion <PMP_BasicSpellCastings>(0);
                    if (lCast == null)
                    {
                        lCast = rMotionController.CreateMotion <PMP_BasicSpellCastings>(0);
                    }

                    Cower lCower = rMotionController.GetMotion <Cower>(0);
                    if (lCower == null)
                    {
                        lCower = rMotionController.CreateMotion <Cower>(0);
                    }

                    Death lDeath = rMotionController.GetMotion <Death>(0);
                    if (lDeath == null)
                    {
                        lDeath = rMotionController.CreateMotion <Death>(0);
                    }

                    Damaged lDamaged = rMotionController.GetMotion <Damaged>(0);
                    if (lDamaged == null)
                    {
                        lDamaged = rMotionController.CreateMotion <Damaged>(0);
                    }

                    Frozen lFrozen = rMotionController.GetMotion <Frozen>(0);
                    if (lFrozen == null)
                    {
                        lFrozen = rMotionController.CreateMotion <Frozen>(0);
                    }

                    KnockedDown lKnockedDown = rMotionController.GetMotion <KnockedDown>(0);
                    if (lKnockedDown == null)
                    {
                        lKnockedDown = rMotionController.CreateMotion <KnockedDown>(0);
                    }

                    Levitate lLevitate = rMotionController.GetMotion <Levitate>(0);
                    if (lLevitate == null)
                    {
                        lLevitate = rMotionController.CreateMotion <Levitate>(0);
                    }

                    PushedBack lPushedBack = rMotionController.GetMotion <PushedBack>(0);
                    if (lPushedBack == null)
                    {
                        lPushedBack = rMotionController.CreateMotion <PushedBack>(0);
                    }

                    Sleep lSleep = rMotionController.GetMotion <Sleep>(0);
                    if (lSleep == null)
                    {
                        lSleep = rMotionController.CreateMotion <Sleep>(0);
                    }

                    Stunned lStunned = rMotionController.GetMotion <Stunned>(0);
                    if (lStunned == null)
                    {
                        lStunned = rMotionController.CreateMotion <Stunned>(0);
                    }

                    if (sCreateSubStateMachines)
                    {
                        Animator lAnimator = rMotionController.Animator;
                        if (lAnimator == null)
                        {
                            lAnimator = rMotionController.gameObject.GetComponent <Animator>();
                        }

                        if (lAnimator != null)
                        {
                            UnityEditor.Animations.AnimatorController lAnimatorController = lAnimator.runtimeAnimatorController as UnityEditor.Animations.AnimatorController;

                            lIdle.CreateStateMachine(lAnimatorController);
                            lEquip.CreateStateMachine(lAnimatorController);
                            lPivot.CreateStateMachine(lAnimatorController);
                            lStrafe.CreateStateMachine(lAnimatorController);
                            lCast.CreateStateMachine(lAnimatorController);
                            lDeath.CreateStateMachine(lAnimatorController);
                            lLevitate.CreateStateMachine(lAnimatorController);
                        }
                    }
                }

                EditorUtility.DisplayDialog("Motion Pack: " + GroupName(), "Motion pack imported.", "ok");

                return(true);
            }

            return(false);
        }
Exemplo n.º 10
0
 /// <summary>
 /// Called when the object is selected in the editor
 /// </summary>
 private void OnEnable()
 {
     // Grab the serialized objects
     mTarget   = (BasicAttributes)target;
     mTargetSO = new SerializedObject(target);
 }