// Equip Animation event. public void EquipAnimationEvent() { Weapon.WEAPONTYPE type = m_currentWeapon.getWeaponType(); m_inEquipingAction = false; switch (type) { case Weapon.WEAPONTYPE.primary: // Select rifle as currentWeapon // Debug.Log("Primary Equip finished"); m_rifleProp.setVisible(false); m_currentWeapon = m_rifle; break; case Weapon.WEAPONTYPE.secondary: // Select pistol as currentWeapon // Debug.Log("Secondary Equip finished"); m_pistolProp.setVisible(false); m_currentWeapon = m_pistol; break; } // Set Current Weapon Properties. m_currentWeapon.gameObject.SetActive(true); m_currentWeapon.setGunTarget(m_target); }
// UnEquip Animation event. public void UnEquipAnimationEvent() { Weapon.WEAPONTYPE type = m_currentWeapon.getWeaponType(); m_currentWeapon.gameObject.SetActive(false); m_currentWeapon = null; m_inEquipingAction = false; switch (type) { case Weapon.WEAPONTYPE.primary: m_rifleProp.setVisible(true); // Debug.Log("Primary Unequip Finished"); break; case Weapon.WEAPONTYPE.secondary: m_pistolProp.setVisible(true); //Debug.Log("Secondary Unequip Finished"); break; } }
private void getAllWeapons(Weapon[] weapons, WeaponProp[] props) { foreach (Weapon wep in weapons) { wep.setOwnerFaction(m_ownersFaction); wep.setAimed(false); wep.setGunTarget(m_target); wep.gameObject.SetActive(false); wep.addOnWeaponFireEvent(onWeaponFire); Weapon.WEAPONTYPE type = wep.getWeaponType(); switch (type) { case Weapon.WEAPONTYPE.primary: m_rifle = wep; break; case Weapon.WEAPONTYPE.secondary: m_pistol = wep; break; } } foreach (WeaponProp prop in props) { Weapon.WEAPONTYPE type = prop.getPropType(); switch (type) { case Weapon.WEAPONTYPE.primary: m_rifleProp = prop; break; case Weapon.WEAPONTYPE.secondary: m_pistolProp = prop; break; } } }