/// <summary> /// 查询指定范围内活着的敌人 /// </summary> /// <param name="_category">种类</param> /// <returns></returns> public List <MonsterActor> QueryEnemyActor(EnemyCategory _category) { List <MonsterActor> retList = new List <MonsterActor>(); List <int> enemyInstIdList = hActorModule.EnemyInstIdList; MonsterActor enemy = null; for (int i = 0; i < enemyInstIdList.Count; i++) { enemy = hActorModule.EnemyDict[enemyInstIdList[i]]; if (enemy.Category == _category) { retList.Add(enemy); } } return(retList); }
/// <summary> /// 查询某个等级区间的怪物 /// </summary> /// <param name="_minLevel"></param> /// <param name="_maxLevel"></param> /// <returns></returns> public List <MonsterActor> QueryEnemyActor(int _minLevel, int _maxLevel) { List <MonsterActor> retList = new List <MonsterActor>(); List <int> enemyInstIdList = hActorModule.EnemyInstIdList; MonsterActor enemy = null; for (int i = 0; i < enemyInstIdList.Count; i++) { enemy = hActorModule.EnemyDict[enemyInstIdList[i]]; if (enemy.Level >= _minLevel && enemy.Level <= _maxLevel) { retList.Add(enemy); } } return(retList); }
/// <summary> /// 查询指定范围内活着的敌人 /// </summary> /// <param name="_center"></param> /// <param name="_radius"></param> /// <returns></returns> public List <MonsterActor> QueryEnemyActor(Vector2 _center, float _radius) { List <MonsterActor> retList = new List <MonsterActor>(); List <int> enemyInstIdList = hActorModule.EnemyInstIdList; MonsterActor enemy = null; float distance = 0f; Vector3 v3; for (int i = 0; i < enemyInstIdList.Count; i++) { enemy = hActorModule.EnemyDict[enemyInstIdList[i]]; v3 = enemy.aTransform.transform.position; distance = Vector2.Distance(_center, new Vector2(v3.x, v3.z)); if (distance < _radius) { retList.Add(enemy); } } return(retList); }