void Piercing() { point = this.transform.Find("GrenadeSpawn"); bulletControler piercing = Instantiate(piercing_shot, point.position, point.rotation) as bulletControler; piercing.speed = 15; }
void Grenade() { point = this.transform.Find("GrenadeSpawn"); bulletControler my_grenade = Instantiate(grenade, point.position, point.rotation) as bulletControler; grenade.speed = 15; }
void OnCollisionEnter2D(Collision2D enemy) { if (enemy != null) { point = this.transform; float bulletSpeed = 10f; //shoot.Play(); bulletControler newBullet1 = Instantiate(bullet, point.position, Quaternion.Euler(point.rotation.x, point.rotation.y, point.eulerAngles.z - 150)) as bulletControler; bulletControler newBullet2 = Instantiate(bullet, point.position, Quaternion.Euler(point.rotation.x, point.rotation.y, point.eulerAngles.z - 120)) as bulletControler; bulletControler newBullet3 = Instantiate(bullet, point.position, Quaternion.Euler(point.rotation.x, point.rotation.y, point.eulerAngles.z - 90)) as bulletControler; bulletControler newBullet4 = Instantiate(bullet, point.position, Quaternion.Euler(point.rotation.x, point.rotation.y, point.eulerAngles.z - 60)) as bulletControler; bulletControler newBullet5 = Instantiate(bullet, point.position, Quaternion.Euler(point.rotation.x, point.rotation.y, point.eulerAngles.z - 30)) as bulletControler; bulletControler newBullet6 = Instantiate(bullet, point.position, point.rotation) as bulletControler; bulletControler newBullet7 = Instantiate(bullet, point.position, Quaternion.Euler(point.rotation.x, point.rotation.y, point.eulerAngles.z + 30)) as bulletControler; bulletControler newBullet8 = Instantiate(bullet, point.position, Quaternion.Euler(point.rotation.x, point.rotation.y, point.eulerAngles.z + 60)) as bulletControler; bulletControler newBullet9 = Instantiate(bullet, point.position, Quaternion.Euler(point.rotation.x, point.rotation.y, point.eulerAngles.z + 90)) as bulletControler; bulletControler newBullet10 = Instantiate(bullet, point.position, Quaternion.Euler(point.rotation.x, point.rotation.y, point.eulerAngles.z + 120)) as bulletControler; bulletControler newBullet11 = Instantiate(bullet, point.position, Quaternion.Euler(point.rotation.x, point.rotation.y, point.eulerAngles.z + 150)) as bulletControler; bulletControler newBullet12 = Instantiate(bullet, point.position, Quaternion.Euler(point.rotation.x, point.rotation.y, point.eulerAngles.z + 180)) as bulletControler; newBullet1.speed = bulletSpeed; newBullet2.speed = bulletSpeed; newBullet3.speed = bulletSpeed; newBullet4.speed = bulletSpeed; newBullet5.speed = bulletSpeed; newBullet6.speed = bulletSpeed; newBullet7.speed = bulletSpeed; newBullet8.speed = bulletSpeed; newBullet9.speed = bulletSpeed; newBullet10.speed = bulletSpeed; newBullet11.speed = bulletSpeed; newBullet12.speed = bulletSpeed; Destroy(this.gameObject); } }
void FixedUpdate() { string playerIndex = gameObject.GetComponentInParent <TankMovement>().playerIndex; isFiring = Input.GetButton("P" + playerIndex + " R1"); if (isFiring && shotCounter == 0.0f) { shotCounter = cooldown; bulletControler newBullet = Instantiate(bullet, firePoint.position, firePoint.rotation) as bulletControler; Instantiate(impactParticle, firePoint.position, firePoint.rotation); shoot.Play(); newBullet.speed = bulletSpeed; } }
void Shotgun() { point = this.transform.Find("BulletSpawn"); float bulletSpeed = 10f; //shoot.Play(); bulletControler newBullet1 = Instantiate(bullet, point.position, Quaternion.Euler(point.rotation.x, point.rotation.y, point.eulerAngles.z - 30)) as bulletControler; bulletControler newBullet2 = Instantiate(bullet, point.position, Quaternion.Euler(point.rotation.x, point.rotation.y, point.eulerAngles.z - 15)) as bulletControler; bulletControler newBullet3 = Instantiate(bullet, point.position, point.rotation) as bulletControler; bulletControler newBullet4 = Instantiate(bullet, point.position, Quaternion.Euler(point.rotation.x, point.rotation.y, point.eulerAngles.z + 15)) as bulletControler; bulletControler newBullet5 = Instantiate(bullet, point.position, Quaternion.Euler(point.rotation.x, point.rotation.y, point.eulerAngles.z + 30)) as bulletControler; newBullet1.speed = bulletSpeed; newBullet2.speed = bulletSpeed; newBullet3.speed = bulletSpeed; newBullet4.speed = bulletSpeed; newBullet5.speed = bulletSpeed; }
// Update is called once per frame void Update() { this.transform.LookAt(target); if (shotCounter > 0) { shotCounter -= Time.deltaTime; if (shotCounter < 0) { shotCounter = 0; } } if (shotCounter == 0.0f) { shotCounter = cooldown; bulletControler newBullet = Instantiate(bullet, firePoint.position, firePoint.rotation) as bulletControler; Instantiate(impactParticle, firePoint.position, firePoint.rotation); shoot.Play(); newBullet.speed = bulletSpeed; } }