Exemplo n.º 1
0
        public override void OnEnter(ActorObj actor)
        {
            if (null == actor)
            {
                return;
            }

            m_actor = actor;
            m_actor.GetDownHorse();
            m_actor.PlayAction("open");
            CancelInvoke("AutoExitState");
            float lastTime = m_actor.GetActionLength("open");

            Invoke("AutoExitState", lastTime);
        }
Exemplo n.º 2
0
        //private GameObject m_cylinderObj = null;

        public override void OnEnter(ActorObj actorBase)
        {
            m_state = ACTOR_STATE.AS_FIT;

            m_actor = actorBase;
            //策划不配,硬代码
            string enterAction = "fit";


            float endTime = m_actor.GetActionLength(enterAction);

            if (enterAction == "stand")
            {
                endTime = 0.5f;
            }


            if (endTime == 0)
            {
                endTime = 0.5f;
            }


            m_actor.PlayAction(enterAction, false);



            //无敌状态,受击没反映
            float immuneTime = endTime;

            //if (m_actor.actorCreatureDisplayDesc.enterImmuneKeepTime > 0)
            //{
            //    immuneTime = m_actor.actorCreatureDisplayDesc.enterImmuneKeepTime;
            //}
            m_actor.RecoverHealth(immuneTime);

            //硬直状态,自己不能切换状态
            m_isNonControl = true;

            Invoke("EndEnterState", endTime);

            //去掉碰撞
            m_actor.CancelCollider();
        }
Exemplo n.º 3
0
 private IEnumerator DoRevive(ActorObj actor)
 {
     actor.ForceToRebirth();
     yield return new WaitForSeconds(actor.GetActionLength("rebirth"));
 }
