Exemple #1
0
        private float m_fLastPlayDamageSoundTime = 0; //上次玩家受伤害音效播放的时间
        public void OnSwithObjAnimState(Games.GlobeDefine.GameDefine_Globe.OBJ_ANIMSTATE ObjState, bool playEffectImmediately = true)
        {
            if (IsDie() &&
                ObjState != Games.GlobeDefine.GameDefine_Globe.OBJ_ANIMSTATE.STATE_DEATH &&   //死亡状态
                ObjState != Games.GlobeDefine.GameDefine_Globe.OBJ_ANIMSTATE.STATE_CORPSE &&  //尸体状态
                ObjState != Games.GlobeDefine.GameDefine_Globe.OBJ_ANIMSTATE.STATE_ATTACKFLY) //死亡击飞状态
            {
                return;
            }
            m_CurObjAnimState = ObjState; //!!此处勿修改
            if (m_Objanimation != null)
            {
                switch (CurObjAnimState)
                {
                case Games.GlobeDefine.GameDefine_Globe.OBJ_ANIMSTATE.STATE_NORMOR:
                    ProcessIdleAnimState(playEffectImmediately);

                    break;

                case Games.GlobeDefine.GameDefine_Globe.OBJ_ANIMSTATE.STATE_WALK:
                    ProcessWalkAnimState();
                    break;

                case Games.GlobeDefine.GameDefine_Globe.OBJ_ANIMSTATE.STATE_DEATH:
                    ProcessDeathAnimState();
                    break;

                case Games.GlobeDefine.GameDefine_Globe.OBJ_ANIMSTATE.STATE_HIT:
                case Games.GlobeDefine.GameDefine_Globe.OBJ_ANIMSTATE.STATE_HITBYSHAOLIN:
                case Games.GlobeDefine.GameDefine_Globe.OBJ_ANIMSTATE.STATE_HITBYTIANSHAN:
                case Games.GlobeDefine.GameDefine_Globe.OBJ_ANIMSTATE.STATE_HITBYDALI:
                case Games.GlobeDefine.GameDefine_Globe.OBJ_ANIMSTATE.STATE_HITBYXIAOYAO:
                case Games.GlobeDefine.GameDefine_Globe.OBJ_ANIMSTATE.STATE_HITBYGAIBANG:
                    ProcessHitAnimState();
                    break;

                case Games.GlobeDefine.GameDefine_Globe.OBJ_ANIMSTATE.STATE_ATTACKDOWN:
                    m_AnimLogic.Stop();
                    m_AnimLogic.Play((int)(CharacterDefine.CharacterAnimId.Knockback_01));
                    //受击特效
                    PlayEffect(8);
                    break;

                case Games.GlobeDefine.GameDefine_Globe.OBJ_ANIMSTATE.STATE_ATTACKFLY:
                    AnimLogic.Stop();
                    AnimLogic.Play((int)CharacterDefine.CharacterAnimId.Knockback_02);
                    break;

                case Games.GlobeDefine.GameDefine_Globe.OBJ_ANIMSTATE.STATE_JUMP:
                {
                    AnimLogic.Stop();
                    AnimLogic.Play((int)CharacterDefine.CharacterAnimId.Jump01);
                }
                break;

                case Games.GlobeDefine.GameDefine_Globe.OBJ_ANIMSTATE.STATE_JUMP_END:
                {
                    AnimLogic.Stop();
                    AnimLogic.Play((int)CharacterDefine.CharacterAnimId.JumpEnd_Stand);
                }
                break;

                case Games.GlobeDefine.GameDefine_Globe.OBJ_ANIMSTATE.STATE_FASTRUN_LEFT:
                {
                    AnimLogic.Stop();
                    AnimLogic.Play((int)CharacterDefine.CharacterAnimId.Fastrun_Left);
                }
                break;

                case Games.GlobeDefine.GameDefine_Globe.OBJ_ANIMSTATE.STATE_FASTRUN_RIGHT:
                {
                    AnimLogic.Stop();
                    AnimLogic.Play((int)CharacterDefine.CharacterAnimId.Fastrun_Right);
                }
                break;

                case Games.GlobeDefine.GameDefine_Globe.OBJ_ANIMSTATE.STATE_CORPSE:
                {
                    ProcessDeathAnimStateEx();
                    // AnimLogic.Stop();
                    // AnimLogic.Play((int)CharacterDefine.CharacterAnimId.Dead);
                }
                break;

                default:
                    break;
                }
            }
        }
Exemple #2
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;
                }
            }
        }