Ejemplo n.º 1
0
    public void Shoot(AIController controller)
    {
        fire = true;
        GameObject bullet = Instantiate(projectile);

        bullet.transform.position = firePoint.transform.position;
        bullet.transform.rotation = firePoint.transform.rotation;

        Projectile_3 projectile_3 = bullet.GetComponent <Projectile_3>();

        projectile_3.controller = controller;
        projectile_3.SetStats(stats.speed, stats.damage, stats.force, stats.lifetime, stats.defaultImpactEffect);

        PlayMuzzleEffects();
        source.PlayOneShot(gunShot.sound, gunShot.volumeMax);
    }
Ejemplo n.º 2
0
    void SpawnProjectile()
    {
        GameObject bullet = GetChamberedRound();

        if (bullet != null)
        {
            Bullet_Controller bullet_Controller = bullet.GetComponent <Bullet_Controller>();
            bullet_Controller.hasFired = true;
            bullet_Controller.ToggleBulletVisibility(false);

            GameObject projectile = Instantiate(bullet_Controller.BulletProjectile) as GameObject;
            projectile.transform.position = firePoint.position;
            projectile.transform.rotation = firePoint.rotation;

            Projectile_3 projectile_3 = projectile.GetComponent <Projectile_3>();
            projectile_3.speed               = bullet_Controller.stats.speed;
            projectile_3.damage              = bullet_Controller.stats.damage;
            projectile_3.force               = bullet_Controller.stats.force;
            projectile_3.lifetime            = bullet_Controller.stats.lifetime;
            projectile_3.defaultImpactEffect = bullet_Controller.stats.defaultImpactEffect;

            PlayFireEffects();
        }
    }