private IEnumerator Attack(GameObject mob) { _bulletFactory.Create(SpawnPoint, Speed, mob); yield return(new WaitForSeconds(CoolDownTime)); _coolDown = false; }
//--------------------------------------------------------------------------- public void Spawn() { TransformComponent transform = GetComponent <TransformComponent>(); if (transform != null) { BulletFactory.Create(transform.AbsoluteLocation, transform.Orientation, Description); } }
private void FireBullet() { var left = this.Hunter.Position.Left + this.Hunter.Bounds.Width / 2; var top = this.Hunter.Position.Top; Bullet newBullet = bulletFactory.Create(left, top); this.GameObjects.Add(newBullet); this.Bullets.Add(newBullet); }
public virtual void SpawnBullet() { CameraController.Shake(shakeMagnitude, shakeTime, shakeEveryXSec); for (int i = 0; i < numOfBullets; ++i) { Vector2 velocity = new Vector2(UnityEngine.Random.Range(xRandVelocity.min, xRandVelocity.max), UnityEngine.Random.Range(yRandVelocity.min, yRandVelocity.max)); int dir = (int)ownerSpriteObj.transform.localScale.x; BulletFactory.Create(bulletType, pref_bullet, bulletsSpawnObj.transform.position, velocity, dir); } }
void IWeaponController.DoShoot() { if (!CanShoot) { return; } LastShootTime = DateTime.Now; Vector3 direction = _bulletTransformProvider.BulletSpawnDirection; float angle = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg; Quaternion rotation = Quaternion.AngleAxis(angle, Vector3.forward); IBulletController bullet = _bulletFactory.Create(_bulletPrefab, _bulletTransformProvider.BulletSpawnPosition, rotation); bullet.StartShoot(_bulletTransformProvider.BulletSpawnDirection); }