void SetTwoHandWeapon(PEEquipment weapon)
 {
     m_TwoHandWeapon = weapon as PETwoHandWeapon;
     m_TwoHandWeaponHold.twoHandWeapon = m_TwoHandWeapon;
     m_TwoHandWeaponAttack.sword       = m_TwoHandWeapon;
     m_ActiveableEquipment             = m_TwoHandWeapon;
 }
 void SetDigTool(PEEquipment digTool)
 {
     m_DigTool = digTool as PEDigTool;
     m_HandChangeHold.handChangeEquipment = m_DigTool;
     m_DigTerrain.digTool  = m_DigTool;
     m_ActiveableEquipment = m_DigTool;
 }
 void SetAxe(PEEquipment equipment)
 {
     m_Axe        = equipment as PEAxe;
     m_Fell.m_Axe = m_Axe;
     m_HandChangeHold.handChangeEquipment = m_Axe;
     m_ActiveableEquipment = m_Axe;
 }
        public bool SwitchHoldWeapon(IWeapon oldWeapon, IWeapon newWeapon)
        {
            if (m_SwitchWeapon)
            {
                return(false);
            }

            if (null != oldWeapon && !oldWeapon.Equals(null) && null != newWeapon && !newWeapon.Equals(null))
            {
                PEHoldAbleEquipment oldEquip = oldWeapon as PEHoldAbleEquipment;

                if (null != oldEquip && m_MotionMgr.DoAction(oldEquip.m_HandChangeAttr.m_UnActiveActionType))
                {
                    m_SwitchWeapon   = true;
                    m_PutOnNewWeapon = false;
                    m_OldWeapon      = oldWeapon as PEHoldAbleEquipment;
                    m_NewWeapon      = newWeapon as PEHoldAbleEquipment;
                    return(true);
                }
            }
            else
            {
                Debug.LogError("SwitchHoldWeapon is null");
            }

            return(false);
        }
 void ActiveEquipment(PEHoldAbleEquipment equipment, bool active, bool immediately = false)
 {
     if (active)
     {
         if (!m_MotionMgr.IsActionRunning(equipment.m_HandChangeAttr.m_ActiveActionType) &&
             m_MotionMgr.DoAction(equipment.m_HandChangeAttr.m_ActiveActionType))
         {
             m_Weapon = equipment as IWeapon;
             if (null != m_Weapon && null != equipment.m_ItemObj)
             {
                 m_WeaponID = equipment.m_ItemObj.instanceId;
             }
             else
             {
                 m_WeaponID = -1;
             }
         }
     }
     else
     {
         if ((immediately && m_MotionMgr.EndImmediately(equipment.m_HandChangeAttr.m_ActiveActionType)) ||
             (m_MotionMgr.IsActionRunning(equipment.m_HandChangeAttr.m_ActiveActionType) && m_MotionMgr.DoAction(equipment.m_HandChangeAttr.m_UnActiveActionType)))
         {
             m_Weapon   = null;
             m_WeaponID = -1;
         }
     }
 }
 void SetCrusher(PEEquipment crusher)
 {
     m_DigTool = crusher as PEDigTool;
     m_AimEquipHold.aimAbleEquip         = m_DigTool;
     m_DigTerrain.digTool                = m_DigTool;
     m_ActiveableEquipment               = m_DigTool;
     m_HeavyEquipmentCtrl.heavyEquipment = m_DigTool as IHeavyEquipment;
 }
        void SetGrenade(PEEquipment equipment)
        {
            PEGrenade grenade = equipment as PEGrenade;

            m_GunHold.aimAbleEquip = grenade;
            m_ThrowGrenade.grenade = grenade;
            m_ActiveableEquipment  = grenade;
        }
 void SetBow(PEEquipment bow)
 {
     m_Bow                 = bow as PEBow;
     m_BowHold.bow         = m_Bow;
     m_BowReload.bow       = m_Bow;
     m_BowShoot.bow        = m_Bow;
     m_ActiveableEquipment = m_Bow;
 }
        void SetWaterPump(PEEquipment equipment)
        {
            PEWaterPump waterPump = equipment as PEWaterPump;

            m_GunHold.aimAbleEquip = waterPump;
            m_PumpWater.waterPump  = waterPump;
            m_ActiveableEquipment  = waterPump;
        }
 void SetGun(PEEquipment gun)
 {
     m_Gun                  = gun as PEGun;
     m_GunFire.gun          = m_Gun;
     m_GunHold.aimAbleEquip = m_Gun;
     m_GunReload.gun        = m_Gun;
     m_GunMelee.gun         = m_Gun;
     m_ActiveableEquipment  = m_Gun;
 }
 void OnActionEnd(PEActionType type)
 {
     if (null != Weapon)
     {
         PEHoldAbleEquipment equipment = m_Weapon as PEHoldAbleEquipment;
         if (null != equipment && equipment.m_HandChangeAttr.m_ActiveActionType == type)
         {
             m_Weapon   = null;
             m_WeaponID = -1;
         }
     }
 }
 void SetSword(PEEquipment sword)
 {
     if (null != m_Sword && null != sword)
     {
         m_HandChangeHold.handChangeEquipment = null;
         m_SwordAttack.sword   = null;
         m_ActiveableEquipment = null;
     }
     m_Sword = sword as PeSword;
     m_HandChangeHold.handChangeEquipment = m_Sword;
     m_SwordAttack.sword   = m_Sword;
     m_ActiveableEquipment = m_Sword;
 }
 void SetRopeGun(PEEquipment ropeGun)
 {
     m_RopeGunAction.ropeGun = ropeGun as PERopeGun;
     m_GunHold.aimAbleEquip  = m_RopeGunAction.ropeGun;
     m_ActiveableEquipment   = m_RopeGunAction.ropeGun;
 }
 public void ActiveWeapon(PEHoldAbleEquipment handChangeEquipment, bool active, bool immediately = false)
 {
     if (null != m_Gloves && handChangeEquipment == m_Gloves as PEHoldAbleEquipment)
     {
         ActiveGloves(active);
         ActiveEquipment(m_Gloves, active);
     }
     else
     {
         if (null != m_Gloves && Weapon == m_Gloves)
         {
             ActiveGloves(false);
         }
         if (null != handChangeEquipment)
         {
             if (immediately)
             {
                 if (active)
                 {
                     if (!m_MotionMgr.IsActionRunning(handChangeEquipment.m_HandChangeAttr.m_ActiveActionType))
                     {
                         m_MotionMgr.DoActionImmediately(handChangeEquipment.m_HandChangeAttr.m_ActiveActionType);
                         m_Weapon = handChangeEquipment as IWeapon;
                         if (null != m_Weapon && null != handChangeEquipment.m_ItemObj)
                         {
                             m_WeaponID = handChangeEquipment.m_ItemObj.instanceId;
                         }
                         else
                         {
                             m_WeaponID = -1;
                         }
                     }
                 }
                 else
                 {
                     if (m_MotionMgr.IsActionRunning(handChangeEquipment.m_HandChangeAttr.m_ActiveActionType))
                     {
                         m_MotionMgr.EndImmediately(handChangeEquipment.m_HandChangeAttr.m_ActiveActionType);
                         m_WeaponID = -1;
                         m_Weapon   = null;
                     }
                 }
             }
             else
             {
                 if (active)
                 {
                     if (!m_MotionMgr.IsActionRunning(handChangeEquipment.m_HandChangeAttr.m_ActiveActionType) &&
                         m_MotionMgr.DoAction(handChangeEquipment.m_HandChangeAttr.m_ActiveActionType))
                     {
                         m_Weapon = handChangeEquipment as IWeapon;
                         if (null != m_Weapon && null != handChangeEquipment.m_ItemObj)
                         {
                             m_WeaponID = handChangeEquipment.m_ItemObj.instanceId;
                         }
                         else
                         {
                             m_WeaponID = -1;
                         }
                     }
                 }
                 else
                 {
                     if (m_MotionMgr.IsActionRunning(handChangeEquipment.m_HandChangeAttr.m_ActiveActionType) &&
                         m_MotionMgr.DoAction(handChangeEquipment.m_HandChangeAttr.m_UnActiveActionType))
                     {
                         m_Weapon   = null;
                         m_WeaponID = -1;
                     }
                 }
             }
         }
     }
 }