Exemplo n.º 4
0
        public override void OnEnter(ActorObj actorBase)
        {
            m_state      = ACTOR_STATE.AS_DEATH;
            m_isDeathEnd = false;

            m_actor = actorBase;

            // 直接设置当前血量
            m_actor.mBaseAttr.CurHP = 0;
            if (actorBase.Health != null)
            {
                actorBase.Health.OnDead();
            }

            // 停止移动 , 停止当前动作
            m_actor.StopMove(false);
            m_actor.StopAll();


            if (m_actor.m_bNoDieAction)
            {
                m_dieAction = "stand";  //召唤生物不播放死亡动作
            }
            else
            {
                m_dieAction = "die001";
            }


            LuaTable skillDesc = ConfigManager.Instance.Skill.GetSkillConfig(CurParam.skillID);

            //使用击飞死亡
            if (m_actor.IsHadAction("die002") && null != skillDesc)
            {
                string knockStr = skillDesc.Get <string>("knockback");
                if (!string.IsNullOrEmpty(knockStr))
                {
                    string[] knockValues = knockStr.Split('#');
                    float    pValue      = Random.Range(0f, 1.0f);
                    float    pro         = 0f;
                    float.TryParse(knockValues[0], out pro);
                    if (pValue * 100 <= pro)
                    {
                        float minDistance = 0f;
                        float maxDistance = 0f;
                        float.TryParse(knockValues[1], out minDistance);
                        float.TryParse(knockValues[2], out maxDistance);

                        m_dieAction = "die002";
                        m_actor.DobehitedFly(m_dieAction, Random.Range(minDistance, maxDistance), CurParam.AttackActor);
                    }
                }
            }

            Invoke("PlayDieSound", 1.8f);

            //死亡的时候在空中
            if (m_actor.mActorType == ActorType.AT_LOCAL_PLAYER ||
                !m_actor.isHaveRigidbody)
            {
                if (m_actor.m_gravityMotionBase != null && m_actor.m_gravityMotionBase.isUseGravityState)
                {
                    m_actor.SetPosition(BaseTool.instance.GetGroundPoint(m_actor.transform.position));
                }
            }

            //monster10秒后,消失
            if (m_actor.mActorType == ActorType.AT_MONSTER || m_actor.mActorType == ActorType.AT_BOSS ||
                m_actor.mActorType == ActorType.AT_NPC || m_actor.mActorType == ActorType.AT_BROKED ||
                m_actor.mActorType == ActorType.AT_NON_ATTACK || m_actor.mActorType == ActorType.AT_AVATAR ||
                m_actor.mActorType == ActorType.AT_MECHANICS ||
                m_actor.m_bNoDieAction)
            {
                EventParameter param = EventParameter.Get();
                param.autoRecycle   = false;
                param.intParameter  = m_actor.EntityID;
                param.intParameter1 = m_actor.resid;
                param.intParameter2 = m_actor.ConfigID;
                param.goParameter   = m_actor.GetOwnObject();
                if (m_actor.m_bSummonMonster)
                {
                    m_actor.gEventMgr.TriggerEvent(GameEvent.GE_SUMMON_DEATH, param);
                }
                else
                {
                    m_actor.gEventMgr.TriggerEvent(GameEvent.GE_MONSTER_DEATH, param);
                    if (m_actor.mActorType != ActorType.AT_BOSS)
                    {
                        bool sendTaskMsg = true;
                        if (sendTaskMsg)
                        {
                            m_actor.gEventMgr.TriggerEvent(GameEvent.GE_TASK_KILL_MONSTER, param);
                        }
                    }
                }
                EventParameter.Cache(param);

                if (m_actor.isHaveRigidbody)
                {
                    m_beginDeathTime = Time.time;

                    //自身阻挡去掉
                    this.gameObject.GetComponent <Collider>().enabled = false;
                }
                else
                {
                    //有可能是死亡特效
                    int nRand      = Random.Range(0, 5);
                    int bDieBroken = 0;// m_actor.actorCreatureDisplayDesc.DieBroken;
                    if (m_actor.m_bNoDieAction)
                    {
                        //分身消失特效
                        this.gameObject.SetActive(false);

                        Object efobj = CoreEntry.gResLoader.LoadResource("Effect/skill/remain/fx_fenshen");
                        if (efobj != null)
                        {
                            m_efxObj = Instantiate(efobj) as GameObject;

                            m_efxObj.transform.position = m_actor.transform.position;
                        }
                        m_actor.PlayAction(m_dieAction);
                        m_actor.GetActionLength(m_dieAction);
                        Invoke("AutoDestoryBody", 1.5f);
                    }
                    else
                    if (bDieBroken == 1 && nRand == 1 && m_actor.mActorType != ActorType.AT_BOSS)
                    {
                        //隐藏模型
                        this.gameObject.SetActive(false);
                        m_efxObj = Instantiate(CoreEntry.gResLoader.LoadResource("Effect/skill/hurt/fx_roukuai")) as GameObject;
                        if (m_efxObj != null)
                        {
                            m_efxObj.transform.position = m_actor.transform.position;
                            m_actor.PlayAction(m_dieAction);
                            Invoke("AutoDestoryBody", 1.5f);
                        }
                    }
                    else
                    {
                        if (m_actor.m_bSummonMonster == false)
                        {
                            m_actor.PlayAction(m_dieAction);

                            float dieTime = m_actor.GetActionLength(m_dieAction);
                            Invoke("AutoDestory", m_actor.BodyKeepTime + dieTime);
                        }
                        else
                        {
                            AutoDestory();
                        }
                    }


                    //去掉碰撞
                    m_actor.CancelCollider();
                }

                //if (m_actor.mActorType == ActorType.AT_BOSS)
                //{
                //    //boss死亡 by lzp
                //    //CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_TASK_KILLBOSS, null);
                //    //boss,慢镜头
                //    //Time.timeScale = 0.1f;
                //    CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_TASK_STOPTASKTIME, null);

                //    if (CoreEntry.GameEffectMgr.BossDeadEffect_PlayAction != null)
                //    {
                //        CoreEntry.GameEffectMgr.BossDeadEffect_PlayAction.SetBoss(gameObject);
                //    }

                //    CoreEntry.GameEffectMgr.BossDeadEffect.GameObj.SetActive(true);

                //    //if (TimeScaleCore.SetValue(0.2f))
                //    {
                //        Invoke("TimeScaleEnd", CoreEntry.GameEffectMgr.BossDeadEffect.Length);
                //        //由于有个动画时长可能大于原来的单一的死亡动作时长,所以这里重新设置一下,用整个动画的时长
                //        CancelInvoke("AutoDestory");
                //        Invoke("AutoDestory", m_actor.GetDeathDuration());
                //    }

                //}

                //区别敌方阵营
                if (m_actor.TeamType == 3)
                {
                    //怪物死忙 by lzp
                    CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_TASK_KILLNUM, null);
                }

                //死亡后,动作阻挡去掉
                //if (m_actor.actorCreatureDisplayDesc.iIsStaticMonster == 1)
                {
                    NavMeshObstacle[] navMeshObstacles = this.gameObject.GetComponentsInChildren <NavMeshObstacle>();
                    for (int i = 0; i < navMeshObstacles.Length; i++)
                    {
                        navMeshObstacles[i].enabled = false;
                    }
                }

                m_actor.HideBlobShadow();

                float aniTime       = m_actor.GetActionLength(m_dieAction);
                float downDelayTime = ConfigManager.Instance.Consts.GetValue <float>(428, "fval");
                Invoke("DelayHideModle", aniTime + downDelayTime);
            }
            else if (m_actor.mActorType == ActorType.AT_LOCAL_PLAYER)
            {
                float dieTime = m_actor.GetActionLength(m_dieAction);
                Invoke("PlayerDeathEventDelay", dieTime);
                //主角死亡通知 by lzp
                CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_TASK_HERONUM, null);


                m_actor.PlayAction(m_dieAction);
                m_isDeathEnd = true;
            }
            else if (m_actor.mActorType == ActorType.AT_PVP_PLAYER ||
                     m_actor.mActorType == ActorType.AT_REMOTE_PLAYER)
            {
                float dieTime = m_actor.GetActionLength(m_dieAction);
                Invoke("PlayerDeathEventDelay", dieTime);

                //主角死亡通知 by lzp
                CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_TASK_HERONUM, null);

                m_actor.PlayAction(m_dieAction);

                m_isDeathEnd = true;
            }

            //Buff by yuxj
            m_actor.BuffOnDie();
            //召唤物杀死
            SummonCell.OnSummonKillAll(m_actor);
        }
