Esempio n. 1
0
    public override void Shoot(CannonScript cannon)
    {
        cannon.player.PlaySound(shootBulletSound);

        GameObject bullet = (GameObject)Instantiate(Resources.Load("bullet")) as GameObject;

        bullet.transform.position = cannon.transform.position + cannon.transform.right * 2;
        BulletScript bulletScript = bullet.GetComponent <BulletScript>();

        bulletScript.Launch(cannon.transform.right);

        ammo--;
        if (ammo == 0)
        {
            gameObject.transform.parent.gameObject.SetActive(false);
            cannon.currentWeapon = null;
        }
    }