Ejemplo n.º 1
0
    public static void BuffChange(bool bAdd)
    {
        HeaderProto.ECreatureActionState[] state = new HeaderProto.ECreatureActionState[2];
        state[0] = HeaderProto.ECreatureActionState.CREATURE_ACTION_STATE_IDLE;
        state[1] = HeaderProto.ECreatureActionState.CREATURE_ACTION_STATE_LIMIT_SKILL;
        Dictionary <int, List <sdActorInterface> > allActor = sdGameLevel.instance.actorMgr.GetAllActor();

        foreach (KeyValuePair <int, List <sdActorInterface> > pair in allActor)
        {
            List <sdActorInterface> lst = (List <sdActorInterface>)pair.Value;
            if (lst != null)
            {
                for (int index = 0; index < lst.Count; ++index)
                {
                    for (int i = 0; i < state.Length; i++)
                    {
                        if (bAdd)
                        {
                            lst[index].AddDebuffState(state[i]);
                        }
                        else
                        {
                            lst[index].RemoveDebuffState(state[i]);
                        }
                    }
                }
            }
        }
    }
Ejemplo n.º 2
0
    // 获取状态aa
    protected void NotifyAddDebuffState(sdActorInterface kActor, HeaderProto.ECreatureActionState eState)
    {
        if (mBehaviourEventTree == null)
        {
            return;
        }

        mBehaviourStateBlock.OnAddDebuffState(kActor, eState);
        SyncUpdateBehaviourTree();
    }
Ejemplo n.º 3
0
    // 禁止双方移动和使用技能aa
    protected void PKStop()
    {
        if (m_pvpRival != null)
        {
            m_pvpRival.NotifyKilled -= sdPVPManager.Instance.KillPVPRival;

            sdActorInterface kActivePet = m_pvpRival.Retainer;
            HeaderProto.ECreatureActionState[] state = new HeaderProto.ECreatureActionState[2];
            state[0] = HeaderProto.ECreatureActionState.CREATURE_ACTION_STATE_STAY;
            state[1] = HeaderProto.ECreatureActionState.CREATURE_ACTION_STATE_LIMIT_SKILL;
            for (int i = 0; i < state.Length; i++)
            {
                if (kActivePet != null)
                {
                    kActivePet.AddDebuffState(state[i]);
                }

                m_pvpRival.AddDebuffState(state[i]);
            }

            m_pvpRival = null;
            mActivePet = null;

            foreach (DictionaryEntry kEntry in mPetList)
            {
                Hashtable kProperty = kEntry.Value as Hashtable;
                if (kProperty == null)
                {
                    continue;
                }

                kProperty["Enable"] = false;
            }
        }

        if (sdGameLevel.instance.mainChar != null)
        {
            sdGameLevel.instance.mainChar.NotifyKilled -= KillMe;

            sdActorInterface kActivePet = sdGameLevel.instance.mainChar.Retainer;
            HeaderProto.ECreatureActionState[] state = new HeaderProto.ECreatureActionState[2];
            state[0] = HeaderProto.ECreatureActionState.CREATURE_ACTION_STATE_STAY;
            state[1] = HeaderProto.ECreatureActionState.CREATURE_ACTION_STATE_LIMIT_SKILL;
            for (int i = 0; i < state.Length; i++)
            {
                if (kActivePet != null)
                {
                    kActivePet.AddDebuffState(state[i]);
                }

                sdGameLevel.instance.mainChar.AddDebuffState(state[i]);
            }
        }
    }
Ejemplo n.º 4
0
 public virtual void    RemoveDebuffState(HeaderProto.ECreatureActionState state)
 {
     if (!CheckDebuffState(state))
     {
         return;
     }
     DebuffState[(int)state]--;
     if (DebuffState[(int)state] == 0)
     {
         DebuffStateFlag &= ~(uint)(1 << (int)state);
     }
 }
Ejemplo n.º 5
0
    public void Hide()
    {
        HeaderProto.ECreatureActionState[] state = new HeaderProto.ECreatureActionState[2];
        state[0] = HeaderProto.ECreatureActionState.CREATURE_ACTION_STATE_IDLE;
        state[1] = HeaderProto.ECreatureActionState.CREATURE_ACTION_STATE_LIMIT_SKILL;
        for (int i = 0; i < state.Length; i++)
        {
            sdGameLevel.instance.mainChar.RemoveDebuffState(state[i]);
        }

        sdGameLevel.instance.SetFingerObjectActive(true);
        sdUICharacter.Instance.DialogueCharacterList.Clear();
        sdGameLevel.instance.mainCamera.MainCharFollow = true;
        m_dialogueUI.SetActive(false);
    }