Exemplo n.º 5
0
        //释放技能
        void CastSkill()
        {
            CancelInvoke("CastSkill");
            CancelInvoke("AutoLookatTarget");

            // 如果不是激活状态不往下运行
            if (!gameObject.activeInHierarchy)
            {
                return;
            }

            //释放吟唱阶段的动作特效
            SendEvent(SkillCellEventType.SE_DESTROY_ACTION_EFX, null);

            //销毁吟唱阶段数据
            DestroyEfx();

            //播放动作,特效,声音
            SkillPlayParam param        = new SkillPlayParam();
            LuaTable       skill_action = CoreEntry.gSkillMgr.GetSkillActon(m_skillID);

            if (skill_action == null)
            {
                Debug.LogError("skill_action is null...m_skillID = " + m_skillID);
                return;
            }
            if (skill_action != null)
            {
                param.action = skill_action.Get <string>("animation");

                param.actionEfx = skill_action.Get <string>("skilleffect");

                param.startTime = m_startPlayTimeSet;
                param.speed     = m_speed;

                param.remainEfx = skill_action.Get <string>("remain");
            }

            //播放声音
            string sound1 = "";
            string sound2 = "";

            AudioCore.GenerateAudio(m_skillDesc.Get <int>("sound_id"), ref sound1);
            AudioCore.GenerateAudio(m_skillDesc.Get <int>("talk_sound_id"), ref sound2);

            param.sound = sound1;
            param.voice = sound2;

            StartCoroutine(PlayActionEfxSound(param, skill_action.Get <float>("skillEfxDelay")));

            //技能元素
            SkillClassDisplayDesc skillClass = m_gameDBMgr.GetSkillClassDisplayDesc(m_skillDesc.Get <int>("skillDisplayID"));

            if (skillClass == null)
            {
                Debug.LogError("===skillClass== is null===");
                return;
            }
            bool isLocal = false;

            if (m_actor is PlayerObj || m_actor is PetObj)
            {
                isLocal = true;
            }
            for (int i = 0; i < skillClass.castStageDataList.Count; ++i)
            {
                if (null != m_actor && !isLocal)
                {
                    if (skillClass.castStageDataList[i] is MovePosAttackDesc)
                    {
                        continue;
                    }
                }

                GameObject cellObj = CoreEntry.gGameObjPoolMgr.InstantiateSkillCell(skillClass.castStageDataList[i].prefabPath);
                cellObj.transform.parent = transform;

                ISkillCell skillCell = cellObj.GetComponent <ISkillCell>();

                skillCell.Init(skillClass.castStageDataList[i], this);
                skillCell.SetAoeState(m_bIsAoe);

                CheckSkillCell(skillCell);
                AddSkillCell(cellObj);
            }

            //技能结束时间
            if (m_skillDesc.Get <int>("skill_end") > 0)
            {
                m_overTime = (m_skillDesc.Get <int>("skill_end") / 1000f - m_startPlayTimeSet) / m_speed;
            }
            else
            {
                m_overTime = (m_actor.GetActionLength(m_strActionName) - m_startPlayTimeSet) / m_speed;
            }

            //如果是不可打破机能,释放出后恢复动作
            if (canBeBroke == false)
            {
                float time = (m_actor.GetActionLength(m_strActionName) - m_startPlayTimeSet) / m_speed;
                CancelInvoke("SkillAnimationIsOver");
                Invoke("SkillAnimationIsOver", time);
            }
            LogMgr.UnityLog("overtime=" + m_overTime + ", skillid=" + m_skillID);

            //技能结束
            Invoke("SkillEnd", m_overTime);
        }
