public void Initialize(Vector3 position, float blastRadius, float damage = 0f) { if (damage > 0f) { TargetPoint.FillBuffer(position, blastRadius); for (int i = 0; i < TargetPoint.BufferedCount; i++) { TargetPoint.GetBuffered(i).Enemy.ApplyDamage(damage); } } transform.localPosition = position; scale = 2f * blastRadius; }
protected bool TrackTarget(ref TargetPoint target) { if (target == null || !target.Enemy.IsValidTarget) { return(false); } Vector3 a = transform.localPosition; Vector3 b = target.Position; float x = a.x - b.x; float z = a.z - b.z; float r = targetingRange + 0.125f * target.Enemy.Scale; if (x * x + z * z > r * r) { target = null; return(false); } return(true); }