void LoadWeapomIds() { WeaponScriptableObject obj = Resources.Load("Retake.WeaponScriptableObject") as WeaponScriptableObject; if (obj == null) { Debug.Log("Retake.WeaponScriptableObject could not be loaded!"); return; } for (int i = 0; i < obj.weapons_all.Count; i++) { if (Weapon_ids.ContainsKey(obj.weapons_all[i].itemName)) { Debug.Log(obj.weapons_all[i].itemName + "item is a dupilcate"); } else { Weapon_ids.Add(obj.weapons_all[i].itemName, i); } } for (int i = 0; i < obj.weaponStats.Count; i++) { if (Weaponstats_ids.ContainsKey(obj.weaponStats[i].weaponId)) { Debug.Log(obj.weaponStats[i].weaponId + "is a dupliacte"); } else { Weaponstats_ids.Add(obj.weaponStats[i].weaponId, i); } } }
public WeaponStats GetWeaponStats(string id) { WeaponScriptableObject obj = Resources.Load("Retake.WeaponScriptableObject") as WeaponScriptableObject; if (obj == null) { Debug.Log("Retake.WeaponScriptableObject could not be loaded!"); return(null); } int index = GetWeaponStatsIdFromString(id); if (index == -1) { return(null); } return(obj.weaponStats[index]); }
void SaveConsumable() { if (targetModel == null) { return; } if (string.IsNullOrEmpty(iteamName)) { return; } WeaponScriptableObject obj = Resources.Load("Retake.WeaponScriptableObject") as WeaponScriptableObject; if (obj == null) { return; } for (int i = 0; i < obj.weapons_all.Count; i++) { if (obj.weapons_all[i].itemName == iteamName) { Weapon w = obj.weapons_all[i]; if (leftHand) { w.l_model_eulers = targetModel.transform.localEulerAngles; w.l_model_pos = targetModel.transform.localPosition; } else { w.r_model_eulers = targetModel.transform.localEulerAngles; w.r_model_pos = targetModel.transform.localPosition; } w.model_scale = targetModel.transform.localScale; return; } } Debug.Log(iteamName + "was not found in the inventory"); }