Example #1
0
    void Update()
    {
        if (touchPad.CanFire() && Time.time > nextFire)
        {
            nextFire = Time.time + fireRate;
            //GameObject clone =
            Instantiate(shot, shotSpawn1.transform.position, shotSpawn1.transform.rotation);// as GameObject; /*  */
            if (doubleShotEnabled())
            {
                Instantiate(shot, shotSpawn2.transform.position, shotSpawn2.transform.rotation);// as GameObject; /*  */
            }
            if (tripleShotEnabled())
            {
                Instantiate(shot, shotSpawn2.transform.position, shotSpawn2.transform.rotation); // as GameObject; /*  */
                Instantiate(shot, shotSpawn3.transform.position, shotSpawn3.transform.rotation); // as GameObject; /*  */
            }

            GetComponent <AudioSource>().Play();
        }

        /* se il doppio sparo è abilitato allora decrementa il tempo di disponibiltà del bonus */
        if (doubleShotEnabled() || tripleShotEnabled())
        {
            bonusTime -= Time.deltaTime;
            if (bonusTime <= 0)
            {
                disableDoubleShot();
            }
        }
    }