Ejemplo n.º 1
0
        public void OnHitTarget()
        {
            FixedPoint  m_minDis2 = new FixedPoint(999999);
            CCreature   target    = null;
            List <long> list      = CCreatureMgr.GetCreatureList();

            for (int i = 0; i < list.Count; i++)
            {
                CCreature creature = CCreatureMgr.Get(list[i]);
                if (m_listHited != null && m_listHited.Contains((int)list[i]))
                {
                    continue;
                }
                if (m_caster == creature || m_caster.bCamp(creature) || creature.IsDie() || creature == m_rec)
                {
                    continue;
                }
                FixedPoint abDis2 = FPCollide.GetDis2(m_rec.GetPos(), creature.GetPos());
                if (abDis2 < new FixedPoint(m_triggerData.Length * m_triggerData.Length))
                {
                    if (abDis2 < m_minDis2)
                    {
                        target    = creature;
                        m_minDis2 = abDis2;
                    }
                }
            }
            if (target != null)
            {
                if (m_listHited == null)
                {
                    m_listHited = new List <int>();
                }

                Debug.Log("添加单位:" + target.GetUid());
                m_listHited.Add((int)target.GetUid());
                OnHitAddBuff(m_caster, target, m_listHited);

                VTrigger vTri = GetVTrigger();
                if (vTri != null && m_rec != null && m_rec.GetVObject() != null)
                {
                    Vector3 sh = m_rec.GetVObject().GetHitHeight();
                    Vector3 th = target.GetVObject().GetHitHeight();
                    vTri.SetLineStartPos(GetPos().ToVector3() + sh);
                    vTri.SetLineTargetPos(target.GetPos().ToVector3() + th);
                }
            }
            else
            {
                Destory();
            }
        }
Ejemplo n.º 2
0
        // 矩形检测,获取最近的单位,进行激光链接
        public override void Trigger()
        {
            FixedPoint  minDis = new FixedPoint(999999);
            CCreature   minCC  = null;
            List <long> list   = CCreatureMgr.GetCreatureList();

            for (int i = 0; i < list.Count; i++)
            {
                CCreature creature = CCreatureMgr.Get(list[i]);
                if (m_caster.bCamp(creature) || creature.IsDie())
                {
                    continue;
                }

                FPSphere playerS = new FPSphere();
                playerS.c = creature.GetPos();
                playerS.r = creature.GetR();

                Vector2d pos   = m_caster.GetPos() + GetDir().normalized *new FixedPoint((m_triggerData.Length + m_triggerData.vBulletDeltaPos.z) * 0.5f);
                int      angle = (int)FPCollide.GetAngle(GetDir()).value;
                FPObb    obb   = new FPObb(pos, new Vector2d(m_triggerData.Width, m_triggerData.Length), angle);
                if (FPCollide.bSphereOBB(playerS, obb))
                {
                    FixedPoint dis = Vector2d.Distance(creature.GetPos(), GetPos());
                    if (dis < minDis)
                    {
                        minDis = dis;
                        minCC  = creature;
                    }
                }
            }
            if (minCC != null)
            {
                OnHitAddBuff(m_caster, minCC);
                Vector2d targetPos = GetPos() + GetDir().normalized *minDis;

                if (m_vCreature != null)
                {
                    Vector3 tH = minCC.GetVObject().GetHitHeight();
                    GetVTrigger().SetLineTargetPos(targetPos.ToVector3() + tH);
                }
            }
            else
            {
                _CheckObstacle();
            }
        }
Ejemplo n.º 3
0
        public void UpdateVO_ShowRide(bool bUp, CCreature ride = null)
        {
            if (m_vCreature == null)
            {
                return;
            }

            CmdUIHead name = new CmdUIHead();

            name.type  = 12;
            name.bRide = bUp;
            if (ride != null)
            {
                name.rideObject = ride.GetVObject();
            }
            m_vCreature.PushCommand(name);
        }