Exemplo n.º 6
0
        //private GameObject m_cylinderObj = null;

        public override void OnEnter(ActorObj actorBase)
        {
            m_state = ACTOR_STATE.AS_ENTER;

            m_actor = actorBase;

            string enterAction = m_actor.enterAction;


            ////删除挂点
            //Transform cylinderTransform = this.gameObject.transform.FindChild("Cylinder002");
            //if (cylinderTransform != null)
            //{
            //    m_cylinderObj = cylinderTransform.gameObject;
            //    m_cylinderObj.active = true;
            //}

            float endTime = m_actor.GetActionLength(enterAction);

            //if (endTime > 0.5f)
            //{
            //    endTime = endTime - 0.2f;
            //}


            if (enterAction == "stand")
            {
                endTime = 0.5f;
            }


            if (endTime == 0)
            {
                endTime = 0.5f;
            }


            m_actor.PlayAction(enterAction, false);

            //播放特效
            string enterEfx = "";// m_actor.actorCreatureDisplayDesc.enterEfx;

            if (CoreEntry.IsMobaGamePlay() == false && enterEfx != "")
            {
                if (m_actor.mActorType == ActorType.AT_MONSTER || m_actor.mActorType == ActorType.AT_MECHANICS)
                {
                    enterEfx = "Effect/skill/remain/fx_xiaobingchuxian01";
                }
                if (m_actor.mActorType == ActorType.AT_BOSS)
                {
                    enterEfx = "Effect/skill/remain/fx_bosschuxian";
                }

                if (enterEfx.Length > 0)
                {
                    GameObject efxObj = CoreEntry.gGameObjPoolMgr.InstantiateEffect(enterEfx);
                    //GameObject efxObj = (GameObject)Instantiate(CoreEntry.gResLoader.LoadResource(enterEfx));//CoreEntry.gGameObjPoolMgr.InstantiateEffect(enterEfx);
                    if (efxObj != null)
                    {
                        SceneEfxPool efx = null;
                        if (efxObj)
                        {
                            efx = efxObj.GetComponent <SceneEfxPool>();
                        }
                        if (efx == null)
                        {
                            efx = efxObj.AddComponent <SceneEfxPool>();
                        }
                        efx.Init(m_actor.transform.position, endTime);
                    }
                }
            }



            //无敌状态,受击没反映
            float immuneTime = endTime;

            //if (m_actor.actorCreatureDisplayDesc.enterImmuneKeepTime > 0)
            //{
            //    immuneTime = m_actor.actorCreatureDisplayDesc.enterImmuneKeepTime;
            //}
            m_actor.RecoverHealth(immuneTime);

            //硬直状态,自己不能切换状态
            m_isNonControl = true;

            Invoke("EndEnterState", endTime);

            //去掉碰撞
            m_actor.CancelCollider();
        }
