Exemple #1
0
        /// <summary>
        /// 实际选择目标
        /// </summary>
        public override bool SelectTarget(RoleActor caster, SkillActive skill, ref List <RoleActor> targets)
        {
            if (!base.SelectTarget(caster, skill, ref targets))
            {
                return(false);
            }

            List <RoleActor> roleList   = new List <RoleActor>();
            UInt32           actorTypes = (1 << (Int32)eActorGameType.Player) | (1 << (Int32)eActorGameType.Npc) | (1 << (Int32)eActorGameType.PlayerImage);
            var pos = caster.GetPosition();

            if (!caster.HostMap.TourRoles(ref pos, skill.RangeMax, actorTypes, roleList))
            {
                return(false);
            }

            foreach (var tar in roleList)
            {
                Vector3 dir      = Util.DirToVector(caster.GetDirection());
                Vector3 toTarDir = tar.GetPosition() - caster.GetPosition();
                float   angle    = Util.Angle(dir, toTarDir);
                if (Math.Abs(angle) <= 90 &&
                    Math.Abs(tar.GetPosition().X - caster.GetPosition().X) <= skill.SkillData.selparam1 / 2 &&
                    Math.Abs(tar.GetPosition().Z - caster.GetPosition().Z) <= skill.SkillData.selparam2)
                {
                    targets.Add(tar);
                }
            }

            return(true);
        }