private void addRangedWeapon(string weaponName, Dictionary <string, float> weaponDict) { GameObject weaponObj = new GameObject(); weaponObj.name = "Weapon"; weaponObj.transform.parent = this.gameObject.transform; RangedWeapon newWeapon = weaponObj.AddComponent <RangedWeapon> (); newWeapon.loadAttributes(weaponDict); newWeapon.setWeaponName(weaponName); weapons.Add(newWeapon); if (currentWeapon == null) { currentWeapon = newWeapon; } }