Exemplo n.º 7
0
        //浮空受击
        public void DoBehit()
        {
            //浮空状态不能释放技能
            m_BehitState.isNonControl = true;

            //离地面高度
            float height = GetHeightToGround();

            if (height <= 0.1f)
            {
                return;
            }

            if (nCount > 2)
            {
                m_actor.StopAll();
                string clipName = "hit006";
                m_actor.PlayAction(clipName);

                m_actor.SetActionSpeed(clipName, 2f);

                m_actor.UseCurveData1(clipName, 2.5f);

                m_isUseGravity = false;
                //  ExitBehitState();

                if (!m_actor.IsHadAction(clipName))
                {
                    Vector3    vCurPos = m_actor.transform.position;
                    RaycastHit curHit;
                    //强拉到地面
                    if (Physics.Raycast(vCurPos, -Vector3.up, out curHit, 10, m_groundLayerMask))
                    {
                        vCurPos.y = curHit.point.y;
                    }

                    BaseTool.SetPosition(m_transform, vCurPos);
                }


                float actionLen = m_actor.GetActionLength(clipName);
                Invoke("ExitBehitState", actionLen);
                nCount = 0;
                return;
            }

            nCount++;

            m_behitParame = m_actor.damageBebitParam;

            int skillID = m_behitParame.damgageInfo.skillID;

            //ActorObj m_hitActorBase = m_behitParame.damgageInfo.attackActor;

            //只处理带位移的普通技能
            //LuaTable skillDesc = m_hitActorBase.GetCurSkillDesc(skillID);
            char bodyType = (char)m_actor.BodyType;

            int weight = 1;

            //技能力度纠正
            if (m_behitParame.damgageInfo.weight > 0)
            {
                weight = m_behitParame.damgageInfo.weight;
                LogMgr.UnityLog("Gravity dobehit skillid=" + skillID + ", reset weight=" + weight);
            }

            //获取技能受击反馈
            SkillBehitDisplayDesc behitDisplay = m_gameDataBase.GetSkillBehitDisplayDesc(weight, bodyType);

            if (behitDisplay == null)
            {
                return;
            }

            //没有硬直,定格,没有位移
            if (!behitDisplay.isNonControl)
            {
                return;
            }

            //带位移
            float moveDistance = 0;

            //动作
            if (behitDisplay.behitType == BehitType.BT_NORMAL)
            {
                //普通受击
                // moveDistance = skillDesc.hitMoveDistance;
                moveDistance = 0.2f;
            }
            else if (behitDisplay.behitType == BehitType.BT_HITBACK)
            {
                //美术位移
                if (!m_behitParame.damgageInfo.isNotUseCurveMove)
                {
                    string clipName = behitDisplay.actionList[0];
                    moveDistance = m_actor.GetAnimationCurveLength(clipName);

                    //LogMgr.UnityLog("moveDistance=" + moveDistance + ", clipName=" + clipName);
                }
            }
            else if (behitDisplay.behitType == BehitType.BT_HITDOWN)
            {
                m_actor.StopAll();
                string clipName = behitDisplay.actionList[0];
                m_actor.PlayAction(clipName);
                m_actor.UseCurveData1(clipName, 2.5f);

                m_isUseGravity = false;
                //  ExitBehitState();

                if (!m_actor.IsHadAction(clipName))
                {
                    Vector3    vCurPos = m_actor.transform.position;
                    RaycastHit curHit;
                    //强拉到地面
                    if (Physics.Raycast(vCurPos, -Vector3.up, out curHit, 10, m_groundLayerMask))
                    {
                        vCurPos.y = curHit.point.y;
                    }

                    BaseTool.SetPosition(m_transform, vCurPos);
                }


                float actionLen = m_actor.GetActionLength(clipName);
                Invoke("ExitBehitState", actionLen);

                return;
            }


            else if (behitDisplay.behitType == BehitType.BT_HITSKY)
            {
                //浮空追击
                CancelInvoke("MoveDistanceEnd");
                CancelInvoke("AutoCancelStatic");

                F_ACCE = 0;
                //  SetOriginV(skillDesc.hitSkyOriginV, skillDesc.hitSkyAngle);

                m_actor.StopAll();
                m_actor.PlayAction("hit013", false);
                return;
            }

            //LogMgr.UnityLog("moveDistance=" + moveDistance);


            if (height < 0.5f)
            {
                return;
            }


            //没有位移
            if (moveDistance <= 0.001)
            {
                //F_ACCE = G_ACCE;
                SetOriginV(1, 90);
                m_actor.StopAll();
                m_actor.PlayAction("hit013", false);
            }
            else
            {
                //当前的高度
                SetOriginV(3, 75);
                m_actor.StopAll();
                m_actor.PlayAction("hit013", false);
            }
        }