Esempio n. 1
0
    void ShowHitEffect(int idx)
    {
        if (idx == -1)
        {
            return;
        }

        BattleActor aim = isMelee_? aim_: aims_[idx];

        if (aim == null)
        {
            return;
        }

        bool playSkillEffect = aim.ControlEntity.PlaySkillBeattackEffect(crt_data_._Id);

        if (playSkillEffect)
        {
            EffectAPI.Play((EFFECT_ID)crt_data_._Beattack_effectID, aim.ControlEntity.ActorObj, null, null, null, (EffectInst ei, ParamData data) =>
            {
                if (aim == null || aim.ControlEntity == null || aim.ControlEntity.ActorObj == null)
                {
                    return;
                }
                ei.transform.parent     = aim.ControlEntity.ActorObj.transform;
                ei.transform.localScale = Vector3.one;
            });
        }
        else
        {
            aim.ControlEntity.UpdateStateTick(crt_data_._IsPhysic);
        }
    }
Esempio n. 2
0
    void HitHim(int idx)
    {
        if (members_[idx].ControlEntity == null)
        {
            ApplicationEntry.Instance.PostSocketErr(57557);
            return;
        }
        simpleHitCount++;
        AttaclPanel.Instance.togetherHitCrl_.SetNum(simpleHitCount);
        SkillData skill           = SkillData.GetMinxiLevelData(GlobalValue.GetAttackID(members_[idx].GetWeaponType()));
        bool      playSkillEffect = aim_.ControlEntity.PlaySkillBeattackEffect(skill._Id);

        if (playSkillEffect)
        {
            EffectAPI.Play((EFFECT_ID)skill._Beattack_effectID, aim_.ControlEntity.ActorObj);
        }
        else
        {
            int effId = aim_.ControlEntity.GetStateBeattackEffectID(skill._Id);
            EffectAPI.Play((EFFECT_ID)effId, aim_.ControlEntity.ActorObj);
        }

        int change = (int)props_[memberCount_].prop_.value_ - CurrentHp_;

        CurrentHp_ += change;
        aim_.ControlEntity.hitOver_ = props_[memberCount_].fly_;

        int[]  typs = aim_.ControlEntity.StateTypes;
        int    rtst = 0;
        string err  = "";

        GameScript.Call(ScriptGameEvent.SGE_TogetherState, new object[] { typs }, new object[] { rtst }, ref err);

        TogetherStateType tst = (TogetherStateType)rtst;//GameScript.TogetherStateEvent (ScriptGameEvent.SGE_TogetherState, aim_.ControlEntity.StateTypes);

        if (tst == TogetherStateType.TST_Self)
        {
            skipIdx = memberCount_;
            aim_.ControlEntity.PopValueChange(change, PropertyType.PT_HpCurr, aim_.battlePlayer.hpMax_, aim_.battlePlayer.mpMax_);
            includeChange += change;
        }
        else if (tst == TogetherStateType.TST_Enemy)
        {
            members_[memberCount_].ControlEntity.PopValueChange(change, PropertyType.PT_HpCurr, aim_.battlePlayer.hpMax_, aim_.battlePlayer.mpMax_);
        }

        bool hasAInvalid = hasActionInvalid();

        if (idx != members_.Length - 1)
        {
            aim_.ControlEntity.Beattack_1(skill._Id, skill._Level, !hasAInvalid, false, false, members_[memberCount_]);
        }
        else
        {
            aim_.ControlEntity.Beattack_1(skill._Id, skill._Level, !hasAInvalid, CurrentHp_ <= 0, false, members_[memberCount_]);
        }
        aim_.ControlEntity.LookAt(members_[memberCount_].ControlEntity.ActorObj);
        aim_.ControlEntity.UpdateStateTick(true);
    }
Esempio n. 3
0
    public void Do(DieActionType dieType, BattleActor actor)
    {
        if (dieType == DieActionType.DAT_Fly ||
            dieType == DieActionType.DAT_Knock)
        {
            if (GamePlayer.Instance.BattleBaby != null &&
                GamePlayer.Instance.BattleBaby.InstId == actor.InstId)
            {
                GamePlayer.Instance.BabyState(GamePlayer.Instance.BattleBaby.InstId, false);
            }
        }
        dieType_ = dieType;
        actor_   = actor;
        switch (dieType_)
        {
        case DieActionType.DAT_Normal:
            actor_.ControlEntity.SetAnimationParam(GlobalValue.BDead, AnimatorParamType.APT_Boolean, true);
            if (actor_.battlePlayer.type_ == EntityType.ET_Monster && Battle.Instance.isEnemy(actor_.BattlePos))
            {
                Invoke("DealAIDie", 1.5f);
            }
            else
            {
                EffectAPI.Play(EFFECT_ID.Effect_Die, actor_.ControlEntity.ActorObj, null, null, null, actor_.ControlEntity.StarEffectInstCallBack);
            }
            break;

        case DieActionType.DAT_Fly:
            //ClientLog.Instance.Log("Actor die for Fly.");
            flyTime_ = 0f;
            flyFrom_ = actor_.ControlEntity.ActorObj.transform.position;
            flyTo_   = actor_.ControlEntity.ActorObj.transform.position + actor_.ControlEntity.ActorObj.transform.forward * -10f;

            //用这个moveTo会有问题 不到达目的地 没有回调

            //actor_.ControlEntity.MoveTo(actor_.ControlEntity.ActorObj.transform.localPosition + actor_.ControlEntity.ActorObj.transform.forward * -3f, (int data) =>
            //{
            //    Battle.Instance.DeleteBattleEntityItem(actor_.InstId);
            //    actor_.ControlEntity.DieActionFinishCallBack();
            //}, false, false, 0.5f);
            break;

        case DieActionType.DAT_Knock:
            //ClientLog.Instance.Log("Actor die for Knock.");
            MakeTrack();
            knockQue_ = new Queue <GameObject>();
            for (int i = 0; i < trackObjs_.Length; ++i)
            {
                knockQue_.Enqueue(trackObjs_[i]);
            }
            MoveToOneKP();
            break;

        default:
            break;
        }
    }
