Example #1
0
    public List <sdActorInterface> FindActor(
        sdActorInterface actor,
        HeaderProto.ESkillObjType itt,
        Vector3 vPos,
        Vector3 vDir,
        int strikeType,
        int strikeAngle,
        float strikeDis,
        bool bActive
        )
    {
        List <sdActorInterface> lstActor = GetTargetActor(actor, itt, bActive);

        if (lstActor == null)
        {
            return(null);
        }
        if (lstActor.Count == 0)
        {
            return(null);
        }
        List <sdActorInterface> retList = new List <sdActorInterface>();

        foreach (sdActorInterface a in lstActor)
        {
            if ((a != null) &&
                a.IsActive() &&
                (a.GetCurrentHP() > 0))
            {
                bool hit = false;
                if (strikeType == 5)
                {
                    hit = SDGlobal.CheckHit(
                        vPos,
                        vDir,
                        strikeDis, strikeAngle * 0.5f,
                        a.transform.position,
                        a.getRadius());
                }
                else if (strikeType == 1)
                {
                    hit = SDGlobal.CheckRoundHit(
                        vPos,
                        strikeDis,
                        a.transform.position,
                        a.getRadius());
                }
                else if (strikeType == 7)
                {
                    hit = SDGlobal.CheckBoxHit(
                        vPos,
                        vDir,
                        strikeDis, strikeAngle * 0.001f,
                        a.transform.position,
                        a.getRadius());
                }
                if (hit)
                {
                    retList.Add(a);
                }
            }
        }
        return(retList);
    }
Example #2
0
    public sdActorInterface        FindNearestActor(
        sdActorInterface actor,
        HeaderProto.ESkillObjType itt,
        Vector3 vPos,
        Vector3 vDir,
        int strikeType,
        int strikeAngle,
        float strikeDis,
        bool bActive)
    {
        List <sdActorInterface> lstActor = GetTargetActor(actor, itt, bActive);

        if (lstActor == null)
        {
            return(null);
        }
        if (lstActor.Count == 0)
        {
            return(null);
        }

        float                   fCurrentDis = 99999.0f;
        sdActorInterface        ret         = null;
        List <sdActorInterface> retList     = new List <sdActorInterface>();

        foreach (sdActorInterface a in lstActor)
        {
            if ((a != null) &&
                (a.GetCurrentHP() > 0) &&
                a.actorType != ActorType.AT_Static)
            {
                bool hit = false;
                if (strikeType == 5)
                {
                    hit = SDGlobal.CheckHit(
                        vPos,
                        vDir,
                        strikeDis, strikeAngle * 0.5f,
                        a.transform.position,
                        a.getRadius());
                }
                else if (strikeType == 1)
                {
                    hit = SDGlobal.CheckRoundHit(
                        vPos,
                        strikeDis,
                        a.transform.position,
                        a.getRadius());
                }
                else if (strikeType == 7)
                {
                    hit = SDGlobal.CheckBoxHit(
                        vPos,
                        vDir,
                        strikeDis, strikeAngle * 0.001f,
                        a.transform.position,
                        a.getRadius());
                }
                if (hit)
                {
                    Vector3 v = a.transform.position - vPos;
                    if (fCurrentDis > v.magnitude)
                    {
                        fCurrentDis = v.magnitude;
                        ret         = a;
                    }
                }
            }
        }
        return(ret);
    }