Ejemplo n.º 6
0
    public void SetTarget(GameObject obj, sdLevelArea area)
    {
        sdUICharacter.Instance.bBossMovie = true;
        m_StartTime      = System.DateTime.Now.Ticks / 10000000L;
        mBoss            = obj;
        bossSaveRotate   = mBoss.transform.rotation;
        levelArea        = area;
        mMainCamera      = sdGameLevel.instance.mainCamera.GetComponent <Camera>();
        cameraSavePos    = mMainCamera.gameObject.transform.position;
        cameraSaveRotate = mMainCamera.gameObject.transform.rotation;
        mUICamera        = sdGameLevel.instance.UICamera;
        SetTargetEffectVisible(false);
        sdGameLevel.instance.SetFingerObjectActive(false);

        HeaderProto.ECreatureActionState[] state = new HeaderProto.ECreatureActionState[2];
        state[0] = HeaderProto.ECreatureActionState.CREATURE_ACTION_STATE_IDLE;
        state[1] = HeaderProto.ECreatureActionState.CREATURE_ACTION_STATE_LIMIT_SKILL;
        levelArea.SetMonsterStatus(state, true);
        sdActorInterface activePet = sdGameLevel.instance.mainChar.Retainer;

        for (int i = 0; i < state.Length; i++)
        {
            if (activePet != null)
            {
                activePet.AddDebuffState(state[i]);
            }
            sdGameLevel.instance.mainChar.AddDebuffState(state[i]);
        }
        if (activePet != null && activePet.actorType == ActorType.AT_Pet)
        {
            ((sdGameMonster)activePet).DeactiveHPUI();
        }

        ResLoadParams param = new ResLoadParams();

        sdResourceMgr.Instance.LoadResource("UI/$Movie/bossdialogue.prefab", LoadBossDialogue, param);
        //榛戝睆杩涘叆aa
        Quaternion cameraRotate = mMainCamera.gameObject.transform.rotation;

        cameraRotate = cameraRotate * Quaternion.AngleAxis(180.0f, new Vector3(0, 1, 0));
        Vector3 direction = cameraRotate * Vector3.forward;

        direction.y = 0.0f;
        direction.Normalize();
        Quaternion bossRotate = Quaternion.identity;

        if (direction.z < -0.9999f)
        {
            bossRotate = Quaternion.AngleAxis(180.0f, new Vector3(0, 1, 0));
        }
        else
        {
            bossRotate = Quaternion.FromToRotation(Vector3.forward, direction);
        }
        mBoss.transform.rotation = bossRotate;
        sdGameLevel.instance.mainCamera.MainCharFollow = false;
        if (mbornAnimNext != null && mbornAnimNext.Length > 0)
        {
            bPlayShowAnimation = true;
            gameMonster        = mBoss.GetComponent <sdGameMonster>();
        }
    }