Esempio n. 4
0
    void ExcuteCounter(COM_ReportActionCounter counter)
    {
        BattleActor caster = Battle.Instance.GetActorByInstId(counter.casterId_);

        BattleActor[] aim   = new BattleActor[] { Battle.Instance.GetActorByIdx((int)counter.targetPosition_) };
        SkillInst     skill = new SkillInst();

        EffectAPI.Play((EFFECT_ID)GlobalValue.EFFECT_Fanji, caster.ControlEntity.ActorObj.transform.position + caster.ControlEntity.ActorObj.transform.forward, null, null, null, (EffectInst inst, ParamData pData) =>
        {
            EffectAPI.Play((EFFECT_ID)GlobalValue.EFFECT_FanjiCast, caster.ControlEntity.ActorObj, null, null, (int iVal) =>
            {
                skill.Cast(GlobalValue.GetAttackID(caster), 1, caster, aim, new COM_ReportTarget[] { counter.props_ }, null, DealCounterAction, true);
            });
        });
    }
Esempio n. 5
0
    void OneByOneExcute(BattleActor aim, bool final = false)
    {
        Vector3 casterPos = caster_.ControlEntity.ActorObj.transform.position;

        // show skill effect
        if (final)
        {
            EffectAPI.Play((EFFECT_ID)crt_data_._EffectID, casterPos, ConvertV3(new BattleActor[] { aim }), GetPack(HitMotion_1, HitMotion_2, ShowHitEffect, PopChangeValue), ActionOver, SaveEffectInst, new ParamData(oboIdx++));
            caster_.ControlEntity.ClearSingBrustCallBack();
            caster_.ControlEntity.ClearSingCallBack();
        }
        else
        {
            EffectAPI.Play((EFFECT_ID)crt_data_._EffectID, casterPos, ConvertV3(new BattleActor[] { aim }), GetPack(HitMotion_1, HitMotion_2, ShowHitEffect, PopChangeValue), null, SaveEffectInst, new ParamData(oboIdx++));
        }
    }
Esempio n. 6
0
    public void PopValueChange(int Value, PropertyType chgType, int hpMax, int mpMax, InvokePkg.CallBack callback = null, bool isCritical = false)
    {
        if (Value == 0)
        {
            if (callback != null)
            {
                callback();
            }
            return;
        }
        if (null == PlayerInfoUI)
        {
            return;
        }
        Roleui roleinfoUI = PlayerInfoUI.GetComponent <Roleui>();

        if (null == roleinfoUI)
        {
            return;
        }
        roleinfoUI.ValueChange(chgType, Value, hpMax, mpMax, true, false);
        if (isCritical)
        {
            EffectAPI.Play((EFFECT_ID)GlobalValue.EFFECT_Critical, ActorObj.transform.position + ActorObj.transform.forward, null, null, null, (EffectInst inst, ParamData pData) =>
            {
                inst.gameObject.SetActive(true);
                //Battle.BattleOver -= inst.GetComponent<EffectInst>().DestorySelf;
            });
        }
        if (PlayerID == GamePlayer.Instance.InstId)
        {
            AttaclPanel.Instance.ChangeValue(chgType, Value, hpMax, mpMax);
        }
        if (Battle.Instance.SelfActorBattleBaby != null)
        {
            if (PlayerID == Battle.Instance.SelfActorBattleBaby.InstId)
            {
                AttaclPanel.Instance.ChangeValueBaby(chgType, Value, hpMax, mpMax);
            }
        }
        if (callback != null)
        {
            GlobalInstanceFunction.Instance.Invoke(callback, 1f);
        }
    }
Esempio n. 7
0
 void CastEffectAfter(int iVal = 0)
 {
     if (caster_.ControlEntity.reportAction_ != null && caster_.ControlEntity.reportAction_.status_ == OrderStatus.OS_Summon)
     {
         caster_.ControlEntity.Summon();
         return;
     }
     if (isMelee_)
     {
         OneMotion();
     }
     else
     {
         Vector3 casterPos = caster_.ControlEntity.ActorObj.transform.position;
         // show skill effect
         EffectAPI.Play((EFFECT_ID)crt_data_._EffectID, casterPos, ConvertV3(aims_), GetPack(HitMotion_1, HitMotion_2, ShowHitEffect, PopChangeValue), ActionOver, SaveEffectInst, null, ConvertTrans(aims_));
     }
 }
Esempio n. 8
0
    public void Excute(BattleActor player, OrderStatus isIn, int babyinst_id, COM_BattleEntityInformation babyInst, ScaleCallBack callback)
    {
        isIn_      = isIn;
        player_    = player;
        babyInst_  = GetActor(isIn, babyinst_id, babyInst);
        call_back_ = callback;
        SkillData sd = SkillData.GetMinxiLevelData(GlobalValue.SKILL_BABYINNOUT);

        player.castAnim_ = GlobalValue.TCast;
        player.ControlEntity.SetAnimationParam(player.castAnim_, AnimatorParamType.APT_Trigger);

        if (sd._Cast_effectID != -1)
        {
            EffectAPI.Play((EFFECT_ID)sd._Cast_effectID, Battle.Instance.GetStagePointByIndex(babyInst_.BattlePos).gameObject, null, null, DoEffect);
        }
        else
        {
            DoEffect();
        }
    }
