Ejemplo n.º 1
0
        /// <summary>
        /// 获取敌人
        /// </summary>
        /// <returns></returns>
        private Transform SelectTarget()
        {
            //通过扇形选区 获取目标
            var list = new SectorAttackSelector().SelectTarget(attackSkill, transform);

            return(list != null ? list[0] : null);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 工厂方法设计模式:创建目标选择对象的方法 符合 定义
        /// </summary>
        /// <param name="skill"></param>
        /// <returns></returns>
        public static IAttackSelector CreateAttackSelector(SkillData skill)
        {
            IAttackSelector attackSelector = null;

            switch (skill.damageMode)
            {
            case DamageMode.Circle:
                attackSelector = new CircleAttackSelector();
                break;

            case DamageMode.Sector:
                attackSelector = new SectorAttackSelector();
                break;
            }
            return(attackSelector);
        }