private void OnEnable() { parent = GameObject.Find("player"); gs = parent.GetComponent <guns>(); gun = gs.equipped; startPosition = transform.position; set(gun.Speed, parent, gun.Range, gun.Damage, gun.Knockback); }
// Use this for initialization void Start() { // pro = GetComponent<projectile>(); gunner = GetComponent <guns>(); try { if (gunner.proFireRate > 5f) { throw new ArgumentNullException("Fire Rate error"); } // if(!pro) // throw new ArgumentNullException("no projectile detected"); } catch (ArgumentNullException e) { Debug.Log(e.Message); } /*finally * { * // if nothing was called * Debug.Log("Stuff Broke"); * }*/ try { if (gunner.projectileSpeed > 61f) { throw new ArgumentNullException("Projectile Speed Error"); } } catch (ArgumentNullException e) { Debug.Log(e.Message); } /*finally * { * // if nothing was called * Debug.Log("Stuff Broke"); * }*/ }