Esempio n. 9
0
    public void DealEntityDie(DeathMaster.DieActionType dieType = DeathMaster.DieActionType.DAT_Normal)
    {
        BattleActor self = Battle.Instance.GetActorByInstId(PlayerID);

        if (self != null)
        {
            self.SetIprop(PropertyType.PT_HpCurr, 0);
        }
        if (hitOver_)
        {
            dieType = Random.Range(0f, 1f) > 0.5f ? DeathMaster.DieActionType.DAT_Fly : DeathMaster.DieActionType.DAT_Knock;
            EffectAPI.Play((EFFECT_ID)GlobalValue.EFFECT_Dead, self.ControlEntity.ActorObj.transform.position, null, null, null, (EffectInst inst, ParamData pData) =>
            {
                if (hitoverEffectPlayed)
                {
                    GameObject.Destroy(inst.gameObject);
                    return;
                }
                hitoverEffectPlayed = true;
                inst.gameObject.AddComponent <Destroy>().lifetime = 0.5f;
            });

            //飞的是自己 回主城
            //if (PlayerID == GamePlayer.Instance.InstId)
            //{
            //    Battle.Instance.beFlied_ = true;
            //}
        }

        DeathMaster dm = ActorObj.GetComponent <DeathMaster>();

        GlobalInstanceFunction.Instance.setTimeScale(Battle.Instance.reportPlaySpeed_);
        if (dm == null)
        {
            dm = ActorObj.AddComponent <DeathMaster>();
        }
        dm.Do(dieType, self);
        AttaclPanel.Instance.SetEnityUIVisble(m_PlayerID, false);
        ClearState();
    }
Esempio n. 10
0
    void ContinueAction()
    {
        // make counter list
        for (int j = 0; j < reportAction_.counters_.Length; ++j)
        {
            counterLst_.Add(reportAction_.counters_[j]);
        }

        /// add state
        for (int i = 0; i < reportAction_.stateIds_.Length; ++i)
        {
            BattleActor actor = Battle.Instance.GetActorByInstId(reportAction_.stateIds_[i].ownerId_);
            //如果大于1 则延迟加buff
            if (reportAction_.stateIds_[i].addQueue_ > 0)
            {
                //如果目标是自己 加到行动后state列表,否则加到延迟state列表
                if (reportAction_.stateIds_[i].ownerId_ == m_PlayerID)
                {
                    afterActionBuff.Add(reportAction_.stateIds_[i]);
                }
                else
                {
                    actor.ControlEntity.lagStateList.Add(reportAction_.stateIds_[i]);
                }
                continue;
            }
            if (reportAction_.stateIds_[i].add_)
            {
                actor.ControlEntity.AddState(reportAction_.stateIds_[i]);
            }
            else
            {
                actor.ControlEntity.RemoveState((int)reportAction_.stateIds_[i].stateId_);
            }
        }

        /// deal self state.
        ExcuteState(StateInst.ExcuteType.ET_Action, (COM_ReportActionCounter counter) =>
        {
            /// do action
            BattleActor caster = Battle.Instance.GetActorByInstId(reportAction_.casterId_);
            if (caster == null)
            {
                //DealAfterActionState();
                return;
            }
            SkillData data = null;
            data           = SkillData.GetData((int)reportAction_.skill_, (int)reportAction_.skillLevel_);
            /// extra skill
            if (data == null)
            {
                if (reportAction_.status_ == OrderStatus.OS_Weapon)
                {
                    COM_Item inst = new COM_Item();
                    inst.itemId_  = (uint)reportAction_.itemId_;
                    inst.instId_  = (uint)reportAction_.weaponInstId_;
                    if (inst.itemId_ != 0)
                    {
                        Battle.Instance.GetActorByInstId(reportAction_.casterId_).wearEquip(inst);
                    }
                    else
                    {
                        Battle.Instance.GetActorByInstId(reportAction_.casterId_).demontWeapon();
                    }
                }
                DealAfterActionState();
                return;
            }
            else
            {
                if (data._SkillType == SkillType.SKT_DefaultSecPassive || data._SkillType == SkillType.SKT_Passive)
                {
                    DealAfterActionState();
                    return;
                }
                switch (data._Passive_type)
                {
                case PassiveType.PAT_Runaway:
                    RunAway ra = new RunAway();
                    ra.Run(caster, Battle.Instance.GetActorByInstId(reportAction_.babyId_), reportAction_.status_.Equals(OrderStatus.OS_RunawayOk), (ParamData pdata) =>
                    {
                        DealAfterActionState();
                    });
                    return;

                case PassiveType.PAT_Change:
                    ChangePosition cp = new ChangePosition();
                    cp.ChangePos((int)reportAction_.bp0_, (int)reportAction_.bp1_, (ParamData pdata) =>
                    {
                        DealAfterActionState();
                    });
                    return;

                case PassiveType.PAT_BabyInnout:
                    BabyInnOut bio = new BabyInnOut();
                    bio.Excute(caster, reportAction_.status_, reportAction_.babyId_, reportAction_.baby_, DealAfterActionState);
                    ClearState();
                    return;

                case PassiveType.PAT_SecKill:
                    Seckill sk      = new Seckill();
                    SkillData sdata = SkillData.GetData((int)reportAction_.skill_, (int)reportAction_.skillLevel_);
                    if (sdata._Cast_effectID != -1)
                    {
                        EffectAPI.Play((EFFECT_ID)sdata._Cast_effectID, caster.ControlEntity.ActorObj, null, null, (int iVal) =>
                        {
                            if (reportAction_.targets_ == null || reportAction_.targets_.Length == 0)
                            {
                                ClientLog.Instance.Log("Sec Kill has no target!");
                                return;
                            }
                            sk.Do(caster, Battle.Instance.GetActorByIdx((int)reportAction_.targets_[0].position_), DealAfterActionState);
                        });
                    }
                    else
                    {
                        if (reportAction_.targets_ == null || reportAction_.targets_.Length == 0)
                        {
                            ClientLog.Instance.Log("Sec Kill has no target!");
                            return;
                        }
                        sk.Do(caster, Battle.Instance.GetActorByIdx((int)reportAction_.targets_[0].position_), DealAfterActionState);
                    }
                    return;

                default:
                    if (reportAction_.status_ == OrderStatus.OS_None)
                    {
                        DealAfterActionState();
                        return;
                    }
                    else if (reportAction_.status_ == OrderStatus.OS_Zhuachong)
                    {
                        CatchBaby cb = new CatchBaby();
                        cb.Catch(reportAction_, DealAfterActionState);
                        return;
                    }
                    else if (reportAction_.status_ == OrderStatus.OS_Summon)
                    {
//                        List<COM_Entity> entities = new List<COM_Entity>(reportAction_.dynamicEntities_);
//                        Battle.Instance.AddNewActor(entities.ToArray());//, () =>
////							 {
////								DealAfterActionState();
////							 }, reportAction_.dynamicEntities_.Length);
//                        DealAfterActionState();
//                            return;
                        break;
                    }
                    else
                    {
                        break;
                    }
                }
            }

            if (reportAction_.targets_.Length == 0)
            {
                if (reportAction_.status_ == OrderStatus.OS_Summon)
                {
                    mainSkillInst = new SkillInst();
                    mainSkillInst.Cast(reportAction_.skill_, reportAction_.skillLevel_, caster, null, reportAction_.targets_, FinishShow, DealCounterAction);
                }
                else
                {
                    DealAfterActionState();
                }
                return;
            }

            /// normal skill
            List <BattleActor> aims = new List <BattleActor>();
            for (int i = 0; i < reportAction_.targets_.Length; ++i)
            {
                BattleActor item = Battle.Instance.GetActorByIdx((int)reportAction_.targets_[i].position_);
                //				if( null == item || item.isDead ) continue;
                aims.Add(item);
            }

            //TODO for temp
            if (aims.Count == 0)
            {
                aims.Add(Battle.Instance.GetActorByInstId(reportAction_.casterId_));
            }
            ///////
            for (int i = 0; i < aims.Count; ++i)
            {
                if (aims[i] == null)
                {
                    continue;
                }
                aims[i].ForGuardPos = (int)reportAction_.huweiPosition_;
            }
            mainSkillInst = new SkillInst();
            //ClientLog.Instance.Log("宠物 No!  Cast: " + reportAction_.skill_ + "  caster : " + caster.InstName + " aim: " + aims[0].InstName + " len:" + aims.Count + " target: " + reportAction_.targets_[0].position_ + " len:" + reportAction_.targets_.Length);
            mainSkillInst.Cast(reportAction_.skill_, reportAction_.skillLevel_, caster, aims.ToArray(), reportAction_.targets_, FinishShow, DealCounterAction);
        });

        //// 处理需要除掉的actor
        //DealEraseActor();
    }
