Ejemplo n.º 1
0
    public void RangeBulletEliminate(Vector3 centerPos, float range, bool getPoint)
    {
        float rangeSq = range * range;
        List <BattleObject> bulletList = GetObjectList(BattleObjectType.EnemyBullet);

        if (bulletList == null)
        {
            return;
        }
        for (int i = bulletList.Count - 1; i >= 0; --i)
        {
            BattleObject bulletObj = bulletList[i];
            Vector3      disVec    = bulletObj.transform.position - centerPos;
            if (disVec.sqrMagnitude < rangeSq)
            {
                EnemyBullet bullet = bulletObj as EnemyBullet;
                if (bullet != null)
                {
                    bullet.Eliminate();
                    if (getPoint)
                    {
                        GameObject pointItem = BattleStageManager.Instance.SpawnObject("Item/PointItem");
                        pointItem.transform.position = bullet.transform.position;
                    }
                }
            }
        }
    }