List <CreatPostionInfo> GetCreatePostionInfos(SkillDataGenerate skillData, EntityBase skiller, int Length)
    {
        MoveComponent   mc = skiller.GetComp <MoveComponent>();
        PlayerComponent pc = skiller.GetComp <PlayerComponent>();

        List <CreatPostionInfo> result = new List <CreatPostionInfo>();

        result.Clear();

        if (Length == 0)
        {
            return(result);
        }

        HardPointEnum l_FXCreatPoint = skillData.m_FlyCreatPoint;

        Vector3 forward = pc.faceDir.ToVector();
        Vector3 dir     = forward;
        Vector3 pos     = Vector3.zero;

        //获取散射区域
        Area skillArea = UpdatSkillArea(areaCache, skillData, skiller, null);

        //TODO 寻敌方法
        //CharacterBase enemy = GetRecentlyEnemy(skillArea, skiller.m_camp, false);
        //CharacterBase enemy = null;
        MoveComponent emc = null;

        if (l_FXCreatPoint != HardPointEnum.enemy)
        {
            pos = mc.pos.ToVector();
        }
        else
        {
            if (emc == null)
            {
                return(result);
            }
            else
            {
                pos = emc.pos.ToVector();
            }
        }

        Vector3 leftBorder    = Vector3.zero;
        Vector3 leftDir       = Vector3.zero;
        Vector3 leftPos       = Vector3.zero;
        float   sectorStep    = 0;
        float   rectangleStep = 0;

        AreaDataGenerate area = DataGenerateManager <AreaDataGenerate> .GetData(skillData.m_FlyObjectArea);

        switch (area.m_SkewDirection)
        {
        case DirectionEnum.Forward: break;

        case DirectionEnum.Backward: forward *= -1; break;

        case DirectionEnum.Close: forward = (emc.pos.ToVector() - mc.pos.ToVector()).normalized; break;

        case DirectionEnum.Leave: forward = (mc.pos.ToVector() - emc.pos.ToVector()).normalized; break;
        }

        switch (area.m_Shape)
        {
        case AreaType.Circle:
            leftBorder = forward.Vector3RotateInXZ(360 * 0.5f);
            sectorStep = 360 / (Length + 1);
            break;

        case AreaType.Sector:
            leftBorder = forward.Vector3RotateInXZ(area.m_Angle * 0.5f);
            sectorStep = area.m_Angle / (Length + 1);
            break;

        case AreaType.Rectangle:
            leftDir       = forward.Vector3RotateInXZ(90);
            leftPos       = pos + leftDir * area.m_Width * 0.5f;
            rectangleStep = area.m_Width / (Length + 1);
            break;
        }

        for (int i = 0; i < Length; i++)
        {
            switch (area.m_Shape)
            {
            case AreaType.Circle:
            case AreaType.Sector:
                dir = leftBorder.Vector3RotateInXZ2((i + 1) * sectorStep);
                pos = pos + forward * area.m_SkewDistance;
                break;

            case AreaType.Rectangle:
                pos = leftPos - leftDir * rectangleStep * (i + 1);
                break;
            }


            CreatPostionInfo cpi = new CreatPostionInfo();
            cpi.m_pos = pos;
            cpi.m_dir = dir;

            result.Add(cpi);
        }

        return(result);
    }
예제 #2
0
    List <CreatPostionInfo> GetCreatePostionInfos(SkillDataGenerate skillData, EntityBase skiller, int Length)
    {
        MoveComponent        mc  = skiller.GetComp <MoveComponent>();
        SkillStatusComponent ssc = skiller.GetComp <SkillStatusComponent>();

        List <CreatPostionInfo> result = new List <CreatPostionInfo>();

        //result.Clear();

        if (Length == 0)
        {
            return(result);
        }

        HardPointEnum l_FXCreatPoint = skillData.m_FlyCreatPoint;

        SyncVector3 forward = new SyncVector3().FromVector(ssc.skillDir.ToVector().normalized);
        SyncVector3 dir     = forward;
        SyncVector3 pos     = mc.pos;

        SyncVector3 leftBorder    = new SyncVector3();
        SyncVector3 leftDir       = new SyncVector3();
        SyncVector3 leftPos       = new SyncVector3();
        float       sectorStep    = 0;
        float       rectangleStep = 0;

        AreaDataGenerate area = DataGenerateManager <AreaDataGenerate> .GetData(skillData.m_FlyObjectArea);

        switch (area.m_SkewDirection)
        {
        case DirectionEnum.Forward: break;

        case DirectionEnum.Backward: forward *= -1; break;
            //case DirectionEnum.Close: forward = (emc.pos - mc.pos); break;
            //case DirectionEnum.Leave: forward = (mc.pos - emc.pos); break;
        }

        switch (area.m_Shape)
        {
        case AreaType.Circle:
            leftBorder = forward.RotateInXZ(360 * 0.5f);
            sectorStep = 360 / (Length + 1);
            break;

        case AreaType.Sector:
            leftBorder = forward.RotateInXZ(area.m_Angle * 0.5f);
            sectorStep = area.m_Angle / (Length + 1);
            pos        = pos + forward * area.m_SkewDistance;
            break;

        case AreaType.Rectangle:
            leftDir       = forward.RotateInXZ(90);
            leftPos       = pos + leftDir * area.m_Width * 0.5f;
            rectangleStep = area.m_Width / (Length + 1);

            break;
        }
        for (int i = 0; i < Length; i++)
        {
            switch (area.m_Shape)
            {
            case AreaType.Circle:
            case AreaType.Sector:
                dir = leftBorder.RotateInXZ2((i + 1) * sectorStep);

                break;

            case AreaType.Rectangle:
                pos = leftPos - leftDir * rectangleStep * (i + 1);
                break;
            }
            CreatPostionInfo cpi = new CreatPostionInfo();
            pos.y = 0;
            dir.y = 0;

            cpi.m_pos = pos;
            cpi.m_dir = dir;
            result.Add(cpi);

            //CreatPostionInfo cpi = new CreatPostionInfo();
            //cpi.m_pos = mc.pos.DeepCopy();
            //cpi.m_dir.FromVector( ssc.skillDir.DeepCopy().ToVector().normalized);

            //result.Add(cpi);
        }

        return(result);
    }