Esempio n. 1
0
    /****** Instantiates the paperplane and updates UI *****/
    private void Fire(float bulletSpeed = default(float))
    {
        if (bulletSpeed < MinBulletSpeed)
        {
            bulletSpeed = MinBulletSpeed;
        }

        if (this.papers > 0 && timeBeforeThrow <= 0)
        {
            GameObject bullet = Instantiate(bulletPrefab, bulletSpawn.position, bulletSpawn.rotation);
            bullet.GetComponent <Bullet> ().speed = bulletSpeed;
            timeBeforeThrow = timeBetweenThrows;
            this.papers--;
            iuic.SetPapersAmmount(papers);
        }
    }