private void ShootBullet() { GameObject newBullet = (GameObject)Instantiate(bulletPrefab, transform.position, transform.rotation); BulletScript script = newBullet.GetComponent <BulletScript>(); script.damage = damage; script.speed = 15.0f; script.SetAsEnemyBullet(); fireCoolDown = fireRate; }
private void AttackTarget() { shootCooldown -= Time.deltaTime; shooter.transform.LookAt(playerLocation); if (shootCooldown <= 0) { GameObject newBullet = (GameObject)Instantiate(bulletPrefab, transform.position, shooter.transform.rotation); BulletScript script = newBullet.GetComponent <BulletScript>(); script.damage = damage; script.speed = 12.0f; script.SetAsEnemyBullet(); script.transform.localScale *= 2; script.lifeTime = 3.0f; shootCooldown = shootRate; } attackCooldown -= Time.deltaTime; if (attackCooldown <= 0) { attackType = AttackType.DORMANT; } }
private void AttackCircle() { shootCooldown -= Time.deltaTime; if (shootCooldown <= 0) { for (int i = 0; i < 32; ++i) { shooter.transform.Rotate(new Vector3(0, 1, 0), (360 / 32)); GameObject newBullet = (GameObject)Instantiate(bulletPrefab, transform.position, shooter.transform.rotation); BulletScript script = newBullet.GetComponent <BulletScript>(); script.damage = damage; script.speed = 12.0f; script.SetAsEnemyBullet(); script.transform.localScale *= 2; script.lifeTime = 3.0f; } shootCooldown = shootRate; } attackCooldown -= Time.deltaTime; if (attackCooldown <= 0) { attackType = AttackType.DORMANT; } }