Esempio n. 1
0
        //初始化动作接口,目前是硬代码,之后会根据配表之类的实现
        public void InitAnimation(string strChildName = "Model")
        {
            if (null == m_AnimLogic)
            {
                return;
            }

            //首先保存该ObjAction的路径
            m_AnimLogic.AnimResFilePath = m_AnimationFilePath;

            //由于目前Obj采用的都是Root作为根节点,而独立挂Model节点,所以动作组件采取搜索子节点方式
            Transform modelTransform = gameObject.transform.FindChild(strChildName);

            if (modelTransform)
            {
                m_Objanimation = modelTransform.gameObject.GetComponent <Animation>();
            }

            if (m_Objanimation)
            {
                m_AnimLogic.InitState(m_Objanimation.gameObject);
            }
            else
            {
                LogModule.DebugLog("The character you would like to control doesn't have animations. Moving her might look weird.");
            }
        }
Esempio n. 2
0
        public void InitAnimation()
        {
            if (m_AnimLogic == null)
            {
                m_AnimLogic = gameObject.AddComponent <AnimationLogic>();
            }

            if (null == m_AnimLogic)
            {
                return;
            }

            //首先保存该ObjAction的路径
            m_AnimLogic.AnimResFilePath = m_AnimationFilePath;

            Transform modelTransform = gameObject.transform.FindChild("Model");

            if (modelTransform)
            {
                m_ObjAnimation = modelTransform.gameObject.GetComponent <Animation>();
            }

            if (m_ObjAnimation)
            {
                m_AnimLogic.InitState(m_ObjAnimation.gameObject);
            }
            else
            {
                LogModule.DebugLog("The Mount doesn't have animations. Moving her might look weird.");
            }

            if (m_FakeObjEffectController == null)
            {
                m_FakeObjEffectController = gameObject.AddComponent <FakeObjEffectBehaviourController>();
            }

            if (m_FakeObjEffectController != null)
            {
                m_FakeObjEffectController.InitEffect(gameObject);
            }
        }
Esempio n. 3
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;
                }
            }
        }