Esempio n. 11
0
    void ExcuteStateInner()
    {
        if (stateIndex_ >= stateList_.Count)
        {
            if (dealStateCallBack_ != null)
            {
                dealStateCallBack_(counter_);
                dealStateCallBack_ = null;
            }
            return;
        }

        crtStateData_ = StateData.GetData(stateList_[stateIndex_].stateId_);
        if (!isPhysic_ && (crtStateData_._StateType == (int)StateType.ST_ActionAbsorb ||
                           crtStateData_._StateType == (int)StateType.ST_ActionBounce ||
                           crtStateData_._StateType == (int)StateType.ST_ActionInvalid))
        {
            stateIndex_++;
            ExcuteStateInner();
            return;
        }

        if (isPhysic_ && (crtStateData_._StateType == (int)StateType.ST_MagicAbsorb ||
                          crtStateData_._StateType == (int)StateType.ST_MagicBounce ||
                          crtStateData_._StateType == (int)StateType.ST_MagicInvalid))
        {
            stateIndex_++;
            ExcuteStateInner();
            return;
        }

        //如果不需要播放防御特效 并且这次要播放防御特效 则跳过
        if (notPlayDef_ && (crtStateData_._StateType == (int)StateType.ST_Defense || crtStateData_._StateType == (int)StateType.ST_Shield))
        {
            stateIndex_++;
            ExcuteStateInner();
            return;
        }

        switch (type_)
        {
        case StateInst.ExcuteType.ET_Work:
            if (stateList_[stateIndex_].workingInst_ == null && crtStateData_._WorkPkg.effectId_ != 0)
            {
                EffectAPI.Play((EFFECT_ID)crtStateData_._WorkPkg.effectId_, ActorObj, null, null, null, (EffectInst ei, ParamData pData) =>
                {
                    if (pData.iParam < stateList_.Count)
                    {
                        if (stateList_[pData.iParam].workingInst_ != null)
                        {
                            GameObject.Destroy(stateList_[pData.iParam].workingInst_.gameObject);
                        }
                        stateList_[pData.iParam].workingInst_ = ei;

                        if (renderer_ == null)
                        {
                            renderer_ = GetBody(ActorObj);
                        }

                        if (renderer_ == null)
                        {
                            renderer_ = new SkinnedMeshRenderer[0];
                        }

                        if (renderer_ != null)
                        {
                            for (int i = 0; i < renderer_.Length; ++i)
                            {
                                renderer_[i].material.SetColor("_Color", crtStateData_._WorkPkg.mainColor_);
                                renderer_[i].material.SetColor("_RimColor", crtStateData_._WorkPkg.rimColor_);
                                renderer_[i].material.SetFloat("_RimWidth", crtStateData_._WorkPkg.rimWidth_);
                            }
                        }
                        ExcuteStateInner();
                    }
                    else
                    {
                        ei.DestorySelf();
                    }
                }, new ParamData(stateIndex_));
                stateIndex_++;
            }
            else
            {
                stateIndex_++;
                ExcuteStateInner();
            }
            break;

        case StateInst.ExcuteType.ET_Beattack:
            //如果是闪避且没有hp变化就不触发状态
            if (crtStateData_._StateType == (int)StateType.ST_Dodge && !realDodge_)
            {
            }
            else
            {
                if (crtStateData_._BeattackPkg.effectId_ != 0)
                {
                    EffectAPI.Play((EFFECT_ID)crtStateData_._BeattackPkg.effectId_, ActorObj, null, null, null, (EffectInst ei, ParamData data) =>
                    {
                        ei.transform.parent     = ActorObj.transform;
                        ei.transform.localScale = Vector3.one;
                    });
                }
                if (!string.IsNullOrEmpty(crtStateData_._BeattackPkg.action_))
                {
                    takeDmgAction = crtStateData_._BeattackPkg.action_;
                }
            }
            stateIndex_++;
            ExcuteStateInner();
            break;

        case StateInst.ExcuteType.ET_Action:
            selfActor_ = Battle.Instance.GetActorByInstId(PlayerID);
            // mutiple state in this case would be cause some error. call mutiple times.
            if (crtStateData_._ActionPkg.effectId_ != 0)
            {
                EffectAPI.Play((EFFECT_ID)crtStateData_._ActionPkg.effectId_, ActorObj, null, null, (int iVal) =>
                {
                    ExcuteStateInnerPopVal();
                });
            }
            else if (!string.IsNullOrEmpty(crtStateData_._ActionPkg.action_))
            {
                ExcuteStateInnerPopVal();
            }
            else
            {
                stateIndex_++;
                ExcuteStateInner();
            }
            break;

        default:
            break;
        }
    }
