// Primary Attack for range weapons override public void FirstAttack(bool isAttacking) { // If player is attacking if (isAttacking) { anim.SetBool("Shoot", isAttacking); audioManager.Play(shoot1); // Instantiate the bullet GameObject bullet = (GameObject)Instantiate(bulletPrefabFirst, firePoint.position, Quaternion.identity); // Set the damage of the bullet bullet.GetComponent <BulletDamage>().SetTagNotToHit(gameObject.tag); bullet.GetComponent <BulletDamage>().SetDamage(damageFirst); // Aply force if (playerController.getFacingRight()) { bullet.GetComponent <Rigidbody2D>().AddForce(Vector3.right * bulletSpeed); } else { bullet.GetComponent <Rigidbody2D>().AddForce(Vector3.left * bulletSpeed); } anim.SetBool("Shoot", false); } }
public void LaunchSecond() { // Instantiate the bullet GameObject bullet = (GameObject)Instantiate(bulletPrefabSecond, firePoint.position, Quaternion.identity); audioManager.Play(throwSound); // Set the damage of the bullet bullet.GetComponent <BulletDamage>().SetTagNotToHit(gameObject.tag); bullet.GetComponent <BulletDamage>().SetDamage(damageSecond); // Aply force if (playerController.getFacingRight()) { bullet.GetComponent <Rigidbody2D>().AddForce(Vector3.right * bulletSpeed); } else { bullet.GetComponent <Rigidbody2D>().AddForce(Vector3.left * bulletSpeed); } }