Ejemplo n.º 7
0
    protected override void Update()
    {
        if (mnStage == 0)
        {
            return;
        }
        if (mnStage == 1)        //榛戝睆aa
        {
            if (m_fTime <= float.Epsilon)
            {
                mnStage = 2;
                m_fTime = bornAnimTime;
            }
            else
            {
                if (m_fTime > enterTime)
                {
                    mask.color = new Color(0.0f, 0.0f, 0.0f, 1.0f);
                }
                else
                {
                    mask.color = new Color(0.0f, 0.0f, 0.0f, 1.0f * m_fTime * m_fTime / enterTime / enterTime);
                }
                m_fTime -= Time.deltaTime;
            }
        }
        else if (mnStage == 2) //鎾?斁鍑虹敓鍔ㄤ綔aa
        {
            if (m_fTime < float.Epsilon)
            {
                if (bPlayShowAnimation && gameMonster != null)//boss鎾?斁灞曠ず鍔ㄧ敾aa
                {
                    AnimationState aniState = gameMonster.AnimController[mbornAnimNext];
                    if (aniState != null)
                    {
                        aniState.wrapMode = WrapMode.Once;
                        aniState.layer    = 10;
                        gameMonster.AnimController.CrossFade(mbornAnimNext, 0.15f);
                    }
                    if (mbornAudio != null && mbornAudio.Length > 0)
                    {
                        gameMonster.PlayAudio(mbornAudio);
                    }
                    bPlayShowAnimation = false;
                }
                m_fTime = stayTime;
                mnStage = 3;
            }
            else
            {
                m_fTime -= Time.deltaTime;
            }
        }
        else if (mnStage == 3)
        {
            if (m_fTime <= float.Epsilon)
            {
                //mBoss.transform.rotation = bossSaveRotate;
                //m_fTime = 1.25f*leaveTime;
                m_fTime = 0.0f;
                mnStage = 4;
            }
            else
            {
                m_fTime -= Time.deltaTime;
            }
        }
        else if (mnStage == 4)//榛戝睆娣″叆aa
        {
            if (m_fTime > afterStayTime)
            {
                mBoss.transform.rotation = bossSaveRotate;
                m_fTime = leaveTime;
                mnStage = 5;
            }
            else
            {
                m_fTime   += Time.deltaTime;
                mask.color = new Color(0.0f, 0.0f, 0.0f, 1.0f * m_fTime * m_fTime / afterStayTime / afterStayTime);
            }
        }
        else if (mnStage == 5)//榛戝睆娣″嚭aa
        {
            if (m_fTime <= float.Epsilon)
            {
                if (bossDialogue != null)
                {
                    bossDialogue.SetActive(false);
                }
                SetTargetEffectVisible(true);
                sdUICharacter.Instance.bBossMovie = false;
                GameObject fightUI = sdUICharacter.Instance.GetFightUi();
                if (fightUI != null)
                {
                    sdFightUi fight = fightUI.GetComponent <sdFightUi>();
                    if (fight != null)
                    {
                        fight.AddComboTime(System.DateTime.Now.Ticks / 10000000L - m_StartTime);
                    }
                }
                mnStage = 0;
            }
            else
            {
                mask.color = new Color(0.0f, 0.0f, 0.0f, 1.0f * m_fTime * m_fTime / leaveTime / leaveTime);
                if (bReSetCamera)
                {
                    bReSetCamera = false;
                    mMainCamera.transform.position = cameraSavePos;
                    mMainCamera.transform.rotation = cameraSaveRotate;
                    HeaderProto.ECreatureActionState[] state = new HeaderProto.ECreatureActionState[2];
                    state[0] = HeaderProto.ECreatureActionState.CREATURE_ACTION_STATE_IDLE;
                    state[1] = HeaderProto.ECreatureActionState.CREATURE_ACTION_STATE_LIMIT_SKILL;
                    levelArea.SetMonsterStatus(state, false);
                    sdActorInterface activePet = sdGameLevel.instance.mainChar.Retainer;
                    for (int i = 0; i < state.Length; i++)
                    {
                        if (activePet != null)
                        {
                            activePet.RemoveDebuffState(state[i]);
                        }
                        sdGameLevel.instance.mainChar.RemoveDebuffState(state[i]);
                    }
                    sdGameLevel.instance.mainCamera.MainCharFollow = true;
                    sdGameLevel.instance.SetFingerObjectActive(true);
                    if (activePet != null && activePet.actorType == ActorType.AT_Pet)
                    {
                        ((sdGameMonster)activePet).ActiveHPUI();
                    }
                    sdUICharacter.Instance.ShowFightUi();
                }

                m_fTime -= Time.deltaTime;
            }
        }
    }
Ejemplo n.º 8
0
    // 获取状态aa
    public void OnAddDebuffState(sdActorInterface kActor, HeaderProto.ECreatureActionState eState)
    {
        mState = eState;

        mBehaviourStateEventType = EBehaviourStateEventType.enBSET_Buff;                //< 当次事件类型aa
    }