Esempio n. 12
0
    public void Beattack_1(int skillId, int skillLv, bool playAnim = true, bool isDead = false, bool isDodge = false, BattleActor attacker = null, bool playEffect = true)
    {
        //SkillData skill = SkillData.GetData(skillId);
        BattleActor entity = Battle.Instance.GetActorByInstId(PlayerID);

        if (entity == null)
        {
            return;
        }

        if (entity.isDead)
        {
            Reborn();
        }
        else if (skillId == 1031)//崩击
        {
            int effId = GetStateBeattackEffectID(skillId);
            if (effId != -1)
            {
                // 如果是防御特效
                ExcuteState(StateInst.ExcuteType.ET_Beattack, null, null, true);

                //die
                if (isDead)
                {
                    GlobalInstanceFunction.Instance.setTimeScale(Battle.Instance.reportPlaySpeed_ * 0.3f);
                    m_EntityAnimator.Play("Base Layer.beattack02", -1, 0.1f);
                    SetEntityActionTime(0f);
                    XShake shake = ActorObj.GetComponent <XShake>();
                    if (shake != null)
                    {
                        GameObject.Destroy(shake);
                    }
                    shake                         = ActorObj.AddComponent <XShake>();
                    shake.battlePos               = Battle.Instance.GetActorByInstId(PlayerID).BattlePos;
                    shake.originPos_              = ActorObj.transform.position;
                    shake.OnBeattackActionFinish += OnBeattackActionFinish;
                    shake.OnMoveBackActionFinish += OnMoveBackActionFinish;
                    m_bPlayingBeattackAction      = true;
                }
                else
                {
                    if (playAnim)
                    {
                        if (takeDmgAction.Equals(GlobalValue.TTakeDmg))
                        {
                            //if (!m_bPlayingBeattackAction)
                            //{
                            //    m_EntityAnimator.Play("Base Layer.beattack02", -1, 0.1f);
                            SetAnimationParam(takeDmgAction, AnimatorParamType.APT_Trigger);
                            //    m_EntityAnimator.StartRecording(0);
                            //    m_bPlayingBeattackAction = true;
                            //}
                            //else
                            //{
                            //    m_EntityAnimator.StopRecording();
                            //    m_EntityAnimator.StartPlayback();
                            //    m_EntityAnimator.playbackTime = 0f;
                            //    isPlayBack = true;
                            //}
                            //SetEntityActionTime(0);
                            //GlobalInstanceFunction.Instance.Invoke(() =>
                            //{
                            XShake shake = ActorObj.GetComponent <XShake>();
                            if (shake != null)
                            {
                                GameObject.Destroy(shake);
                            }
                            shake = ActorObj.AddComponent <XShake>();
                            shake.OnlyBack();
                            selfActor_                    = Battle.Instance.GetActorByInstId(m_PlayerID);
                            shake.battlePos               = selfActor_.BattlePos;
                            shake.originPos_              = ActorObj.transform.position;//Battle.Instance.GetStagePointByIndex(selfActor_.BattlePos).position;
                            shake.OnBeattackActionFinish += OnBeattackActionFinish;
                            shake.OnMoveBackActionFinish += OnMoveBackActionFinish;
                            //SetEntityActionTime(1);
                            //}, 1);
                        }
                        else
                        {
                            //if (!m_bPlayingBeattackAction)
                            //{
                            SetAnimationParam(takeDmgAction, AnimatorParamType.APT_Trigger);
                            //    m_EntityAnimator.StartRecording(0);
                            //    m_bPlayingBeattackAction = true;
                            //}
                            //else
                            //{
                            //    m_EntityAnimator.StopRecording();
                            //    m_EntityAnimator.StartPlayback();
                            //    m_EntityAnimator.playbackTime = 0f;
                            //    isPlayBack = true;
                            //}
                        }
                    }
                }
            }
            else
            {
                m_bPlayingBeattackAction = false;
                EffectAPI.PlaySceneEffect(EFFECT_ID.EFFECT_BengjiMiss, Vector3.zero, ActorObj.transform, null, true);
            }
        }
        else if (/*skill != null &&*/ skillId != 2391 /*复活技能不调用受击动作*/)
        {
            if (playEffect)
            {
                int effId = GetStateBeattackEffectID(skillId);
                if (effId != -1)
                {
                    SkillData skilldata = null;
                    if (attacker != null)
                    {
                        skilldata = SkillData.GetData(skillId, skillLv);
                        if (skilldata != null)
                        {
                            //如果该闪避但没有闪避状态 强制闪避一下。。。
                            if (isDodge && !HasState(StateType.ST_Dodge))
                            {
                                if (crtStateData_._BeattackPkg.effectId_ != 0)
                                {
                                    EffectAPI.Play(EFFECT_ID.EFFECT_DODGE, ActorObj, null, null, null, (EffectInst ei, ParamData data) =>
                                    {
                                        ei.transform.parent     = ActorObj.transform;
                                        ei.transform.localScale = Vector3.one;
                                    });
                                }
                            }
                            ExcuteState(StateInst.ExcuteType.ET_Beattack, null, null, skilldata._IsPhysic, isDodge);
                            takeDmgAction = GlobalValue.TDodge;
                        }
                    }
                }
            }

            //die
            if (isDead)
            {
                GlobalInstanceFunction.Instance.setTimeScale(Battle.Instance.reportPlaySpeed_ * 0.7f);
                m_EntityAnimator.Play("Base Layer.beattack02", -1, 0.1f);
                SetEntityActionTime(0f);
                XShake shake = ActorObj.GetComponent <XShake>();
                if (shake != null)
                {
                    GameObject.Destroy(shake);
                }
                shake                         = ActorObj.AddComponent <XShake>();
                shake.battlePos               = Battle.Instance.GetActorByInstId(PlayerID).BattlePos;
                shake.originPos_              = ActorObj.transform.position;
                shake.OnBeattackActionFinish += OnBeattackActionFinish;
                shake.OnMoveBackActionFinish += OnMoveBackActionFinish;
                m_bPlayingBeattackAction      = true;
            }
            else
            {
                if (playAnim)
                {
                    if (takeDmgAction.Equals(GlobalValue.TTakeDmg))
                    {
                        //if (!m_bPlayingBeattackAction)
                        //{
                        SetAnimationParam(takeDmgAction, AnimatorParamType.APT_Trigger);
                        //m_EntityAnimator.StartRecording(0);
                        //m_bPlayingBeattackAction = true;
                        //}
                        //else
                        //{
                        //    m_EntityAnimator.StopRecording();
                        //    m_EntityAnimator.StartPlayback();
                        //    m_EntityAnimator.playbackTime = 0f;
                        //    isPlayBack = true;
                        //}
                        //SetEntityActionTime(0);
                        //GlobalInstanceFunction.Instance.Invoke(() =>
                        //{
                        XShake shake = ActorObj.GetComponent <XShake>();
                        if (shake != null)
                        {
                            GameObject.Destroy(shake);
                        }
                        shake = ActorObj.AddComponent <XShake>();
                        shake.OnlyBack();
                        selfActor_                    = Battle.Instance.GetActorByInstId(m_PlayerID);
                        shake.battlePos               = selfActor_.BattlePos;
                        shake.originPos_              = ActorObj.transform.position;//Battle.Instance.GetStagePointByIndex(selfActor_.BattlePos).position;
                        shake.OnBeattackActionFinish += OnBeattackActionFinish;
                        shake.OnMoveBackActionFinish += OnMoveBackActionFinish;
                        //SetEntityActionTime(1);
                        //}, 1);
                    }
                    else
                    {
                        //if (!m_bPlayingBeattackAction)
                        //{
                        SetAnimationParam(takeDmgAction, AnimatorParamType.APT_Trigger);
                        //    m_EntityAnimator.StartRecording(0);
                        //    m_bPlayingBeattackAction = true;
                        //}
                        //else
                        //{
                        //    m_EntityAnimator.StopRecording();
                        //    m_EntityAnimator.StartPlayback();
                        //    m_EntityAnimator.playbackTime = 0f;
                        //    isPlayBack = true;
                        //}
                    }
                }
            }
        }
        takeDmgAction = GlobalValue.TTakeDmg;
    }
