private void Start() { _rb = GetComponent<Rigidbody2D>(); _mainParticle = Particle[0]; _shootingScript = _mainParticle.GetComponent<ShootingScript>(); _shootingScript.Init(); }
private void Start() { rb = GetComponent<Rigidbody2D>(); shootingScripts = new ShootingScript[Particle.Length]; for (var i = 0; i < Particle.Length; i++) { shootingScripts[i] = Particle[i].GetComponent<ShootingScript>(); shootingScripts[i].Init(); } shootingScript = shootingScripts[weaponNumber]; }
private void Start() { rb = GetComponent <Rigidbody2D>(); shootingScripts = new ShootingScript[Particle.Length]; for (var i = 0; i < Particle.Length; i++) { shootingScripts[i] = Particle[i].GetComponent <ShootingScript>(); shootingScripts[i].Init(); } shootingScript = shootingScripts[weaponNumber]; }
private void ChangeWeapon(int weaponNumber) { _shootingScript.Stop(); _mainParticle = Particle[weaponNumber]; _shootingScript = _mainParticle.GetComponent<ShootingScript>(); _shootingScript.Init(); if (Input.GetButton("Fire1")) { _shootingScript.Play(); } }
private void ChangeWeapon(int weaponNr) { if (weaponNr == weaponNumber) { return; } shootingScript.Stop(); weaponNumber = weaponNr; shootingScript = shootingScripts[weaponNr]; if (Input.GetButton("Fire1")) { shootingScript.Play(); } }