public void ShootOnce()
    {
        GameObject   newMagicMissile = Instantiate(magicMissile, spawnPoint.transform.position, spawnPoint.transform.rotation);
        MagicMissile mm = newMagicMissile.GetComponent <MagicMissile>();

        mm.HitPlayer();
        mm.TargetPlayer();
    }
Esempio n. 2
0
    IEnumerator FireWeapon()
    {
        yield return(new WaitForSeconds(attackDuration));

        if (attackSound != null)
        {
            attackSound.Play();
        }
        if (particles.Length > 0)
        {
            foreach (ParticleSystem p in particles)
            {
                p.Play();
            }
        }
        foreach (Transform anchor in anchors)
        {
            GameObject newPrefab = Instantiate(prefab, anchor.position, anchor.rotation);
            if (parentPrefab)
            {
                newPrefab.transform.parent = gameObject.transform;
            }

            MagicMissile m = newPrefab.GetComponent <MagicMissile>();
            if (m != null)
            {
                m.HitPlayer();
                m.TargetPlayer();
            }

            Fireball f = newPrefab.GetComponent <Fireball>();
            if (f != null)
            {
                f.HitPlayer();
                f.TargetPlayer();
            }

            yield return(new WaitForSeconds(fireDelay));
        }
    }
Esempio n. 3
0
    void ShootMissile()
    {
        if (!interrupted)
        {
            GameObject newMissile = Instantiate(missile, transform.position, transform.rotation);

            MagicMissile m = newMissile.GetComponent <MagicMissile>();
            if (m != null)
            {
                m.HitPlayer();
                m.TargetPlayer();
            }

            Fireball f = newMissile.GetComponent <Fireball>();
            if (f != null)
            {
                print("Targetting player");
                f.HitPlayer();
                f.TargetPlayer();
            }
        }
        interrupted = false;
    }