Example #1
0
        void OnClickPlayer(CEventBaseArgs data)
        {
            // 破碎死域要屏蔽这个界面
            if (SceneHelp.Instance.IgnoreClickPlayer == true)
            {
                return;
            }

            GameObject selectedObj = (GameObject)data.arg;

            if (selectedObj != null)
            {
                ActorMono actMono = ActorHelper.GetActorMono(selectedObj);
                if (actMono != null)
                {
                    Actor actor = actMono.BindActor;
                    if (actor != null && (actor is LocalPlayer) == false && ActorHelper.IsShemale(actor.UID.obj_idx) == false)
                    {
                        Dictionary <string, string> playerInfo = new Dictionary <string, string>();
                        playerInfo.Clear();
                        playerInfo.Add("uuid", actor.UID.obj_idx.ToString());
                        xc.ui.ugui.UIManager.Instance.ShowWindow("UIWatchPlayerWindow", playerInfo);
                    }
                }
            }
        }
Example #2
0
    public override void Init(xc.ActorMono begin_actor, xc.ActorMono end_actor, DBBulletTrace.BulletInfo bulletInfo, SkillAttackInstance inst)
    {
        base.Init(begin_actor, end_actor, bulletInfo, inst);

        mInitPoint = true;

        if (begin_actor == null || begin_actor.BindActor == null || end_actor == null || end_actor.BindActor == null)
        {
            GameDebug.LogError("[StretchComponent]Target is lost");
            DestroySelf();
            return;
        }

        if (bulletInfo == null)
        {
            GameDebug.LogError("[StretchComponent]BulletInfo is null");
            DestroySelf();
            return;
        }

        m_BulletInfo   = bulletInfo;
        m_BeginTrans   = begin_actor.BindActor.Trans;
        m_EndTrans     = end_actor.BindActor.Trans;
        mTarget        = end_actor;
        m_TargetHeight = end_actor.BindActor.Height;
        MoveSpeed      = bulletInfo.FlySpeed;

        // 先设置方向
        Vector3 vec = TargetPos - BeginPos;

        cacheTrans.position = BeginPos + vec * 0.1f;
        cacheTrans.rotation = Quaternion.LookRotation(vec);
        SetStretch(1, vec.magnitude * 0.1f);
        arrowReached = false;
    }
Example #3
0
        bool mHideEffect        = false;                                                                                                          // 是否隐藏子弹特效

        /// <summary>
        /// 初始化
        /// </summary>
        public bool Init()
        {
            m_SkillInfo = DBSkillSev.Instance.GetSkillInfo(SkillID);
            m_SubEmitId = (ulong)(((ulong)ActorID << 32 & 0xffffffff00000000) | ((ulong)SkillID << 16 & 0xffffffffffff0000));  // 暂时使用技能ID和角色ID来进行组合
            if (m_SkillInfo != null && m_SkillInfo.BulletId != 0)
            {
                m_BulletInfo = DBBulletTrace.GetInstance().GetBulletInfo(m_SkillInfo.BulletId);
                if (m_BulletInfo != null)
                {
                    if (HitPlayers.Count > 0)
                    {
                        uint  hit_player_id = HitPlayers[0];
                        Actor src_player    = ActorManager.Instance.GetPlayer(ActorID);
                        Actor hitPlayer     = ActorManager.Instance.GetPlayer(hit_player_id);

                        if (src_player == null || hitPlayer == null || src_player.GetActorMono() == null || hitPlayer.GetActorMono() == null)
                        {
                            return(false);
                        }

                        ActorMono src_actormono = src_player.GetActorMono();
                        ActorMono hit_actormono = hitPlayer.GetActorMono();

                        BulletTrackInstance sub_bullet_trace = new xc.BulletTrackInstance(m_BulletInfo, m_SkillInfo, 0);
                        m_TraceInsts.Add(sub_bullet_trace);

                        // 开启新的BulletTrackInstance
                        mHideEffect = ShieldManager.Instance.IsHideBulletEffect(src_player, hitPlayer);
                        sub_bullet_trace.Do(m_SubEmitId, src_actormono, hit_actormono, mHideEffect, src_player.transform.position, src_player.transform.rotation, src_player.transform.forward, OnHit);

                        // 将伤害信息添加到新创建的SkillAttackInstance列表中
                        SkillAttackInstance attack_inst = EffectManager.GetInstance().GetAttackInstance(m_SubEmitId);
                        if (attack_inst != null)
                        {
                            Damage dmgInfo = null;
                            if (m_DamageInfos.TryGetValue(hit_player_id, out dmgInfo))
                            {
                                attack_inst.AddHurtInfo(dmgInfo);
                            }
                        }

                        m_HitEmits[hit_player_id] = new HitCacheInfo(m_SubEmitId);
                        m_SubEmitId++;

                        mLastThunderPlayer = hit_player_id;
                        HitPlayers.RemoveAt(0);
                        return(true);
                    }
                }
            }

            return(false);
        }
