コード例 #1
0
ファイル: Reputation.cs プロジェクト: kimch2/PackageClient
        //是否为敌对
        public static bool IsEnemy(Obj_Character objChar)
        {
            if (CharacterDefine.REPUTATION_TYPE.REPUTATION_HOSTILE == GetObjReputionType(objChar))
            {
                return(true);
            }

            return(false);
        }
コード例 #2
0
ファイル: Reputation.cs プロジェクト: kimch2/PackageClient
        //是否为中立
        public static bool IsNeutral(Obj_Character objChar)
        {
            if (CharacterDefine.REPUTATION_TYPE.REPUTATION_NEUTRAL == GetObjReputionType(objChar))
            {
                return(true);
            }

            return(false);
        }
コード例 #3
0
ファイル: Reputation.cs プロジェクト: kimch2/PackageClient
        //是否为友好
        public static bool IsFriend(Obj_Character objChar)
        {
            if (CharacterDefine.REPUTATION_TYPE.REPUTATION_FRIEND == GetObjReputionType(objChar))
            {
                return(true);
            }

            return(false);
        }
コード例 #4
0
ファイル: Obj_Snare.cs プロジェクト: kimch2/PackageClient
        public bool Init(ObjSnare_Init_Data initData)
        {
            if (null == m_ObjTransform)
            {
                m_ObjTransform = transform;
            }

            //服务器发过来的信息
            ServerID  = initData.m_ServerID;
            SnareId   = initData.m_SnareID;
            OwerobjID = initData.m_OwnerObjId;
            OwnerGuid = initData.m_OwerGuid;
            m_ObjTransform.position = ActiveScene.GetTerrainPosition(new Vector3(initData.m_fX, 0, initData.m_fZ));
            Obj_Character ownerCharacter = Singleton <ObjManager> .GetInstance().FindObjCharacterInScene(OwerobjID);

            //修正陷阱的高度和陷阱释放者一样
            if (ownerCharacter != null)
            {
                Vector3 newPosVector3 = m_ObjTransform.position;
                newPosVector3.y         = ownerCharacter.ObjTransform.position.y;
                m_ObjTransform.position = newPosVector3;
            }

            //初始化特效
            if (ObjEffectController == null)
            {
                ObjEffectController = gameObject.AddComponent <ObjEffectBehaviourController>();
            }

            Tab_SnareObjInfo SnareInfo = TableManager.GetSnareObjInfoByID(SnareId, 0);

            if (SnareInfo != null)
            {
                //播放生存期特效
                for (int i = 0; i < SnareInfo.getAliveEffectIdCount(); i++)
                {
                    int AliveEffectId = SnareInfo.GetAliveEffectIdbyIndex(i);
                    if (AliveEffectId != -1 && ObjEffectController != null)
                    {
                        PlayEffect(AliveEffectId);
                    }
                }
                //播放生存期音效
                for (int i = 0; i < SnareInfo.getAliveSoundIdCount(); i++)
                {
                    int AliveSoundId = SnareInfo.GetAliveSoundIdbyIndex(i);
                    if (AliveSoundId != -1)
                    {
                        GameManager.gameManager.SoundManager.PlaySoundEffect(AliveSoundId);
                    }
                }
            }
            return(true);
        }
コード例 #5
0
 public override void OnLevelCombat(Obj_Character Attacker)
 {
     base.OnLevelCombat(Attacker);
     IsTracing = false;
     if (Controller == null)
     {
         return;
     }
     if (Controller.CurrentAIState.AIType == CharacterDefine.AI_TYPE.AI_TYPE_COMBAT)
     {
         Controller.LeaveCombat();
     }
     if (Attacker)
     {
         Controller.ThreadInfo.ResetThreat(Attacker.gameObject);
     }
 }
コード例 #6
0
        public override void OnEnterCombat(Obj_Character Attacker)
        {
            if (IsDie())
            {
                return;
            }

            base.OnEnterCombat(Attacker);
            if (Controller == null)
            {
                return;
            }
            if (Controller.CurrentAIState.AIType != CharacterDefine.AI_TYPE.AI_TYPE_COMBAT)
            {
                Controller.EnterCombat();
            }

            if (Attacker)
            {
                Controller.ThreadInfo.AddThreat(Attacker.gameObject, 10);
            }
        }
