private IEnumerator Attack() { while (true) { Vector3 position; int direction; for (int i = 0; i < 3; i++) { position = Player.transform.position; direction = Random.Range(0, 2) * 2 - 1; for (int j = 0; j < 16; j++) { fireDataBullet.Towards(position); fireDataBullet.WithRotation((12f * Mathf.Sqrt((16 - j) * 24) - 80) * direction); fireDataBullet.Fire(); yield return(new WaitForSeconds(0.08f)); } yield return(new WaitForSeconds(0.5f)); } for (int i = 0; i < (enraged ? 5 : 3); i++) { still = true; FacePlayer = false; TargetRotation = transform.rotation; fireDataLaser.Fire(); yield return(new WaitForSeconds(0.25f)); still = false; FacePlayer = true; yield return(new WaitForSeconds((enraged ? 0.25f : 0.5f))); } } }
public override void Start() { direction = transform.position.x < 0 ? 1 : -1; transform.Rotate(Vector3.forward * -90 * direction); fireData = new FireBuilder(bulletPrefab, Field); fireData.From(transform); fireData.Towards(new Vector2(0, transform.position.y)); fireData.WithSpeed(3); fireData.WithRotation(-30, 30); rigidbody2d = GetComponent <Rigidbody2D>(); rigidbody2d.velocity = new Vector2(direction * 4, 0); }
public override void Start() { fireDataBullet = new FireBuilder(bulletPrefab, Field); fireDataBullet.From(transform); fireDataBullet.WithSpeed(12); fireDataBullet.WithModifier(new CircularBurstModifier(45, 7, 0, 0)); fireDataBullet.WithController(new AccelerationController(3)); fireDataLaser = new FireBuilder(laserPrefab, Field); fireDataLaser.From(transform); fireDataLaser.WithSpeed(0); fireDataLaser.WithRotation(transform); fireDataLaser.WithController(new AutoDeactivateController(0.25f)); StartCoroutine(Attack()); }