private ShootingWeapon CreateShootingWeaponFromText(GameObject owner, List <string> paramsText, List <string> instantEffectsText, List <string> longEffectsText) { ShootingWeapon weapon = (ShootingWeapon)ScriptableObject.CreateInstance("ShootingWeapon"); //Parameters weapon.BulletPrefab = BulletPrefab; weapon.ShootingPoint = owner.transform.FindChild("Graphics").FindChild("Tower").FindChild("ShootingPoint"); weapon.defaultBulletSpeed = float.Parse(paramsText[1]); weapon.ResetBulletSpeed(); weapon.defaultNumberOfBullets = int.Parse(paramsText[2]); weapon.ReloadAllBullets(); //Instant effects List <InstantEffect> instantEffects = CreateInstantEffectsFromText(instantEffectsText); foreach (InstantEffect effect in instantEffects) { weapon.AddInstantEffect(effect); } //Long effects List <LongEffect> longEffects = CreateLongEffectsFromText(longEffectsText); foreach (LongEffect effect in longEffects) { weapon.AddLongEffect(effect); } return(weapon); }
public void SetShootingWeapon(ShootingWeapon weapon) { shootingWeapon = weapon; }