示例#1
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);
    }