コード例 #7
0
        public bool Init(ObjYanHua_Init_Data initData)
        {
            if (null == m_ObjTransform)
            {
                m_ObjTransform = transform;
            }
            //服务器发过来的信息
            ServerID  = initData.m_ServerID;
            YanHuaId  = initData.m_nYanHuaID;
            OwerobjID = initData.m_OwnerObjId;
            OwnerGuid = initData.m_OwerGuid;
            m_ObjTransform.position = ActiveScene.GetTerrainPosition(new Vector3(initData.m_fX, 0, initData.m_fZ));
            Obj_Character ownerCharacter = Singleton <ObjManager> .GetInstance().FindObjCharacterInScene(OwerobjID);

            if (ownerCharacter != null)
            {
                Vector3 newPosVector3 = m_ObjTransform.position;
                newPosVector3.y         = ownerCharacter.ObjTransform.position.y;
                m_ObjTransform.position = newPosVector3;
            }

            //初始化特效
            if (ObjEffectController == null)
            {
                ObjEffectController = gameObject.AddComponent <ObjEffectBehaviourController>();
            }
            //播放特效
            Tab_YanHua TabYanHua = TableManager.GetYanHuaByID(YanHuaId, 0);

            if (TabYanHua != null)
            {
                int AliveEffectId = TabYanHua.AliveEffectId;
                if (AliveEffectId != -1 && ObjEffectController != null)
                {
                    PlayEffect(AliveEffectId);
                }
            }
            return(true);
        }
コード例 #8
0
        public override void OnBindOpt(Obj_Character obj)
        {
            base.OnBindOpt(obj);

            //婚车特殊摆设
            if (BaseAttr.RoleBaseID == GlobeVar.PARADE_BUSID && obj != null)
            {
                Transform playermodel = obj.transform.FindChild("Model");
                Transform ridepoint   = gameObject.transform.FindChild("Model/All/Bip01/Bip01 Pelvis/Bip01 Spine/Ride_Point01");
                Transform seatpoint   = gameObject.transform.FindChild("Model/All/Bone02/Ride_Point02");
                if (playermodel == null || ridepoint == null || seatpoint == null)
                {
                    return;
                }
                if (GetBindChildIndex(obj.ServerID) == 0 && ridepoint.childCount < 1)
                {
                    obj.gameObject.transform.localPosition = new Vector3(0.0f, 0.78f, -0.47f);
                    GameObject fakeobj = (GameObject)Instantiate(playermodel.gameObject);
                    if (fakeobj != null)
                    {
                        fakeobj.SetActive(true);
                        fakeobj.transform.parent        = ridepoint;
                        fakeobj.transform.localPosition = Vector3.zero;
                        fakeobj.transform.localRotation = Quaternion.Euler(90.0f, 0.0f, 0.0f);
                        fakeobj.transform.localScale    = Vector3.one;

                        AnimationLogic al = ridepoint.gameObject.AddComponent <AnimationLogic>();
                        if (al != null)
                        {
                            al.InitState(fakeobj);

                            Tab_RoleBaseAttr role = TableManager.GetRoleBaseAttrByID(obj.BaseAttr.RoleBaseID, 0);
                            if (role != null)
                            {
                                Tab_CharModel mo = TableManager.GetCharModelByID(role.CharModelID, 0);
                                if (mo != null)
                                {
                                    al.AnimResFilePath = mo.AnimPath;
                                }
                            }

                            //   int animId = -1;
                            //sl/ts/dl/xy
                            //if (obj.BaseAttr.RoleBaseID == 0)
                            //    animId = 153;
                            //else if (obj.BaseAttr.RoleBaseID == 1)
                            //    animId = 155;
                            //else if (obj.BaseAttr.RoleBaseID == 2)
                            //    animId = 159;
                            //else if (obj.BaseAttr.RoleBaseID == 3)
                            //    animId = 157;

                            //  if (animId > 0)
                            {
                                al.Play(227);
                            }
                        }
                    }
                    return;
                }
                if (GetBindChildIndex(obj.ServerID) == 1 && seatpoint.childCount < 1)
                {
                    obj.gameObject.transform.localPosition = new Vector3(0.0f, 0.47f, -1.83f);
                    GameObject fakeobj = (GameObject)Instantiate(playermodel.gameObject);
                    if (fakeobj != null)
                    {
                        fakeobj.SetActive(true);
                        fakeobj.transform.parent        = seatpoint;
                        fakeobj.transform.localPosition = Vector3.zero;
                        fakeobj.transform.localRotation = Quaternion.Euler(90.0f, 0.0f, 0.0f);
                        fakeobj.transform.localScale    = Vector3.one;

                        AnimationLogic al = seatpoint.gameObject.AddComponent <AnimationLogic>();
                        if (al != null)
                        {
                            al.InitState(fakeobj);

                            Tab_RoleBaseAttr role = TableManager.GetRoleBaseAttrByID(obj.BaseAttr.RoleBaseID, 0);
                            if (role != null)
                            {
                                Tab_CharModel mo = TableManager.GetCharModelByID(role.CharModelID, 0);
                                if (mo != null)
                                {
                                    al.AnimResFilePath = mo.AnimPath;
                                }
                            }

                            //int animId = -1;
                            ////sl/ts/dl/xy
                            //if (obj.BaseAttr.RoleBaseID == 0)
                            //    animId = 146;
                            //else if (obj.BaseAttr.RoleBaseID == 1)
                            //    animId = 148;
                            //else if (obj.BaseAttr.RoleBaseID == 2)
                            //    animId = 152;
                            //else if (obj.BaseAttr.RoleBaseID == 3)
                            //    animId = 150;
                            //if (animId > 0)
                            {
                                al.Play(225);
                            }
                        }
                    }
                    return;
                }
            }
        }
