Ejemplo n.º 1
0
    // set laser position, and enable it
    private void Laser( )
    {
        if (targetEnemy != null)
        {
            // call get damage and pass the amount of damage
            targetEnemy.TakeDamage(damageOverTime * Time.deltaTime);
            targetEnemy.Slow(slowPct);
            laserSound.enabled = true;
        }

        // set the position of the laser beam from the Leaser beam to the target
        lineRenderer.SetPosition(0, firePoint.position);
        lineRenderer.SetPosition(1, target.position);

        // get the position of enemy looking back to the turret
        Vector3 dir = firePoint.position - target.position;

        // set the position of the Particle system [ we need to offset it by by half from the center of the enemy ]
        impactEffect.transform.position = target.position + dir.normalized;
        // set the rotation of the Particle system
        impactEffect.transform.rotation = Quaternion.LookRotation(dir);

        // enable the object line renderer
        if (!lineRenderer.enabled)
        {
            lineRenderer.enabled = true;
            impactEffect.Play();
            leaserLight.enabled = true;
        }
    }
Ejemplo n.º 2
0
    void Laser()
    {
        targetenemy.takedamage(DamageOverTime * Time.deltaTime);
        targetenemy.Slow(Slowpct);
        if (!linerenderer.enabled)
        {
            linerenderer.enabled = true;
            impacteffect.Play();
            impact.enabled = true;
        }
        linerenderer.SetPosition(0, firepoint.position);
        linerenderer.SetPosition(1, target.position);
        Vector3 dir = firepoint.position - target.position;

        impacteffect.transform.position = target.position + dir.normalized;
        impacteffect.transform.rotation = Quaternion.LookRotation(dir);
    }
Ejemplo n.º 3
0
    void Laser()
    {
        targetEnemy.TakeDamage(damageOverTime * Time.deltaTime);
        targetEnemy.Slow(slowAmount);

        if (!lineRenderer.enabled)
        {
            lineRenderer.enabled = true;
            impactEffect.Play();
            impactLight.enabled = true;
        }

        lineRenderer.SetPosition(0, firePoint.position);
        lineRenderer.SetPosition(1, target.position);

        Vector3 dir = firePoint.position - target.position;

        impactEffect.transform.rotation = Quaternion.LookRotation(dir);
        impactEffect.transform.position = target.position + 0.25f * dir.normalized;
    }
Ejemplo n.º 4
0
    void Laser()
    {
        if (!AttackPlayer)
        {
            targetEnemy.TakeDamage(damageOverTime * Time.deltaTime);
            targetEnemy.Slow(slowAmount);
            if (Type == 4)
            {
                targetEnemy.AddSpeed(2);
            }
        }
        else
        {
            targetPlayerLife.TakeDamage(damageOverTime * Time.deltaTime);
            targetPlayerSpeed.Slow(slowAmount);
            if (Type == 4)
            {
                targetPlayerSpeed.AddSpeed(2);
            }
        }

        if (!lineRenderer.enabled)
        {
            lineRenderer.enabled = true;
            impactEffect.Play();
            impactLight.enabled = true;
        }
        lineRenderer.SetPosition(0, firePoint.position);
        lineRenderer.SetPosition(1, target.position);

        Vector3 dir = firePoint.position - target.position;

        impactEffect.transform.position = target.position + 12 * dir.normalized;

        impactEffect.transform.rotation = Quaternion.LookRotation(dir);
    }