Пример #1
0
        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;
        }
Пример #2
0
        protected bool AcquireTarget(out TargetPoint target)
        {
            // For future reference:
            //int hits = Physics.OverlapSphereNonAlloc(transform.localPosition, targetingRange, targetsBuffer, enemyLayerMask);

            //if (hits > 0)
            //{
            //    target = targetsBuffer[UnityEngine.Random.Range(0, hits)].GetComponent<TargetPoint>();
            //    Debug.Assert(target != null, "Targeted non-enemy!", targetsBuffer[0]);
            //    return true;
            //}

            if (TargetPoint.FillBuffer(transform.localPosition, targetingRange))
            {
                target = TargetPoint.RandomBuffered;
                return(true);
            }

            target = null;
            return(false);
        }