Esempio n. 13
0
    public void Catch(COM_ReportAction action, CatchCallBack callback)
    {
        callBack_ = callback;
        aim_      = Battle.Instance.GetActorByIdx(action.target_);
        master_   = Battle.Instance.GetActorByInstId(action.casterId_);

        if (aim_ == null)
        {
            return;
        }

        if (master_ == null)
        {
            return;
        }

        master_.ControlEntity.SetAnimationParam(GlobalValue.TCast, AnimatorParamType.APT_Trigger);
        EFFECT_ID id = (EFFECT_ID)SkillData.GetMinxiLevelData(action.skill_)._Cast_effectID;

        if (aim_.ControlEntity == null || aim_.ControlEntity.ActorObj == null)
        {
            return;
        }

        EffectAPI.Play(id, aim_.ControlEntity.ActorObj);
        GlobalInstanceFunction.Instance.ScaleLerp(aim_.ControlEntity.ActorObj.transform, 1f, 0.3f, 0.5f, () =>
        {
            if (aim_.ControlEntity == null || aim_.ControlEntity.ActorObj == null)
            {
                return;
            }
            GlobalInstanceFunction.Instance.ScaleLerp(aim_.ControlEntity.ActorObj.transform, 0.3f, 1f, 0.5f, () =>
            {
                if (aim_.ControlEntity == null || aim_.ControlEntity.ActorObj == null)
                {
                    return;
                }
                GlobalInstanceFunction.Instance.ScaleLerp(aim_.ControlEntity.ActorObj.transform, 1f, 0.3f, 0.5f, () =>
                {
                    if (aim_.ControlEntity == null || aim_.ControlEntity.ActorObj == null)
                    {
                        return;
                    }
                    GlobalInstanceFunction.Instance.ScaleLerp(aim_.ControlEntity.ActorObj.transform, 0.3f, 1f, 0.5f, () =>
                    {
                        if (aim_.ControlEntity == null || aim_.ControlEntity.ActorObj == null)
                        {
                            return;
                        }
                        if (action.zhuachongOk_)
                        {
                            if (aim_.ControlEntity == null || aim_.ControlEntity.ActorObj == null)
                            {
                                return;
                            }
                            GlobalInstanceFunction.Instance.ScaleLerp(aim_.ControlEntity.ActorObj.transform, 1f, 0f, 0.5f, () =>
                            {
                                Transform pos = Battle.Instance.GetStagePointByIndex(aim_.BattlePos);
                                if (pos == null)
                                {
                                    return;
                                }
                                EffectAPI.PlaySceneEffect(EFFECT_ID.EFFECT_Fengyinchenggong, Vector3.zero, pos, null, true);
                                Battle.Instance.DeleteBattleEntityItem(aim_.InstId);
                                Battle.Instance.DeleteDeadEntity(aim_.InstId);
                                GlobalInstanceFunction.Instance.Invoke(() =>
                                {
                                    if (callBack_ != null)
                                    {
                                        callBack_();
                                    }
                                }, 1f);
                            });
                        }
                        else
                        {
                            if (callBack_ != null)
                            {
                                callBack_();
                            }
                        }
                    });
                });
            });
        });
    }