Example #4
0
        public bool TriggerDialog(uint dialogId, System.Action finishedCallback, Transform source)
        {
            if (source != null)
            {
                ActorMono actMono = ActorHelper.GetActorMono(source);
                if (actMono != null)
                {
                    NpcPlayer sourceActor = actMono.BindActor as NpcPlayer;
                    if (sourceActor != null)
                    {
                        sourceActor.TurnToLocalPlayer();
                    }
                }
            }

            return(TriggerDialog(dialogId, finishedCallback));
        }
Example #5
0
        void OnSelectActorChange(CEventBaseArgs data)
        {
            if (m_Selected != null && m_Selected.BindActor.IsMonster() && !m_Selected.BindActor.IsGuardedNpc())
            {
                m_Selected.BindActor.ShowTextName(false);
            }

            var act_mono = (ActorMono)data.arg;

            if (act_mono != null)
            {
                m_Selected = act_mono;

                if (m_Selected.BindActor.IsBoss() == false)
                {
                    m_Selected.BindActor.ShowTextName(true);
                }
            }
        }
        /// <summary>
        /// Do the specified target, kPos, kRotation and sDir.
        /// </summary>
        /// <param name="target">子弹追踪的目标</param>
        /// <param name="bullet_pos">子弹发出的位置</param>
        /// <param name="bullet_rot">子弹的旋转量</param>
        /// <param name="bullet_dir">子弹追踪的方向</param>
        public void Do(ulong skill_attack_id, ActorMono src, ActorMono target, bool is_hide_effect, Vector3 bullet_pos, Quaternion bullet_rot, Vector3 bullet_dir, Action <SkillAttackInstance> hit_callback)
        {
            if (target == null || target.BindActor == null)
            {
                return;
            }

            SkillAttackId = skill_attack_id;

            GameObject bullet_Obj = new GameObject("Bullet");

            InitBullet(bullet_Obj, src, target, skill_attack_id, bullet_pos, bullet_rot, bullet_dir, hit_callback);

            Actor src_actor = src != null ? src.BindActor : null;

            is_hide_effect = is_hide_effect || ShieldManager.Instance.IsHideBulletEffect(src_actor, target.BindActor);
            if (!string.IsNullOrEmpty(m_BulletInfo.AttackEffect) && !is_hide_effect)
            {
                EffectManager.GetInstance().GetEffectEmitter(m_BulletInfo.AttackEffect).CreateInstance(x => InitEffectObject(bullet_Obj, x));
            }
        }
        /// <summary>
        /// 初始化子弹的信息
        /// </summary>
        /// <param name="bulletObject"></param>
        /// <param name="src"></param>
        /// <param name="traceTarget"></param>
        /// <param name="effectId"></param>
        /// <param name="pos"></param>
        /// <param name="rotation"></param>
        /// <param name="dir"></param>
        /// <param name="hit_callback"></param>
        void InitBullet(GameObject bullet_object, ActorMono src, ActorMono trace_target, ulong effect_Id, Vector3 pos, Quaternion rotation, Vector3 dir, Action <SkillAttackInstance> hit_callback)
        {
            if (trace_target == null || trace_target.BindActor == null)
            {
                return;
            }

            pos.y += m_BulletInfo.OffsetY;
            pos   += dir * m_BulletInfo.OffsetX; // 前向移动

            //GameDebug.Log("EffectId : "+effect_Id);
            Transform bulletTrans = bullet_object.transform;

            // 设置子弹的位置和方向
            bulletTrans.position   = pos;
            bulletTrans.rotation   = rotation;
            bulletTrans.localScale = Vector3.one;

            if (m_BulletInfo.BulletType == DBBulletTrace.BulletTypes.BT_BIND)
            {
                bulletTrans.parent = src.BindActor.Trans;
            }

            var skill_attack_inst = new SkillAttackInstance();
            var skill_base        = bullet_object.AddComponent <SkillBaseComponent>();

            // 初始化
            skill_base.Init(skill_attack_inst);
            skill_attack_inst.Init(effect_Id, src.BindActor.UID, m_SkillInfo, 0, m_BulletInfo.FlyMaxTime, 1.0f, skill_base, hit_callback);

            // 子弹加到管理器
            EffectManager.GetInstance().AddSkillInstance(effect_Id, skill_attack_inst);

            if (m_BulletInfo.BulletType == DBBulletTrace.BulletTypes.BT_DIRECTION ||
                m_BulletInfo.BulletType == DBBulletTrace.BulletTypes.BT_BIND)
            {
                // 绑定追踪组件
                TraceTargetComponent trace_target_comp = bullet_object.AddComponent <TraceTargetComponent>();
                Vector3 v_dir = Quaternion.Euler(0.0f, 0.0f, 0.0f) * dir; // flyDir要转化到当前运行方向的坐标轴中
                bulletTrans.forward = v_dir;
                trace_target_comp.Init(src, trace_target, m_BulletInfo, skill_attack_inst);
                skill_base.AddMonoEnableOption(trace_target_comp, true, m_DelayTime);
            }
            else if (m_BulletInfo.BulletType == DBBulletTrace.BulletTypes.BT_LINK)
            {
                // 绑定追踪组件
                StretchComponent traceComp = bullet_object.AddComponent <StretchComponent>();
                traceComp.Init(src, trace_target, m_BulletInfo, skill_attack_inst);
                skill_base.AddMonoEnableOption(traceComp, true, m_DelayTime);
            }
            else if (m_BulletInfo.BulletType == DBBulletTrace.BulletTypes.BT_IMMEDIATE)
            {
                bulletTrans.parent        = trace_target.BindActor.Trans;
                bulletTrans.localPosition = Vector3.zero;
                bulletTrans.rotation      = Quaternion.identity;
                bulletTrans.localScale    = Vector3.one;
                bulletTrans.parent        = null;

                // 绑定追踪组件
                ImmediateHitComponent traceComp = bullet_object.AddComponent <ImmediateHitComponent>();
                traceComp.Init(src, trace_target, m_BulletInfo, skill_attack_inst);
                skill_base.AddMonoEnableOption(traceComp, true, m_DelayTime);
            }

            // 绑子弹音效
            if (m_BulletInfo.AttackSound != string.Empty)
            {
                var bind_sound = bullet_object.AddComponent <BindSoundComponent>();
                bind_sound.enabled = false;
                bind_sound.Init(m_BulletInfo.AttackSound, false);
                skill_base.AddMonoEnableOption(bind_sound, true, m_DelayTime);
            }
        }
Example #8
0
 public void Reset()
 {
     m_Selected = null;
 }
Example #9
0
 public virtual void Init(xc.ActorMono s, xc.ActorMono d, DBBulletTrace.BulletInfo bulletInfo, SkillAttackInstance attackInst)
 {
     mSkillAttackInst = attackInst;
 }