Exemplo n.º 1
0
        // 添加LinkObj
        /// <summary>
        /// 添加link对象
        /// </summary>
        /// <param name="pRenderObj">挂接对象</param>
        /// <param name="strLinkName">挂接点名称,如果为空,则默认在原点处</param>
        /// <param name="vOffset">相对挂接点偏移</param>
        /// <param name="rotate">相对挂接点旋转</param>
        /// <param name="eFollowType">跟随类型</param>
        /// <returns>linkID,删除时使用</returns>
        public int AddLinkObj(Engine.IRenderObj pRenderObj, ref string strLocatorName, Vector3 vOffset, Quaternion rotate, Engine.LinkFollowType eFollowType = Engine.LinkFollowType.LinkFollowType_ALL)
        {
            if (m_EntityView != null)
            {
                return(m_EntityView.AddLinkObj(pRenderObj, ref strLocatorName, vOffset, rotate, eFollowType));
            }

            return(0);
        }
Exemplo n.º 2
0
        //-------------------------------------------------------------------------------------------------------

        /**
         * @brief 对象加载回调
         * @param
         */
        private void OnCreateRenderObj(Engine.IRenderObj obj, object param)
        {
            if (obj == null)
            {
                return;
            }

            //Engine.Utility.Log.Error("OnCreateRenderObj {0}", obj.GetName());

            SuitPos pos = SuitPos.None;

            if (param is SuitPos)
            {
                pos = (SuitPos)param;
            }

            if (m_obj == null)
            {
                Engine.Utility.Log.Error("OnCreateRenderObj is null pos is " + pos);
                return;
            }

            obj.SetLayer(m_nLayer);

            for (int i = 0; i < m_lstSuitData.Count; ++i)
            {
                if (m_lstSuitData[i] == null)
                {
                    continue;
                }

                if (m_lstSuitData[i].info.pos == pos)
                {
                    m_obj.AddLinkObj(obj, ref m_lstSuitData[i].info.locatorName, Vector3.zero, Quaternion.identity);
                }
            }

            m_obj.Play(m_strAniName, 0, 1, m_fBlendTime, m_nLoop);
            // 回调
            if (m_CallBack != null)
            {
                m_CallBack(m_Param);
            }
        }
Exemplo n.º 3
0
        //-------------------------------------------------------------------------------------------------------
        private void OnCreateBodyEvent(Engine.IRenderObj obj, object param)
        {
            if (obj == null)
            {
                return;
            }

            m_obj = obj;

            IRenderSystem rs = RareEngine.Instance().GetRenderSystem();

            if (rs == null)
            {
                return;
            }

            //Engine.Utility.Log.Error("OnCreateBodyEvent {0}", m_obj.GetName());

            for (int i = 0; i < m_lstSuitData.Count; ++i)
            {
                if (m_lstSuitData[i] == null)
                {
                    continue;
                }

                if (m_lstSuitData[i].info.pos != SuitPos.Cloth)
                {
                    //Engine.Utility.Log.Error("Create {0}", m_lstSuitData[i].info.pos.ToString());
                    rs.CreateRenderObj(ref m_lstSuitData[i].info.modelPath, ref m_lstSuitData[i].obj, OnCreateRenderObj, m_lstSuitData[i].info.pos, TaskPriority.TaskPriority_Normal, false);
                }
            }

            if (m_lstSuitData.Count == 1 && m_lstSuitData[0].info.pos == SuitPos.Cloth)
            {
                OnCreateRenderObj(obj, SuitPos.None);
            }

            m_obj.SetLayer(m_nLayer);
        }