Пример #1
0
    void Laser()
    {
        //if (!laser.enabled)
        //    laser.enabled = true;
        if (laserClone == null)
        {
            laserClone        = Instantiate(laser, transform.position, Quaternion.identity);
            LaserImpactEffect = laserClone.GetComponentInChildren <ParticleSystem>();
        }

        if (!laserClone.enabled)
        {
            laserClone.enabled = true;
            LaserImpactEffect.Play();
        }
        enemy.TakeDamage(damageOverTime * Time.deltaTime);
        enemy.Slow(slowPercentage);
        Vector3 dir = shootPoint.position - target.position;

        LaserImpactEffect.transform.rotation = Quaternion.LookRotation(dir);
        var shape = LaserImpactEffect.shape;

        shape.rotation = dir;
        LaserImpactEffect.transform.position = target.position + dir.normalized * target.transform.localScale.magnitude / 2;


        laserClone.SetPosition(0, shootPoint.position);
        laserClone.SetPosition(1, target.position);
    }
Пример #2
0
    void damage(Transform enemy)
    {
        MobStats mob = enemy.GetComponent <MobStats>();

        if (mob != null)
        {
            mob.TakeDamage(bulletDamage * damageAmplifier);
        }
    }