Exemple #1
0
    void Shoot()
    {
        GameObject shooting = (GameObject)Instantiate(basicShot, projectileSpawn.position, projectileSpawn.rotation);
        BasicShot  shot     = shooting.GetComponent <BasicShot>();

        if (shot != null)
        {
            shot.Attack(target);
        }
    }
Exemple #2
0
    void Shoot()
    {
        Debug.Log("Try");
        GameObject shooting = (GameObject)Instantiate(RbasicShot, RProjectileSpawn.position, RProjectileSpawn.rotation);
        BasicShot  shot     = shooting.GetComponent <BasicShot>();

        if (shot != null)
        {
            Debug.Log("shoot");
            shot.Attack(target);
        }
    }
Exemple #3
0
    void Shoot()
    {
        GameObject shooting = (GameObject)Instantiate(BbasicShot, BProjectileSpawn.position, BProjectileSpawn.rotation);
        BasicShot  shot     = shooting.GetComponent <BasicShot>();

        if (shot != null)
        {
            shot.Attack(target);

            if (particle)
            {
                GameObject p = Instantiate(particle, BProjectileSpawn.position, BProjectileSpawn.rotation);
                Destroy(p, 5);
            }


            // play correct sound
            switch (TowerType)
            {
            case 'B':
                FindObjectOfType <AudioManager>().Play("BasicTowerShoot");
                break;

            case 'R':
                FindObjectOfType <AudioManager>().Play("RapidTowerShoot");
                break;

            case 'S':
                FindObjectOfType <AudioManager>().Play("SniperTowerShoot");
                break;

            case 'A':
                FindObjectOfType <AudioManager>().Play("AOETowerShoot");
                break;

            default:
                FindObjectOfType <AudioManager>().Play("BasicTowerShoot");
                break;
            }
            // End of sound switch
        }
    }