Esempio n. 14
0
    void HitMotion_1(int idx)
    {
        if (idx == -1)
        {
            return;
        }

        if (isMelee_)
        {
            if (prop_.prop2_.Length != 0)
            {
                COM_ReportTargetBase prop = prop_.prop2_[0];
                int chageVal = 0;
                switch (prop.prop_.type_)
                {
                case PropertyType.PT_HpCurr:
                    chageVal = (int)prop.prop_.value_ - aim_.battlePlayer.hpCrt_;
                    break;

                case PropertyType.PT_MpCurr:
                    chageVal = (int)prop.prop_.value_ - aim_.battlePlayer.mpCrt_;
                    break;
                }
                aim_.ControlEntity.Beattack_1(crt_data_._Id, crt_data_._Level, hasWuxiaoBuff(aim_), false, false, caster_);
                //反弹伤害不播受击
                caster_.ControlEntity.Beattack_1(crt_data_._Id, crt_data_._Level, false, false, chageVal == 0, null, false);
                //caster_.ControlEntity.UpdateStateTick();
            }
            else
            {
                COM_ReportTarget prop = prop_;
                int chageVal          = 0;
                switch (prop.prop_.type_)
                {
                case PropertyType.PT_HpCurr:
                    chageVal = (int)prop.prop_.value_ - aim_.battlePlayer.hpCrt_;
                    break;

                case PropertyType.PT_MpCurr:
                    chageVal = (int)prop.prop_.value_ - aim_.battlePlayer.mpCrt_;
                    break;
                }
                aim_.ControlEntity.LookAt(caster_.ControlEntity.ActorObj);
                bool hasWuxiao = hasWuxiaoBuff(aim_);
                if (hasWuxiao == false)
                {
                    hasWuxiao = (chageVal > 0);
                }
                if (prop.prop_.type_ == PropertyType.PT_HpCurr)
                {
                    aim_.ControlEntity.Beattack_1(crt_data_._Id, crt_data_._Level, !hasWuxiao, (aim_.battlePlayer.hpCrt_ + chageVal) <= 0, chageVal == 0, caster_);
                }
                else if (prop.prop_.type_ == PropertyType.PT_MpCurr)
                {
                    aim_.ControlEntity.Beattack_1(crt_data_._Id, crt_data_._Level, !hasWuxiao, false, false, caster_);
                }
                //aim_.ControlEntity.UpdateStateTick();
            }
        }
        else
        {
            if (props_[idx].prop2_.Length != 0)
            {
                if (effectInsts_.ContainsKey(idx))
                {
                    effectInsts_[idx].DestorySelf();
                }
                aims_[idx].ControlEntity.Beattack_1(crt_data_._Id, crt_data_._Level, hasWuxiaoBuff(aims_[idx]), false, false, caster_);
                Vector3 casterPos = aims_[idx].ControlEntity.ActorObj.transform.position;
                Vector3 aim       = caster_.ControlEntity.ActorObj.transform.position;
                EffectAPI.Play((EFFECT_ID)crt_data_._EffectID, casterPos, new Vector3[] { aim }, GetPack(RangeAntiHit, null, null, RangeAntiPop), ActionOver, SaveEffectInst, new ParamData(idx));
            }
            else
            {
                COM_PropValue prop     = props_[idx].prop_;
                int           chageVal = 0;
                switch (prop.type_)
                {
                case PropertyType.PT_HpCurr:
                    chageVal = (int)prop.value_ - aims_[idx].battlePlayer.hpCrt_;
                    break;

                case PropertyType.PT_MpCurr:
                    chageVal = (int)prop.value_ - aims_[idx].battlePlayer.mpCrt_;
                    break;
                }
                aims_[idx].ControlEntity.LookAt(caster_.ControlEntity.ActorObj);
                bool hasWuxiao = hasWuxiaoBuff(aims_[idx]);
                if (hasWuxiao == false)
                {
                    hasWuxiao = (chageVal > 0);
                }
                aims_[idx].ControlEntity.Beattack_1(crt_data_._Id, crt_data_._Level, !hasWuxiao, aims_[idx].battlePlayer.hpCrt_ + chageVal <= 0f, chageVal == 0, caster_);
                //aims_[idx].ControlEntity.UpdateStateTick();
            }
        }
    }
