public bool Reload() { bool retVal = false; RuntimeWeapon c = weaponManager.GetCurrent(); if (c.curAmmo < c.w_actual.magazineAmmo) { if (c.w_actual.magazineAmmo <= c.curCarryingAmmo) { c.curAmmo = c.w_actual.magazineAmmo; c.curCarryingAmmo -= c.curAmmo; } else { c.curAmmo = c.curCarryingAmmo; c.curCarryingAmmo = 0; } retVal = true; anim.CrossFade("Rifle Reload", 0.2f); states.isAiming = false; states.isInteracting = true; } return(retVal); }
public void RemoveRuntimeWeapon(RuntimeWeapon rw) { if (rw.m_instance) { Destroy(rw.m_instance); } if (runtimeWeapons.Contains(rw)) { runtimeWeapons.Remove(rw); } }
public RuntimeWeapon WeaponToRuntimeWeapon(Weapon w) { RuntimeWeapon rw = new RuntimeWeapon(); rw.w_actual = w; rw.curAmmo = w.magazineAmmo; rw.curCarryingAmmo = w.maxAmmo; runtimeWeapons.Add(rw); return(rw); }
public void EquipWeapon(RuntimeWeapon rw) { Weapon w = rw.w_actual; lh_target = rw.w_hook.leftHandIK; rh_target.localPosition = w.m_h_ik.pos; rh_target.localEulerAngles = w.m_h_ik.rot; basePosition = w.m_h_ik.pos; baseRotation = w.m_h_ik.rot; onIdleDiableOh = rw.w_actual.onIdleDiableOh; }
public void EquipRuntimeWeapon(RuntimeWeapon rw) { if (weaponManager.GetCurrent() != null) { anim.CrossFade("Switch", 0.2f); states.isAiming = false; switchingWeapon = true; states.isInteracting = true; UnEquipWeapon(weaponManager.GetCurrent()); } rw.m_instance.SetActive(true); a_hook.EquipWeapon(rw); anim.SetFloat(StaticStrings.animParamWeaponType, rw.w_actual.WeaponType); weaponManager.SetCurrent(rw); }
public bool ShootWeapon(float t) { bool retVal = false; RuntimeWeapon c = weaponManager.GetCurrent(); if (c.curAmmo > 0) { if (t - c.lastFired > c.w_actual.fireRate) { retVal = true; c.ShootWeapon(); a_hook.RecoilAnim(); } } return(retVal); }
public void CreateRuntimeWeapon(string id, ref RuntimeWeapon r_w_m) { Weapon w = resourcesManager.GetWeapon(id); RuntimeWeapon rw = resourcesManager.runtime.WeaponToRuntimeWeapon(w); GameObject go = Instantiate(w.modelPrefab); rw.m_instance = go; rw.w_actual = w; rw.w_hook = go.GetComponent <WeaponHook>(); go.SetActive(false); Transform p = anim.GetBoneTransform(HumanBodyBones.RightHand); go.transform.SetParent(p); go.transform.localPosition = Vector3.zero; go.transform.localEulerAngles = Vector3.zero; go.transform.localScale = Vector3.one; r_w_m = rw; }
public void UnEquipWeapon(RuntimeWeapon rw) { rw.m_instance.SetActive(false); }
public void SetCurrent(RuntimeWeapon rw) { curWeapon = rw; }