Ejemplo n.º 9
0
    public static bool    Do(sdActorInterface actor, OpParameter param)
    {
        Hashtable table = sdConfDataMgr.Instance().GetTable("operation");

        Operation op = (Operation)table[param.id];

        switch (op.byOperationType)
        {
        case (int)HeaderProto.EOpreationType.OPREATION_TYPE_NONE: {
            return(true);
        }

        case (int)HeaderProto.EOpreationType.OPREATION_TYPE_FOREVER: {
            if (param.doType == (int)HeaderProto.EDoOperationType.DO_OPERATION_TYPE_START ||
                param.doType == (int)HeaderProto.EDoOperationType.DO_OPERATION_TYPE_ADD
                )
            {
                if (actor == null)
                {
                    return(false);
                }
                Hashtable dst = actor.GetProperty();
                switch (op.dwOperationPara1)
                {
                case (int)HeaderProto.EOpreationFlag.OPREATION_FLAG_ADD: {
                    AddProperty(actor, dst, op, param);
                } break;

                case (int)HeaderProto.EOpreationFlag.OPREATION_FLAG_REDUCE: {
                    param.data = -param.data;
                    AddProperty(actor, dst, op, param);
                } break;

                case (int)HeaderProto.EOpreationFlag.OPREATION_FLAG_SET: {} break;
                }
            }
        } break;

        case (int)HeaderProto.EOpreationType.OPREATION_TYPE_STATE: {
            if (actor == null)
            {
                return(false);
            }
            if (param.doType == (int)HeaderProto.EDoOperationType.DO_OPERATION_TYPE_START)
            {
                HeaderProto.ECreatureActionState state = (HeaderProto.ECreatureActionState)param.data;
                actor.AddDebuffState(state);
            }
            else if (param.doType == (int)HeaderProto.EDoOperationType.DO_OPERATION_TYPE_REMOVE)
            {
                HeaderProto.ECreatureActionState state = (HeaderProto.ECreatureActionState)param.data;
                actor.RemoveDebuffState(state);
            }
        } break;

        case (int)HeaderProto.EOpreationType.OPREATION_TYPE_ADD_BUFF: {
            if (actor == null)
            {
                return(false);
            }
            actor.AddBuff(param.data, param.data1, param.attackActor);
        } break;

        case (int)HeaderProto.EOpreationType.OPREATION_TYPE_DISPEL: {
            if (actor == null)
            {
                return(false);
            }
            if (op.dwOperationPara0 == 0)
            {
                actor.RemoveBuffbyClassType(op.dwOperationPara1);
            }
            else if (op.dwOperationPara0 == 1)
            {
                actor.RemoveBuff(op.dwOperationPara1, op.dwOperationPara2);
            }
            else if (op.dwOperationPara0 == 2)
            {
                actor.RemoveBuffbyID(param.data);
            }
            else if (op.dwOperationPara0 == 3)
            {
                actor.RemoveBuffbyProperty(op.dwOperationPara1);
            }
            else if (op.dwOperationPara0 == 4)
            {
            }
            else if (op.dwOperationPara0 == 5)
            {
                actor.RemoveAllBuff();
            }
        } break;

        case (int)HeaderProto.EOpreationType.OPREATION_TYPE_DO_BUFF_DAMAGE:
        {
            if (param.targetActor == null)
            {
                return(false);
            }
            Hashtable action = sdConfDataMgr.Instance().m_BuffAction[param.data]       as Hashtable;

            int strikeType = (int)action["byAoeAreaType"];
            int nCombo     = 0;
            if (strikeType == 0)
            {
                HeaderProto.ESkillEffect skilleffect = HeaderProto.ESkillEffect.SKILL_EFFECT_DAMAGE_HP;
                if (action.ContainsKey("bySkillEffect"))
                {
                    skilleffect = (HeaderProto.ESkillEffect)(action["bySkillEffect"]);
                }
                action["ParentID"] = 0;
                DamageResult dr = sdGameLevel.instance.battleSystem.testHurt(param.attackActor,
                                                                             action,
                                                                             param.targetActor,
                                                                             0,
                                                                             skilleffect);
                if (Bubble.IsHurtOther(dr.bubbleType))
                {
                    nCombo++;
                }
            }
            else
            {
                nCombo = sdGameLevel.instance.battleSystem.DoSDAttack(
                    param.attackActor,
                    action,
                    param.targetActor.transform.position,
                    0,
                    null);
            }
            if (param.attackActor == sdGameLevel.instance.mainChar && nCombo > 0)
            {
                sdUICharacter.Instance.ShowComboWnd(true, nCombo);
            }
        } break;

        case (int)HeaderProto.EOpreationType.OPREATION_TYPE_CLEAR_SKILL_COOLDOWN:
        {
            sdGameActor gameActor = (sdGameActor)actor;
            if (op.dwOperationPara0 == 0)                    //某个技能aa
            {
                int     skillID = param.data / 100;
                sdSkill skill   = gameActor.skillTree.getSkill(skillID);
                if (skill != null)
                {
                    if (op.dwOperationPara1 == 0)
                    {
                        skill.skillState = (int)sdSkill.State.eSS_OK;
                    }
                    else if (op.dwOperationPara1 == 1)
                    {
                        int time = CalculateSkillCoolDown(op.dwOperationPara2, op.dwOperationPara3, skill.GetCD(), param.data1);
                        sdUICharacter.Instance.SetShortCutCd(param.data, time, true);
                        skill.cooldown = time;
                        skill.Setct(0.0f);
                    }
                }
            }
            else if (op.dwOperationPara0 == 1)                   //某种形态的技能aa
            {
                foreach (DictionaryEntry de in gameActor.skillTree.AllSkill)
                {
                    sdSkill skill = de.Value as sdSkill;
                    if (skill.skillProperty.ContainsKey("byShape"))
                    {
                        int byShape = (int)skill.skillProperty["byShape"];
                        if (byShape == param.data)
                        {
                            if (op.dwOperationPara1 == 0)
                            {
                                skill.skillState = (int)sdSkill.State.eSS_OK;
                            }
                            else if (op.dwOperationPara1 == 1)
                            {
                                int time = CalculateSkillCoolDown(op.dwOperationPara2, op.dwOperationPara3, skill.cooldown, param.data1);
                                sdUICharacter.Instance.SetShortCutCd(skill.id, time, true);
                                skill.cooldown = time;
                                skill.Setct(0.0f);
                            }
                        }
                    }
                }
            }
            else if (op.dwOperationPara0 == 2)                   //所有技能aa
            {
                foreach (DictionaryEntry de in gameActor.skillTree.AllSkill)
                {
                    sdSkill skill = de.Value as sdSkill;
                    if (op.dwOperationPara1 == 0)
                    {
                        skill.skillState = (int)sdSkill.State.eSS_OK;
                    }
                    else if (op.dwOperationPara1 == 1)
                    {
                        int time = CalculateSkillCoolDown(op.dwOperationPara2, op.dwOperationPara3, skill.cooldown, param.data1);
                        sdUICharacter.Instance.SetShortCutCd(skill.id, time, true);
                        skill.cooldown = time;
                        skill.Setct(0.0f);
                    }
                }
            }
        } break;

        case (int)HeaderProto.EOpreationType.OPREATION_TYPE_SUMMON_MONSTER:                  //operator.txt byOperationType
        {
            iSummonUniqueID++;
            if (op.dwOperationPara0 == 1)
            {
                int     iAngle       = op.dwOperationPara2;
                int     iSummonID    = param.data;
                int     iSommonCount = param.data1;
                int     skillID      = param.data2;
                Vector3 v            = param.attackActor.GetDirection();
                v.y = 0.0f;
                v.Normalize();
                Quaternion tempQ = Quaternion.FromToRotation(new Vector3(0, 0, 1), v);
                if (v.z < -0.9999f)
                {
                    tempQ = Quaternion.AngleAxis(180.0f, new Vector3(0, 1, 0));
                }

                List <sdActorInterface> lstActor = null;
                if (op.dwOperationPara3 == 1 || op.dwOperationPara3 == 2)                        //1 方向并跟踪目标  2.方向不跟踪aaa
                {
                    List <sdActorInterface> actorList = null;
                    if (iAngle == 360)
                    {
                        actorList = sdGameLevel.instance.actorMgr.FindActor(
                            param.attackActor,
                            HeaderProto.ESkillObjType.SKILL_OBJ_ENEMY,
                            param.attackActor.transform.position,
                            Vector3.zero,
                            1,
                            0,
                            15.0f,
                            true);
                    }
                    else
                    {
                        actorList = sdGameLevel.instance.actorMgr.FindActor(
                            param.attackActor,
                            HeaderProto.ESkillObjType.SKILL_OBJ_ENEMY,
                            param.attackActor.transform.position,
                            param.attackActor.GetDirection(),
                            5,
                            iAngle,
                            15.0f,
                            true);
                    }
                    lstActor = sdGameLevel.instance.actorMgr.SortActor(param.attackActor.transform.position, actorList);
                }

                int i = 0;
                if (op.dwOperationPara3 == 1)
                {
                    for (; i < iSommonCount && i < lstActor.Count; i++)
                    {
                        sdActorInterface target  = lstActor[i];
                        SummonInfo       sumInfo = new SummonInfo();
                        Vector3          vDir    = target.transform.position - param.attackActor.transform.position;
                        vDir.y = 0.0f;
                        vDir.Normalize();
                        if (v.z < -0.99999f)
                        {
                            sumInfo.rotate = Quaternion.AngleAxis(180.0f, new Vector3(0, 1, 0));
                        }
                        else
                        {
                            sumInfo.rotate = Quaternion.FromToRotation(new Vector3(0, 0, 1), vDir);
                        }
                        sumInfo.pos      = param.trans.position;
                        sumInfo.userdata = target;
                        sumInfo.summonID = iSummonID;
                        sumInfo.skillID  = skillID;
                        param.attackActor.AddSummon(sumInfo, iSummonUniqueID);
                    }
                }
                else if (op.dwOperationPara3 == 2)
                {
                    for (; i < iSommonCount && i < lstActor.Count; i++)
                    {
                        sdActorInterface target = lstActor[i];
                        Vector3          vDir   = target.transform.position - param.attackActor.transform.position;
                        vDir.y = 0.0f;
                        vDir.Normalize();
                        SummonInfo sumInfo = new SummonInfo();
                        if (v.z < -0.99999f)
                        {
                            sumInfo.rotate = Quaternion.AngleAxis(180.0f, new Vector3(0, 1, 0));
                        }
                        else
                        {
                            sumInfo.rotate = Quaternion.FromToRotation(new Vector3(0, 0, 1), vDir);
                        }
                        sumInfo.pos      = param.trans.position;
                        sumInfo.summonID = iSummonID;
                        sumInfo.skillID  = skillID;
                        param.attackActor.AddSummon(sumInfo, iSummonUniqueID);
                    }
                }
                if (i < iSommonCount)
                {
                    if (iAngle == 360)
                    {
                        float iPerAngle = (float)iAngle / (float)(iSommonCount - i);
                        for (int j = 0; j < iSommonCount - i; j++)
                        {
                            SummonInfo sumInfo = new SummonInfo();
                            sumInfo.rotate   = Quaternion.AngleAxis(iPerAngle * j, new Vector3(0, 1, 0)) * tempQ;
                            sumInfo.pos      = param.trans.position;
                            sumInfo.summonID = iSummonID;
                            sumInfo.skillID  = skillID;
                            param.attackActor.AddSummon(sumInfo, iSummonUniqueID);
                        }
                    }
                    else
                    {
                        float iPerAngle   = (float)iAngle / (float)(iSommonCount - i + 1);
                        float iAngleStart = -iAngle * 0.5f + iPerAngle;
                        for (int j = 0; j < iSommonCount - i; j++)
                        {
                            SummonInfo sumInfo = new SummonInfo();
                            sumInfo.rotate   = Quaternion.AngleAxis(iAngleStart + iPerAngle * j, new Vector3(0, 1, 0)) * tempQ;
                            sumInfo.pos      = param.trans.position;
                            sumInfo.summonID = iSummonID;
                            sumInfo.skillID  = skillID;
                            param.attackActor.AddSummon(sumInfo, iSummonUniqueID);
                        }
                    }
                }
            }
        } break;

        case (int)HeaderProto.EOpreationType.OPREATION_TYPE_TELEPORT:
        {
            TeleportInfo tpInfo = new TeleportInfo();
            tpInfo.Type = op.dwOperationPara0;
            tpInfo.PlayActionProbality = op.dwOperationPara1;
            tpInfo.TeleportState       = (op.dwOperationPara2 == 1);
            tpInfo.MoveSpeed           = (float)param.data * 0.001f;
            tpInfo.MoveTime            = (float)param.data1 * 0.001f;
            tpInfo.castActor           = param.attackActor;
            tpInfo.castCenter          = param.attackActor.transform.position;
            if (actor != null)
            {
                actor.SetTeleportInfo(tpInfo);
            }
            else
            {
                float dis = tpInfo.MoveSpeed * tpInfo.MoveTime;
                List <sdActorInterface> lstActor = sdGameLevel.instance.actorMgr.FindActor(param.attackActor, HeaderProto.ESkillObjType.SKILL_OBJ_ENEMY, tpInfo.castCenter, Vector3.zero, 1, 0, dis, true);
                if (lstActor != null)
                {
                    foreach (sdActorInterface a in lstActor)
                    {
                        a.SetTeleportInfo(tpInfo);
                    }
                }
            }
        } break;

        case (int)HeaderProto.EOpreationType.OPREATION_TYPE_DOACTION:
        {
            sdGameActor gameActor = (sdGameActor)(param.attackActor);
            sdBaseState baseState = (sdBaseState)gameActor.logicTSM.states[param.data];
            if (baseState != null)
            {
                int nCombo = sdGameLevel.instance.battleSystem.DoSDAttack(gameActor, baseState.stateData, gameActor.transform.position, 0, baseState);
                baseState.playEffectNow(gameActor);
                baseState.PlayAudioNow(gameActor);
                if (gameActor == sdGameLevel.instance.mainChar && nCombo > 0)
                {
                    sdUICharacter.Instance.ShowComboWnd(true, nCombo);
                }
            }
        }
        break;

        case (int)HeaderProto.EOpreationType.OPREATION_TYPE_COMBO:
        {
            if (param.attackActor.GetActorType() == ActorType.AT_Player)
            {
                sdGameActor gameActor = (sdGameActor)(param.attackActor);
                sdBaseState baseState = (sdBaseState)gameActor.logicTSM.states[param.data];
                if (baseState != null)
                {
                    baseState.bEnable = (param.data1 == 1);
                }
            }
        }
        break;

        case (int)HeaderProto.EOpreationType.OPREATION_TYPE_ATTACKGETHP:
        {
            AttackRestore data = new AttackRestore();
            data.upperLimit  = op.dwOperationPara1 * 0.0001f;
            data.restoreHp   = (op.dwOperationPara0 == 0);
            data.monsterType = op.dwOperationPara2;
            data.ratio       = param.data * 0.0001f;
            data.actionID    = param.data1;
            sdGameActor gameActor = (sdGameActor)(param.attackActor);
            gameActor.AddAttackRestore(data);
        }
        break;

        case (int)HeaderProto.EOpreationType.OPERATION_TYPE_SUMMON:
        {
            iSummonUniqueID++;
            switch (op.dwOperationPara0)
            {
            case 0:
            case 1:
                PointSummon(actor, param, op);
                break;

            case 2:
            case 3:
                RandomSummon(actor, param, op);
                break;

            case 4:
            case 5:
                RoundSummon(actor, param, op);
                break;
            }
        }
        break;

        case (int)HeaderProto.EOpreationType.OPERATION_TYPE_HIDESHOW:
        {
            HideShowInfo info = new HideShowInfo();
            info.actor     = param.attackActor;
            info.fHideTime = param.data * 0.001f;
            info.fDistance = param.data1 * 0.001f;
            sdHideShowMgr.Instance.AddActor(info);
        }
        break;

        case (int)HeaderProto.EOpreationType.OPERATION_TYPE_FLASH:
        {
            float fFront = 1.0f;
            if ((op.dwOperationPara0 & 1) == 1)
            {
                fFront = -1.0f;
            }
            float fDistance = (float)op.dwOperationPara3 * 0.001f;

            sdActorInterface castActor = param.attackActor;

            int playerLayer  = 1 << LayerMask.NameToLayer("Player");
            int petLayer     = 1 << LayerMask.NameToLayer("Pet");
            int monsterLayer = 1 << LayerMask.NameToLayer("Monster");
            int mask         = ~(playerLayer | petLayer | monsterLayer);

            switch (op.dwOperationPara0)
            {
            case 0:
            case 1:
            {
                fDistance = (float)param.data1 * 0.001f;
                Vector3 dir = castActor.GetDirection() * fFront;
                Vector3 pos = castActor.transform.position;



                int   oldLayer = castActor.gameObject.layer;
                int[] layer    = new int[] {
                    LayerMask.NameToLayer("Monster"),
                    LayerMask.NameToLayer("Pet"),
                    LayerMask.NameToLayer("Player")
                };
                bool[] oldcollision = new bool[3];
                for (int i = 0; i < 3; i++)
                {
                    oldcollision[i] = Physics.GetIgnoreLayerCollision(oldLayer, layer[i]);
                    Physics.IgnoreLayerCollision(oldLayer, layer[i]);
                }

                ((sdGameActor)castActor).moveInternal(dir * fDistance / Time.deltaTime);

                for (int i = 0; i < 3; i++)
                {
                    Physics.IgnoreLayerCollision(oldLayer, layer[i], oldcollision[i]);
                }
                castActor.gameObject.layer = oldLayer;

                Vector3 newPos = castActor.transform.position;

                sdGameLevel.instance.actorMgr.ManualCheckTrigger((sdGameActor)castActor, pos, newPos - pos);

                if (param.data > 0)
                {
                    HideShowInfo info = new HideShowInfo();
                    info.actor     = castActor;
                    info.fHideTime = param.data * 0.001f;
                    info.fDistance = 0.0f;
                    sdHideShowMgr.Instance.AddActorNoRandomPosition(info);
                }
            }
            break;

            case 2:
            case 3:
            {
                float fResearchDistance           = param.data1 * 0.001f;
                int   iAngle                      = op.dwOperationPara1;
                List <sdActorInterface> actorList = null;
                if (iAngle == 360)
                {
                    actorList = sdGameLevel.instance.actorMgr.FindActor(
                        param.attackActor,
                        HeaderProto.ESkillObjType.SKILL_OBJ_ENEMY,
                        param.attackActor.transform.position,
                        Vector3.zero,
                        1,
                        0,
                        fResearchDistance,
                        true);
                }
                else
                {
                    actorList = sdGameLevel.instance.actorMgr.FindActor(
                        param.attackActor,
                        HeaderProto.ESkillObjType.SKILL_OBJ_ENEMY,
                        param.attackActor.transform.position,
                        param.attackActor.GetDirection(),
                        5,
                        iAngle,
                        fResearchDistance,
                        true);
                }

                sdActorInterface targetActor = null;
                if (actorList != null)
                {
                    if (actorList.Count > 0)
                    {
                        if (op.dwOperationPara2 == 0)
                        {
                            targetActor = actorList[0];
                            float min = (castActor.transform.position - targetActor.transform.position).sqrMagnitude;
                            for (int i = 1; i < actorList.Count; i++)
                            {
                                Vector3 v = castActor.transform.position - actorList[i].transform.position;
                                if (v.sqrMagnitude < min)
                                {
                                    min         = v.sqrMagnitude;
                                    targetActor = actorList[i];
                                }
                            }
                        }
                        else
                        {
                            int index = Random.Range(0, actorList.Count);
                            if (index >= actorList.Count)
                            {
                                index = 0;
                            }
                            targetActor = actorList[index];
                        }
                    }
                }

                if (targetActor != null)
                {
                    if (fDistance < targetActor.getRadius() + castActor.getRadius())
                    {
                        fDistance = targetActor.getRadius() + castActor.getRadius();
                    }
                    Vector3    dir = targetActor.GetDirection() * fFront;
                    Vector3    pos = targetActor.transform.position + new Vector3(0, 0.1f, 0);
                    RaycastHit hit;
                    if (Physics.Raycast(pos, dir, out hit, fDistance * 2, mask))
                    {
                        if (hit.distance < fDistance)
                        {
                            fDistance = hit.distance;
                        }
                    }

                    castActor.transform.position = targetActor.transform.position + dir * fDistance;

                    dir.y = 0.0f;
                    dir.Normalize();

                    ((sdGameActor)castActor).spinToTargetDirection(-dir, true);
                    if (param.data > 0)
                    {
                        HideShowInfo info = new HideShowInfo();
                        info.actor     = castActor;
                        info.fHideTime = param.data * 0.001f;
                        info.fDistance = 0.0f;
                        sdHideShowMgr.Instance.AddActorNoRandomPosition(info);
                    }
                }
            } break;
            }
        }
        break;
        }
        return(true);
    }
Ejemplo n.º 10
0
 public bool    CheckDebuffState(HeaderProto.ECreatureActionState state)
 {
     return(DebuffState[(int)state] != 0);
 }
Ejemplo n.º 11
0
 public virtual void    AddDebuffState(HeaderProto.ECreatureActionState state)
 {
     DebuffState[(int)state]++;
     DebuffStateFlag |= (uint)(1 << (int)state);
 }