コード例 #9
0
ファイル: Reputation.cs プロジェクト: kimch2/PackageClient
        public static CharacterDefine.REPUTATION_TYPE GetObjReputionType(Obj_Character objChar, bool bPKListIsConsider = true)
        {
            Obj_MainPlayer _mainPlayer = Singleton <ObjManager> .GetInstance().MainPlayer;

            if (_mainPlayer == null)
            {
                return(CharacterDefine.REPUTATION_TYPE.REPUTATION_INVALID);
            }
            if (objChar == null)
            {
                return(CharacterDefine.REPUTATION_TYPE.REPUTATION_INVALID);
            }
            CharacterDefine.REPUTATION_TYPE type = CharacterDefine.REPUTATION_TYPE.REPUTATION_INVALID;
            Tab_Relation reputation = TableManager.GetRelationByID(objChar.BaseAttr.Force, 0);

            if (null != reputation)
            {
                type = (CharacterDefine.REPUTATION_TYPE)reputation.GetRelationbyIndex((int)_mainPlayer.BaseAttr.Force);
            }
            //自己跟自己 永远是友好关系
            if (objChar.ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_MAIN_PLAYER)
            {
                return(CharacterDefine.REPUTATION_TYPE.REPUTATION_FRIEND);
            }
            //是玩家 且是友好关系 则进一步判断是否是PK状态
            if (objChar.ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_OTHER_PLAYER &&
                type == CharacterDefine.REPUTATION_TYPE.REPUTATION_FRIEND)
            {
                Obj_OtherPlayer _Player = objChar as Obj_OtherPlayer;
                if (_Player)
                {
                    //同队伍和同帮会 伴侣 不能互相PK 不受PK模式影响
                    if ((GameManager.gameManager.PlayerDataPool.IsHaveGuild() == false || GameManager.gameManager.PlayerDataPool.IsGuildMember(_Player) == false) &&
                        (GameManager.gameManager.PlayerDataPool.IsHaveTeam() == false || GameManager.gameManager.PlayerDataPool.IsTeamMem(_Player.GUID) == false) &&
                        GameManager.gameManager.PlayerDataPool.LoverGUID != _Player.GUID && //是否是伴侣
                        GameManager.gameManager.ActiveScene.IsCopyScene() == false          //是否是副本
                        )
                    {
                        //对方是杀戮模式且在反击列表为敌对关系
                        if (_Player != null && _Player.PkModle == (int)CharacterDefine.PKMODLE.KILL)
                        {
                            //新需求为:如果玩家在和平模式下点击切换目标按钮,则先切换到周围杀戮模式的玩家,不需要在反击列表
                            if (_Player.IsInMainPlayerPKList)
                            {
                                return(CharacterDefine.REPUTATION_TYPE.REPUTATION_HOSTILE);
                            }
                            else if (!bPKListIsConsider)
                            {
                                return(CharacterDefine.REPUTATION_TYPE.REPUTATION_HOSTILE);
                            }
                        }
                        //主角是杀戮模式 为敌对关系
                        if (_mainPlayer.PkModle == (int)CharacterDefine.PKMODLE.KILL)
                        {
                            return(CharacterDefine.REPUTATION_TYPE.REPUTATION_HOSTILE);
                        }
                        if (_Player.IsWildEnemyForMainPlayer)
                        {
                            return(CharacterDefine.REPUTATION_TYPE.REPUTATION_HOSTILE);
                        }
                    }
                }
            }
            return(type);
        }