예제 #1
0
파일: KSkill.cs 프로젝트: zuojiashun/src
    SKILL_RESULT_CODE ApplyOnArea(KSKILL_BULLET pBullet, float fX, float fZ)
    {
        SKILL_RESULT_CODE nResult = SKILL_RESULT_CODE.srcFailed;
        KCharacter        pCaster = null;
        KSkill            pSkill  = null;
        KScene            pScene  = null;

        pSkill = pBullet.pSkillPointer;
        if (pSkill == null)
        {
            goto Exit0;
        }

        pCaster = pBullet.pSkillSrc;
        if (pCaster == null)
        {
            goto Exit0;
        }

        pScene = pCaster.m_pScene;
        if (pScene == null)
        {
            goto Exit0;
        }

        KSkillAreaTravFunc AreaTravFunc = new KSkillAreaTravFunc();

        AreaTravFunc.pBullet    = pBullet;
        AreaTravFunc.nLeftCount = 3;

        if (m_pBaseInfo.nCastMode == KSKILL_CAST_MODE.scmTargetArea)
        {
            KCharacter pObject = null;
            pBullet.pTarget.GetTarget(ref pObject);
            if (pObject == null)
            {
                goto Exit0;
            }

            AreaTravFunc.bTargetArea = true;
            AreaTravFunc.nTargetType = (int)pBullet.pTarget.GetTargetType();
            AreaTravFunc.dwTargetID  = pObject.m_dwID;
            AreaTravFunc.nLeftCount -= 1;
        }
        else
        {
            AreaTravFunc.bTargetArea = false;
            AreaTravFunc.nTargetType = (int)TARGET_TYPE.ttInvalid;
            AreaTravFunc.dwTargetID  = 0;
        }

        pScene.TraverseRangePlayer <KSkillAreaTravFunc>(ref AreaTravFunc);
        pScene.TraverseRangeNpc <KSkillAreaTravFunc>(ref AreaTravFunc);


        nResult = SKILL_RESULT_CODE.srcSuccess;
Exit0:
        return(nResult);
    }
예제 #2
0
    public static void AISearchCharacter <T>(T rTactic)
    {
        KScene pScene = null;

        KSearchTactic pCenterObj = rTactic as KSearchTactic;

        if (pCenterObj == null)
        {
            //error
            goto Exit0;
        }

        KSceneObject pSceneObject = (KSceneObject)pCenterObj.m_pSelf;

        if (pSceneObject == null)
        {
            //error
            goto Exit0;
        }


        pScene = pSceneObject.m_pScene;
        if (pScene == null)
        {
            //error
            goto Exit0;
        }

        // 暂时只有npc
        pScene.TraverseRangeNpc(ref rTactic);
        pScene.TraverseRangePlayer(ref rTactic);



Exit0:
        return;
    }