public static void MultiShot(GameObject bullet, Transform transform, float bulletSpeed, float bulletDamage) { Quaternion temp = transform.rotation; GameObject bulletGO = GameObject.Instantiate(bullet, new Vector3(transform.position.x, 1.5f, transform.position.z), transform.rotation); BulletTest bulletComponent = bulletGO.GetComponent <BulletTest>(); bulletComponent.speed = bulletSpeed; bulletComponent.damage = bulletDamage; temp.eulerAngles += new Vector3(0, 30, 0); bulletGO = GameObject.Instantiate(bullet, new Vector3(transform.position.x, 1.5f, transform.position.z), temp); bulletComponent = bulletGO.GetComponent <BulletTest>(); bulletComponent.speed = bulletSpeed; bulletComponent.damage = bulletDamage; temp.eulerAngles += new Vector3(0, -60, 0); bulletGO = GameObject.Instantiate(bullet, new Vector3(transform.position.x, 1.5f, transform.position.z), temp); bulletComponent = bulletGO.GetComponent <BulletTest>(); bulletComponent.speed = bulletSpeed; bulletComponent.damage = bulletDamage; }
public void Update(GameTime gameTime) { if (!CanShoot) { ShootTimer += gameTime.ElapsedGameTime.Milliseconds; if (ShootTimer >= ShootDelay) { CanShoot = true; ShootTimer -= ShootDelay; } } BulletTest.Clear(); for (Byte index = 0; index < maxBulletShoot; index++) { Bullet bullet = BulletList[index]; if (bullet.IsFiring) { bullet.Update(gameTime); if (!bullet.IsFiring) { BulletTest.Add(bullet); } } } }
public static void Shoot(GameObject bullet, Transform transform, float bulletSpeed, float bulletDamage) { GameObject bulletGO = GameObject.Instantiate(bullet, new Vector3(transform.position.x, 1.5f, transform.position.z), transform.rotation); BulletTest bulletComponent = bulletGO.GetComponent <BulletTest>(); bulletComponent.speed = bulletSpeed; bulletComponent.damage = bulletDamage; }
private IEnumerator launch() { while (true) { BulletTest bullet = Instantiate(parameters.bulletPrefab, muzzle.position, muzzle.rotation, null).GetComponent <BulletTest>(); bullet.speed = parameters.bulletPower; bullet.weapon = this; yield return(new WaitForSeconds(parameters.fireInterval / GameSystem.BulletTimeSystem.TimeScale)); } }
public void Reset(Byte theBulletShoot, UInt16 frameDelay, UInt16 shootDelay) { maxBulletShoot = theBulletShoot; if (maxBulletShoot > allBulletShoot) { maxBulletShoot = allBulletShoot; } for (Byte index = 0; index < maxBulletShoot; index++) { Bullet bullet = BulletList[index]; bullet.Reset(frameDelay); } BulletTest.Clear(); ShootDelay = shootDelay; ShootTimer = 0; CanShoot = true; }