Esempio n. 15
0
    public void Cast(int skillId, int skillLv, BattleActor caster, BattleActor[] aims, COM_ReportTarget[] propertyVals, FinishCallBack finCallback, AttackFinishCallBack attackfinishCallback = null, bool realAimPos = false)
    {
        GlobalInstanceFunction.Instance.openTimer_    = true;
        GlobalInstanceFunction.Instance.deadTimer_    = 0f;
        GlobalInstanceFunction.Instance.OnDeadFinish += OnDealDeadFinish;
        if (crt_data_ != null)
        {
            ClientLog.Instance.LogError("a skill is casting");
            return;
        }

        effectInsts_ = new Dictionary <int, EffectInst> ();

        crt_data_ = SkillData.GetData(skillId, skillLv);

        if (crt_data_ == null)
        {
            ClientLog.Instance.LogError("skill id :" + skillId + "has not data");
            return;
        }

        realAimPos_ = realAimPos;
        if (caster.InstId == GamePlayer.Instance.InstId || TeamSystem.isTeamMember(caster.InstId))
        {
            AttaclPanel.Instance.SetSkillIcon(skillId, skillLv, caster.AssetId);
            //caster.ControlEntity.PlayerInfoUI.GetComponent<Roleui>().ShowSkill(crt_data_.singEffectId_, caster.SkillNamePos());
        }

        isPhysic_ = crt_data_._IsPhysic;
        if (isPhysic_)
        {
            if (caster.battlePlayer.weaponItemId_ != 0)
            {
                isMelee_ = !caster.rangeWeapon();
            }
            else
            {
                isMelee_ = crt_data_._IsMelee;
            }
        }
        else
        {
            isMelee_ = crt_data_._IsMelee;
        }

        Transform t = Battle.Instance.GetStagePointByIndex(caster.BattlePos);

        if (t == null)
        {
            return;
        }
        caster_                  = caster;
        aims_                    = TrimNull(aims);
        props_                   = propertyVals;
        originObj_               = t.gameObject;
        finish_call_back_        = finCallback;
        attack_finish_call_back_ = attackfinishCallback;
        //caster_.ResetPos();
        Battle.Instance.ResetActorDirection();

        aimsQue_ = new Queue <BattleActor>();
        propQue_ = new Queue <COM_ReportTarget>();
        for (int i = 0; i < aims_.Length; ++i)
        {
            if (aims_[i] == null)
            {
                continue;
            }
            aimsQue_.Enqueue(aims_[i]);
            propQue_.Enqueue(props_[i]);
        }

        if (isMelee_)
        {
            caster_.attackAnim_ = caster_.GetWeaponAction() + GlobalValue.TAttack;
        }
        else
        {
            if (isPhysic_)
            {
                caster_.castAnim_ = caster_.GetWeaponAction() + GlobalValue.TCast;
            }
            else
            {
                caster_.castAnim_ = GlobalValue.TCast;
            }
        }

        caster.battlePlayer.mpCrt_ -= crt_data_._Cost_mana;

        if (caster.InstId == GamePlayer.Instance.InstId)
        {
            AttaclPanel.Instance.ChangeValue(PropertyType.PT_MpCurr, crt_data_._Cost_mana * -1, caster.battlePlayer.hpMax_, caster.battlePlayer.mpMax_);
            ScrollViewPanel.curMp = caster.battlePlayer.mpCrt_;
        }

        if (Battle.Instance.SelfActorBattleBaby != null)
        {
            if (caster.InstId == Battle.Instance.SelfActorBattleBaby.InstId)
            {
                AttaclPanel.Instance.ChangeValueBaby(PropertyType.PT_MpCurr, crt_data_._Cost_mana * -1, caster.battlePlayer.hpMax_, caster.battlePlayer.mpMax_);
            }
        }

        if (caster.ControlEntity.PlayerInfoUI != null &&
            caster.ControlEntity.PlayerInfoUI.GetComponent <Roleui>() != null)
        {
            Roleui roleinfoUI = caster.ControlEntity.PlayerInfoUI.GetComponent <Roleui>();
            roleinfoUI.ValueChange(PropertyType.PT_MpCurr, crt_data_._Cost_mana * -1, caster.battlePlayer.hpMax_, caster.battlePlayer.mpMax_, false);
        }

        //EffectAPI.Load (() => {
        //    if (crt_data_._Cast_effectID != -1)
        //        EffectAPI.Play((EFFECT_ID)crt_data_._Cast_effectID, caster_.ControlEntity.ActorObj, null, null, AfterCastEffect);
        //    else
        //        AfterCastEffect();
        //}, crt_data_._EffectID, crt_data_._Cast_effectID, crt_data_._Cast_effectID);
        if (crt_data_._Cast_effectID != -1)
        {
            EffectAPI.Play((EFFECT_ID)crt_data_._Cast_effectID, caster_.ControlEntity.ActorObj, null, null, AfterCastEffect);
        }
        else
        {
            AfterCastEffect();
        }
    }