Esempio n. 1
0
        // 进入状态
        public override void Enter(object param)
        {
            IEntity target = skillPart.GetSkillTarget();

            // 只有主角会进入战斗状态
            if (skillPart.GetSkillPartType() == SkillPartType.SKILL_PLAYERPART && EntitySystem.EntityHelper.IsMainPlayer(skillPart.GetMaster()))
            {
                PlayerSkillPart playerSkill = skillPart as PlayerSkillPart;
                if (playerSkill != null)
                {
                    playerSkill.SkillStartPlayTime = Time.realtimeSinceStartup;
                    playerSkill.SetFighting(true);
                }
            }
            SkillDatabase skilltable = skillPart.GetCurSkillDataBase();

            if (skilltable == null)
            {
                return;
            }
            // 朝向目标
            if (target != null)
            {
                if (skilltable.targetType != (int)SkillTargetType.TargetForwardPoint)
                {
                    skillPart.GetMaster().SendMessage(EntityMessage.EntityCommand_LookTarget, target.GetPos());
                }
            }

            database = skilltable;
            //准备时间结束 发送结束消息
            if (SkillSystem.GetClientGlobal().IsMainPlayer(skillPart.GetMaster()) && skilltable.dwReadTime > 0) // 非瞬发技能
            {                                                                                                   //读条技能
                Client.stUninterruptMagic evenparam = new Client.stUninterruptMagic();
                evenparam.time = database.dwReadTime;
                evenparam.type = GameCmd.UninterruptActionType.UninterruptActionType_SkillCJ;
                evenparam.uid  = skillPart.GetMaster().GetUID();
                EventEngine.Instance().DispatchEvent((int)GameEventID.SKILLGUIDE_PROGRESSSTART, evenparam);
            }

            preparetime = 0;
        }
