Пример #1
0
 public void Initialize(Vector3 position, float blastRadius, float damage = 0)
 {
     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)
            {
                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);
        }