public void ChangeLeftFireWeapon() { currentLeftFireWeaponIndex = currentLeftFireWeaponIndex + 1; if (currentLeftFireWeaponIndex == 0 && fireWeaponInLeftHandSlots[0] != null) { fireLeftWeapon = fireWeaponInLeftHandSlots[currentLeftFireWeaponIndex]; weaponSlotManager.LoadFireWeaponOnSlot(fireWeaponInLeftHandSlots[currentLeftFireWeaponIndex], true); } else if (currentLeftFireWeaponIndex == 0 && fireWeaponInLeftHandSlots[0] == null) { currentLeftFireWeaponIndex = currentLeftFireWeaponIndex + 1; } else if (currentLeftFireWeaponIndex == 1 && fireWeaponInLeftHandSlots[1] != null) { fireLeftWeapon = fireWeaponInLeftHandSlots[currentLeftFireWeaponIndex]; weaponSlotManager.LoadFireWeaponOnSlot(fireWeaponInLeftHandSlots[currentLeftFireWeaponIndex], true); } else if (currentLeftFireWeaponIndex == 1 && fireWeaponInLeftHandSlots[1] == null) { currentLeftFireWeaponIndex = currentLeftFireWeaponIndex + 1; } if (currentLeftFireWeaponIndex > fireWeaponInLeftHandSlots.Length - 1) { currentLeftFireWeaponIndex = 0; fireLeftWeapon = fireWeaponInLeftHandSlots[currentLeftFireWeaponIndex]; weaponSlotManager.LoadFireWeaponOnSlot(fireWeaponInLeftHandSlots[currentLeftFireWeaponIndex], true); } isFireWeaponEquiped = true; }
public void ClearFireItem() { fireWeapon = null; icon.sprite = null; icon.enabled = false; gameObject.SetActive(false); }
public void ChangeRightFireWeapon() { currentRightFireWeaponIndex = currentRightFireWeaponIndex + 1; if (currentRightFireWeaponIndex == 0 && fireWeaponInRightHandSlots[0] != null) { fireRightWeapon = fireWeaponInRightHandSlots[currentRightFireWeaponIndex]; weaponSlotManager.LoadFireWeaponOnSlot(fireWeaponInRightHandSlots[0], false); } else if (currentRightFireWeaponIndex == 0 && fireWeaponInRightHandSlots[0] == null) { currentRightFireWeaponIndex = currentRightFireWeaponIndex + 1; } else if (currentRightFireWeaponIndex == 1 && fireWeaponInRightHandSlots[1] != null) { fireRightWeapon = fireWeaponInRightHandSlots[currentRightFireWeaponIndex]; weaponSlotManager.LoadFireWeaponOnSlot(fireWeaponInRightHandSlots[currentRightFireWeaponIndex], false); } else if (currentRightFireWeaponIndex == 1 && fireWeaponInRightHandSlots[1] == null) { currentRightFireWeaponIndex = currentRightFireWeaponIndex + 1; } if (currentRightFireWeaponIndex > fireWeaponInRightHandSlots.Length - 1) { currentRightFireWeaponIndex = 0; fireRightWeapon = fireWeaponInRightHandSlots[currentRightFireWeaponIndex]; weaponSlotManager.LoadFireWeaponOnSlot(fireWeaponInRightHandSlots[currentRightFireWeaponIndex], false); } isFireWeaponEquiped = true; _gunSheet.EnableGunSheet(fireWeaponInRightHandSlots[currentRightFireWeaponIndex]); }
public void LoadFireWeaponOnSlot(FireWeponItem fireWeponItem, bool isLeft) { if (isLeft) // si es para la izquierda { leftHandSlot.LoadFireWeapomodel(fireWeponItem); //llamamos a la funcion de la clase WeaponHolderSlot.cs para cargar LoadLeftWeaponDamageCollider(); //metodo que anyade el collider al left hand quickSlotsUI.UpdateFireWeaponQuickSlotsUI(true, fireWeponItem); #region Handle Left Weapon Idle Animations if (fireWeponItem != null) { animator.CrossFade(fireWeponItem.left_hand_idle, 0.2f); } else { animator.CrossFade("Left Arm emty", 0.2f); } #endregion } else //si esta en la derecha { rightHandSlot.LoadFireWeapomodel(fireWeponItem); //cargar modelo arma LoadRightWeaponDamageCollider(); //metodo que anyade el collider al right hand quickSlotsUI.UpdateFireWeaponQuickSlotsUI(false, fireWeponItem); #region Handle Right Weapon Idle Animations if (animator != null) { animator.CrossFade(fireWeponItem.right_hand_idle, 0.2f); } else { animator.CrossFade("Right Arm emty", 0.2f); } #endregion } }
public void ClearFireWeponItemInventorySlot() //limpiamos el slot del inventario { fireItem = null; icon.sprite = null; icon.enabled = false; gameObject.SetActive(false); }
public void LoadFireWeapomodel(FireWeponItem fireWeponItem) //carga el arma en nustras manos { //unload weapon and destroy UnloadWeaponAndDestroy(); //destruye el arma if (fireWeponItem == null) //si el arma nueva es igual a null { //Unload weapon UnloadWeapon(); //desarmar objeto return; } GameObject model = Instantiate(fireWeponItem.modelPrefab) as GameObject; //instanciar como gameObject if (model != null) { if (parentOverride != null) { model.transform.parent = parentOverride; } else { model.transform.parent = transform; } model.transform.localPosition = Vector3.zero; model.transform.localRotation = Quaternion.identity; model.transform.localScale = Vector3.one; } currentWeaponModel = model; }
//fire weapons methods public void AddFireWeponItem(FireWeponItem newItem) //add item to weapon inventory slot { //sustituimos los icons del arma nueva fireItem = newItem; icon.sprite = fireItem.itemIcon; icon.enabled = true; gameObject.SetActive(true); }
public void EnableGunSheet(FireWeponItem fireWeponItem) { UIcomponent.SetActive(true); if (fireWeponItem.itemIcon != null) { weaponIcon.sprite = fireWeponItem.itemIcon; } else { weaponIcon.sprite = null; weaponIcon.enabled = true; } }
//fire weapon item methods public void AddFireItem(FireWeponItem newWeapon) { fireWeapon = newWeapon; try { icon.sprite = fireWeapon.itemIcon; } catch (Exception ex) { Console.WriteLine(ex); } icon.enabled = true; gameObject.SetActive(true); }
public void UpdateFireWeaponQuickSlotsUI(bool isLeft, FireWeponItem fireWeponItem) { if (!isLeft) { if (fireWeponItem.itemIcon != null) { leftWeaponIcon.sprite = fireWeponItem.itemIcon; leftWeaponIcon.enabled = true; } else { leftWeaponIcon.sprite = null; leftWeaponIcon.enabled = true; } } }