コード例 #1
0
        /// <summary>
        /// Create the item to unsheathe
        /// </summary>
        /// <returns></returns>
        protected virtual void StoreItem()
        {
            string lSlotID = "";

            if (OverrideSlotID.Length > 0)
            {
                lSlotID = OverrideSlotID;
            }
            else
            {
                lSlotID = SlotID;
            }

            if (mInventorySource != null)
            {
                ICombatant lCombatant = mMotionController.gameObject.GetComponent <ICombatant>();
                if (lCombatant != null)
                {
                    if (lCombatant.PrimaryWeapon != null)
                    {
                        lCombatant.PrimaryWeapon.Owner = null;
                    }
                    lCombatant.PrimaryWeapon = null;
                }

                mInventorySource.StoreItem(lSlotID);

                // Remove a body sphere we may have added
                mMotionController._ActorController.RemoveBodyShape("Combatant Shape");
            }
        }
コード例 #2
0
        /// <summary>
        /// Create the item to unsheathe
        /// </summary>
        /// <returns></returns>
        private void StoreItem()
        {
            string lSlotID = "";

            if (OverrideSlotID.Length > 0)
            {
                lSlotID = OverrideSlotID;
            }
            else
            {
                lSlotID = SlotID;
            }

            if (mInventorySource != null)
            {
                if (mCombatant != null)
                {
                    if (mCombatant.PrimaryWeapon != null)
                    {
                        mCombatant.PrimaryWeapon.Owner = null;
                    }
                    mCombatant.PrimaryWeapon = null;
                }

                mInventorySource.StoreItem(lSlotID);
            }

            // Remove a body sphere we may have added
            mMotionController._ActorController.RemoveBodyShape("Combatant Shape");
        }
コード例 #3
0
        /// <summary>
        /// Create the item to unsheathe
        /// </summary>
        /// <returns></returns>
        protected virtual void StoreItem()
        {
            string lSlotID = "";

            if (OverrideSlotID.Length > 0)
            {
                lSlotID = OverrideSlotID;
            }
            else
            {
                lSlotID = SlotID;
            }

            GameObject lWeapon = mEquippedItem;

            ICombatant lCombatant = mMotionController.gameObject.GetComponent <ICombatant>();

            if (lCombatant != null)
            {
                if (lCombatant.PrimaryWeapon != null)
                {
                    lWeapon = lCombatant.PrimaryWeapon.gameObject;
                    lCombatant.PrimaryWeapon.Owner = null;
                }

                lCombatant.PrimaryWeapon = null;
            }

            if (mInventorySource != null)
            {
                mInventorySource.StoreItem(lSlotID);
            }
            else
            {
                if (lWeapon == null)
                {
                    Transform lParentBone      = FindTransform(mMotionController._Transform, _SlotID);
                    Transform lWeaponTransform = lParentBone.GetChild(lParentBone.childCount - 1);
                    if (lWeaponTransform != null)
                    {
                        lWeapon = lWeaponTransform.gameObject;
                    }
                }

                if (lWeapon != null)
                {
                    GameObject.Destroy(lWeapon);
                    mEquippedItem = null;
                }
            }

            // Remove a body sphere we may have added
            mMotionController._ActorController.RemoveBodyShape("Combatant Shape");
        }