IEnumerator ActiveHolder(vWeaponHolder holder, bool activeWeapon, bool immediat = false) { if (!immediat) { inEquip = true; } timer = holder.equipDelayTime; holder.SetActiveHolder(true); if (!activeWeapon) { holder.SetActiveWeapon(true); } while (timer > 0 && !immediat) { yield return(new WaitForEndOfFrame()); timer -= Time.deltaTime; } holder.SetActiveWeapon(activeWeapon); inEquip = false; }
IEnumerator UnequipRoutine(vWeaponHolder holder, bool activeHolder, bool activeWeapon, bool immediat = false) { holder.SetActiveHolder(activeHolder); if (!inEquip && !immediat) // ignore time if inEquip or immediate unequip { equipTime = holder.equipDelayTime; while (equipTime > 0 && !immediat && !inEquip) { yield return(null); equipTime -= Time.deltaTime; } } holder.SetActiveWeapon(activeWeapon); }
IEnumerator EquipRoutine(vWeaponHolder holder, bool activeHolder, bool activeWeapon, bool immediat = false) { if (!immediat) { inEquip = true; } holder.SetActiveHolder(activeHolder); equipTime = holder.equipDelayTime; while (equipTime > 0 && !immediat) // ignore time if immediate equip { yield return(null); equipTime -= Time.deltaTime; } holder.SetActiveWeapon(activeWeapon); inEquip = false; }