public void TryAttack(bool cursed, Vector3 boatSpeed) { if (this.timer > this.cooldown) { for (int i = 0; i < this.offsets.Length; i++) { GameObject go = Instantiate( this.cannonball, this.GetStartPos(i), Quaternion.identity ); Rigidbody rb = go.GetComponent <Rigidbody>(); rb.velocity = this.BallVelocity + boatSpeed; if (cursed) { Cannonball c = go.GetComponent <Cannonball>(); c.AddCurse(); } this.source.Play(); } this.timer = 0.0f; } }