Ejemplo n.º 1
0
        /// <summary>
        ///     找到在当前副本阶段行走区域范围内最近的怪物
        /// </summary>
        /// <returns></returns>
        private ActionDisplay FindNearestEnemyInMapRange()
        {
            ActionDisplay         result   = null;
            float                 dis      = 1000000;
            IList <ActionDisplay> tempList = AppMap.Instance.monsterList.Cast <ActionDisplay>().ToList();

            if (MeController.GetMeVo().Id == AppMap.Instance.me.GetVo().Id)
            {
                foreach (PlayerDisplay display in AppMap.Instance.playerList)
                {
                    if (display != AppMap.Instance.me)
                    {
                        tempList.Add(display);
                    }
                }
            }
            else
            {
                tempList.Add(AppMap.Instance.me);
            }
            foreach (ActionDisplay actionDisplay in tempList)
            {
                float    x        = actionDisplay.GoBase.transform.position.x;
                float    y        = actionDisplay.GoBase.transform.position.y;
                MapRange mapRange = AppMap.Instance.mapParser.CurrentMapRange;
                if (x < mapRange.MinX || x > mapRange.MaxX || y < mapRange.MinY || y > mapRange.MaxY)
                {
                    continue;
                }
                if (actionDisplay.GetMeVoByType <BaseRoleVo>().CurHp == 0)
                {
                    continue;
                }
                float curDis = GeteEnemyDistance(actionDisplay);
                if (curDis < dis)
                {
                    result = actionDisplay;
                    dis    = curDis;
                }
            }
            return(result);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     获取敌人信息
        /// </summary>
        /// <returns>敌人列表</returns>
        private IList <ActionDisplay> GetEnemyDisplay()
        {
            IList <ActionDisplay> tempList = AppMap.Instance.monsterList.Cast <ActionDisplay>().ToList();

            if (MeController.GetMeVo().Id == AppMap.Instance.me.GetVo().Id)
            {
                foreach (PlayerDisplay display in AppMap.Instance.playerList)
                {
                    if (display != AppMap.Instance.me)
                    {
                        tempList.Add(display);
                    }
                }
            }
            else
            {
                tempList.Add(AppMap.Instance.me);
            }
            return(tempList);
        }