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); }
void damage(Transform enemy) { MobStats mob = enemy.GetComponent <MobStats>(); if (mob != null) { mob.TakeDamage(bulletDamage * damageAmplifier); } }