void SimpleFire() { UseEnergy(simpleCost); GameObject bullet = factory.Spawn(FactoryManager.ProductType.playerBullet); PlayerBullet playerBullet = bullet.GetComponent <PlayerBullet>(); Vector2 bulletPosition = new Vector2(transform.position.x, transform.position.y); playerBullet.SetBulletType(bulletType); playerBullet.Init(damage, speed, Vector2.right, bulletPosition); }
void SpiralFire() { UseEnergy(spiralCost); for (int i = 0; i < 4; i++) { GameObject bullet = factory.Spawn(FactoryManager.ProductType.playerBullet); PlayerBullet playerBullet = bullet.GetComponent <PlayerBullet>(); Vector2 bulletPosition = new Vector2(transform.position.x, transform.position.y); playerBullet.SetBulletType(bulletType); playerBullet.Init(damage, speed, Rotate(Vector2.right, i * Mathf.PI / 2), bulletPosition); } }