Ejemplo n.º 4
0
        public override void Destory()
        {
            m_bJump = false;
            CCreature cc = GetCaster();

            if (cc != null)
            {
                GetCaster().UpdateMoveSpeed();
            }

            VObject vo = cc.GetVObject();

            if (vo != null)
            {
                vo.PushCommand(new CmdFspStopMove());
                vo.SetMove(false);
            }

            base.Destory();
        }
Ejemplo n.º 5
0
        public void Init()
        {
            CCreature player = CCreatureMgr.Get(m_curSkillCmd.m_casterUid);

            if (m_curSkillCmd.m_skillId == 0)
            {
                m_skillInfo = player.GetSkillByIndex(m_curSkillCmd.m_skillIndex).m_skillInfo;
            }
            else
            {
                // 组合技能
                SkillCsv skillCsv = CsvManager.Inst.GetCsv <SkillCsv>((int)eAllCSV.eAC_Skill);
                m_skillInfo = skillCsv.GetData(m_curSkillCmd.m_skillId);
            }

            int skillId = m_skillInfo.id;

            SkillStepCsv step = CsvManager.Inst.GetCsv <SkillStepCsv>((int)eAllCSV.eAC_SkillStep);

            m_casterData = step.GetCasterData(skillId);


            //Debug.Log("播放施法动作" + m_casterData.animaName);
            if (player.m_vCreature == null)
            {
                return;
            }

            if (m_casterData == null)
            {
                Debug.LogError("技能子表 施法配置为空:" + skillId);
                return;
            }

            m_casterObject = player.GetVObject();
            m_casterObject.StartRotate(m_curSkillCmd.m_dir.ToVector3());

            Start();
        }
Ejemplo n.º 6
0
        public void EnterFrame()
        {
            if (m_player.IsDie())
            {
                return;
            }

            m_curTime += FSPParam.clientFrameMsTime;
            if (m_curTime >= 40 * FSPParam.clientFrameMsTime)
            {
                if (m_tree != null)
                {
                    m_tree.OnUpdate();
                }

                // AI技能外部CD
                int curSkillInterval = m_tree.m_dataBase.GetData <int>((int)eAIParam.INT_SKILL_INTERVAL);
                if (curSkillInterval >= 0)
                {
                    curSkillInterval -= FSPParam.clientFrameMsTime;
                    m_tree.m_dataBase.SetData <int>((int)eAIParam.INT_SKILL_INTERVAL, curSkillInterval);
                }

                if (Client.Inst().m_bDebug)
                {
                    string state = GetCurState();
                    if (!string.IsNullOrEmpty(state))// 如果卡主,可以知道最后一个状态
                    {
                        // 状态显示
                        VObject mt = m_player.GetVObject();
                        if (mt == null)
                        {
                            return;
                        }
                        CmdUIHead cmd = new CmdUIHead();
                        cmd.type = 1;
                        cmd.name = m_player.GetUid() + ":" + state;
                        mt.PushCommand(cmd);
                    }
                }

                // 仇恨值
                m_curHatredTime += FSPParam.clientFrameMsTime;
                if (m_curHatredTime >= 30 * FSPParam.clientFrameMsTime)
                {
                    _UpdateHatredList();
                    //主角显示测试界面
                    if (m_player.IsMaster())
                    {
                        m_hatredList.Sort((x, y) =>
                        {
                            if (x.val == y.val)
                            {
                                return(0);
                            }
                            else if (x.val > y.val)
                            {
                                return(-1);
                            }
                            else
                            {
                                return(1);
                            }
                        });
                        //m_list.Init(m_hatredList.Count, (item, index) =>
                        //{
                        //    UIItem.SetText(item, "txt", m_hatredList[index].uid + " 仇恨值:" + m_hatredList[index].val);
                        //    UIItem.SetProgress(item, "pct", m_hatredList[index].val, 100);
                        //});
                    }
                    m_curHatredTime = 0;
                }
            }
        }