Esempio n. 2
0
        public override void Update(float dt)
        {
            IEntity casetr = skillPart.GetMaster();

            if (m_caster == null)
            {
                m_Statemachine.ChangeState((int)SkillState.Over, null);
                return;
            }

            m_caster.Update(dt);
            m_fTotalTime += dt;
            if (skillPart.GetSkillPartType() == SkillPartType.SKILL_PLAYERPART)
            {
                PlayerSkillPart playerSkill = skillPart as PlayerSkillPart;
                //  if (m_caster.IsCasting == false)
                {
                    if (m_skillDatabase.useSkillType == (int)UseSkillType.GuideSlider || m_skillDatabase.useSkillType == (int)UseSkillType.GuideNoSlider)
                    {
                        if (m_skillDatabase.dwGuideTime > 0)
                        {
                            if (m_fTotalTime * 1000 > m_skillDatabase.dwGuideTime)
                            {
                                //接收招动作
                                m_Statemachine.ChangeState((int)SkillState.Over, playerSkill);
                            }
                            return;
                        }
                        else
                        {
                            Log.LogGroup("ZDY", "引导类型技能 {0} 的引导时间为0", m_skillDatabase.wdID);
                        }
                    }
                    float tmeptime      = Time.realtimeSinceStartup;
                    float delta         = tmeptime - playerSkill.SkillStartPlayTime;
                    uint  skillPlaytime = (uint)(delta * 1000);

                    uint    skillRunJiangzhiTime = (uint)(playerSkill.SkillStiffTime * 1000);
                    IEntity target = skillPart.GetSkillTarget();
                    if (target == null)
                    {
                        if (skillRunJiangzhiTime > m_uDbJiangzhiTime) // 播放时间大于僵直时间
                        {
                            m_Statemachine.ChangeState((int)SkillState.Over, playerSkill);
                        }

                        return;
                    }
                    if (target.GetCurState() == CreatureState.Dead)
                    {
                        Log.LogGroup("ZDY", "target dead 去除连击时无法切换状态的bug ");
                        m_Statemachine.ChangeState((int)SkillState.Over, null);
                        return;
                    }
                    playerSkill.OnDoLongPressNextSkillID();
                    if ((playerSkill.NextSkillID != 0))
                    {
                        //CurSkillID

                        //   m_skillDoubleDb = GameTableManager.Instance.GetTableItem<SkillDoubleHitDataBase>(playerSkill.CurSkillID);
                        SkillDoubleHitDataBase db = m_skillDoubleDb;
                        if (db != null)
                        {
                            //    if (playerSkill.NextSkillID == 101)
                            //    {
                            //        Log.Error("连击 nextskillid " + playerSkill.NextSkillID.ToString() + " skillPlay time is " + skillPlaytime +
                            //"  db.beginChangeTime " + db.beginChangeTime + " db.doublehitend " + db.doublehitend);
                            //    }

                            if (skillPlaytime >= db.beginChangeTime && skillPlaytime <= db.doublehitend)
                            {
                                //大于僵直时间 并且小于连击生效时间可以变招
                                SkillEffect skillEffect = m_caster.EffectNode;
                                if (skillEffect != null)
                                {
                                    //  skillEffect.Stop();
                                }
                                //    Log.LogGroup("ZDY", "连击 nextskillid " + playerSkill.NextSkillID.ToString());
                                playerSkill.SkillStiffTime = 0;
                                //如果已经触发连击,接着播放连击技能
                                DoCastSkill((uint)playerSkill.NextSkillID);
                                playerSkill.SkillStartPlayTime = Time.realtimeSinceStartup;
                                playerSkill.SyncSkill((uint)playerSkill.CurSkillID, target, Vector3.zero);
                                SkillDatabase curDataBase = m_skillDatabase;// GameTableManager.Instance.GetTableItem<SkillDatabase>(playerSkill.CurSkillID, 1);
                                if (curDataBase != null)
                                {
                                    m_uDbJiangzhiTime = curDataBase.wdStiffTime;
                                }
                                else
                                {
                                    if (Engine.Utility.Log.MaxLogLevel >= Engine.Utility.LogLevel.LogLevel_Group)
                                    {
                                        Log.LogGroup("ZDY", "curdatabase is null skill id is " + playerSkill.CurSkillID);
                                    }
                                }
                                //普攻没有cd 不需要派发
                                Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.SKILLSYSTEM_USESKILL, playerSkill.CurSkillID);
                            }
                            else
                            {
                                if (skillPlaytime > db.doublehitend) // 播放时间大于连击生效时间
                                {
                                    if (Engine.Utility.Log.MaxLogLevel >= Engine.Utility.LogLevel.LogLevel_Group)
                                    {
                                        Log.LogGroup("ZDY", "播放时间大于连击生效时间 切换到over skillPlaytime is " + skillPlaytime + " 连击生效时间 " + db.doublehitend);
                                    }
                                    //接收招动作
                                    m_Statemachine.ChangeState((int)SkillState.Over, playerSkill);
                                }
                            }
                        }
                    }
                    else
                    {
                        if (skillRunJiangzhiTime > m_uDbJiangzhiTime) // 大于僵直时间
                        {
                            if (Engine.Utility.Log.MaxLogLevel >= Engine.Utility.LogLevel.LogLevel_Group)
                            {
                                Log.LogGroup("ZDY", "达到僵直时间切换到over runjiangzhitime is " + skillRunJiangzhiTime);
                            }
                            //接收招动作
                            m_Statemachine.ChangeState((int)SkillState.Over, playerSkill);
                        }
                        else
                        {//连击不要在这里触发
                         //   m_skillDoubleDb = GameTableManager.Instance.GetTableItem<SkillDoubleHitDataBase>(playerSkill.CurSkillID);

                            /* if (m_skillDoubleDb != null && IsMainPlayer())
                             * {
                             *   IControllerSystem cs = playerSkill.GetCtrollerSys();
                             *   if (cs == null)
                             *   {
                             *       Log.Error("ExecuteCmd: ControllerSystem is null");
                             *       return;
                             *   }
                             *
                             *   if (cs.GetCombatRobot().Status != CombatRobotStatus.STOP)
                             *   {
                             *       //   Log.LogGroup("ZDY", "======================= skillPlaytime is " + skillPlaytime + " start " + m_skillDoubleDb.doublehitBegin + " end " + m_skillDoubleDb.doublehitend);
                             *       if (skillPlaytime >= m_skillDoubleDb.doublehitBegin && skillPlaytime <= m_skillDoubleDb.doublehitend && m_bSendDoubleHitCmd == false)
                             *       {
                             *           m_bSendDoubleHitCmd = true;
                             *           Engine.Utility.Log.LogGroup("ZCX", "连击{0} next ", playerSkill.CurSkillID, playerSkill.NextSkillID);
                             *           SkillDoubleHitDataBase skilldoubleDb = m_skillDoubleDb;// GameTableManager.Instance.GetTableItem<SkillDoubleHitDataBase>(playerSkill.CurSkillID);
                             *
                             *           if (skilldoubleDb != null)
                             *           {
                             *               stSkillDoubleHit skillDhHit = new stSkillDoubleHit();
                             *               skillDhHit.doubleHitEnd = skilldoubleDb.beginskillid == skilldoubleDb.nextskillid;
                             *               skillDhHit.skillID = skilldoubleDb.nextskillid;
                             *               Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ROBOTCOMBAT_NEXTCMD, skillDhHit);
                             *           }
                             *       }
                             *   }
                             *
                             * }*/
                        }
                    }
                }
                //else
                //{

                //}
            }
        }