示例#1
0
        /// <summary> Performs a Fast equiping of a MWeapon</summary>
        /// <param name="weapon">Weapon to equip</param>
        /// <param name="doParent">Parent the weapon to the Hand, it also resets the scale to 1.1.1</param>
        public virtual void Equip_FAST(MWeapon weapon, bool doParent = true)
        {
            Weapon = weapon;

            if (debug)
            {
                Debug.Log($"<b>{name}:<color=cyan> [FAST EQUIP -> {Weapon.Holster.name} -> {Weapon.name}]</color> </b>");         //Debug
            }
            ExitAim();


            SendMessage(Weapon.IsRightHanded ? FreeRightHand : FreeLeftHand, true);  //IK REINS

            WeaponType   = Weapon.WeaponType;
            WeaponAction = WA.Idle;                                             //Set the Action to Equip
            CombatMode   = true;
            Weapon.PrepareWeapon(this);
            Weapon.GetComponent <ICollectable>()?.Pick();

            Weapon.PlaySound(0); //Play Draw Sound

            if (doParent)
            {
                Weapon.gameObject.SetActive(true);                                                             //Set the Game Object Instance Active
                ParentWeapon();
                Weapon.transform.SetLocalTransform(Weapon.PositionOffset, Weapon.RotationOffset, Vector3.one); //Local position when is Parent to the weapon
            }

            OnEquipWeapon.Invoke(Weapon.gameObject);
        }
示例#2
0
        /// <summary>If the Rider had a weapon before mounting.. equip it.
        /// The weapon need an |IMWeapon| Interface, if not it wont be equiped</summary>
        public virtual void SetWeaponBeforeMounting(MWeapon weapon)
        {
            if (weapon == null)
            {
                return;
            }
            Weapon = weapon;
            if (Weapon)                                        //If the weapon doesn't have IMweapon Interface do nothing
            {
                CombatMode = true;

                Weapon.PrepareWeapon(this);
                Holster_SetActive(Weapon.HolsterID);                                                //Set the Active holster for the Active Weapon

                WeaponType   = Weapon.WeaponType;                                                   //Set the Weapon Type
                WeaponAction = WA.Idle;
                OnEquipWeapon.Invoke(Weapon.gameObject);
                Weapon.GetComponent <ICollectable>()?.Pick();

                ExitAim();

                Weapon.gameObject.SetActive(true);                                      //Set the Game Object Instance Active
                ParentWeapon();

                SendMessage(Weapon.IsRightHanded ? FreeRightHand : FreeLeftHand, true);  //IK REINS Message


                if (debug)
                {
                    Debug.Log($"<b>{name}:<color=cyan> [EQUIP BEFORE MOUNTING -> {Weapon.Holster.name} -> {Weapon.name}]</color> </b>"); //Debug
                }
                Weapon.gameObject.SetActive(true);                                                                                       //Set the Game Object Instance Active
                ParentWeapon();

                Weapon.GetComponent <ICollectable>()?.Pick();
            }
        }