예제 #1
0
        /// <summary>
        /// Sets model from havok to render component of this entity.
        /// </summary>
        public void SetDataFromHavok(HkdBreakableShape shape)
        {
            ProfilerShort.Begin("FP.SetDataFromHavok");
            Shape = shape;
            Shape.AddReference();
            if (Render != null)
            {
                if (shape.IsCompound() || string.IsNullOrEmpty(shape.Name))
                {
                    shape.GetChildren(m_shapeInfos);
                    Debug.Assert(m_shapeInfos.Count > 0);
                    foreach (var shapeInstanceInfo in m_shapeInfos)
                    {
                        //System.Diagnostics.Debug.Assert(shapeInstanceInfo.IsValid(), "Invalid shapeInstanceInfo!");
                        if (shapeInstanceInfo.IsValid())
                        {
                            Render.AddPiece(shapeInstanceInfo.ShapeName, shapeInstanceInfo.GetTransform());
                        }
                    }

                    m_shapeInfos.Clear();
                }
                else
                {
                    Render.AddPiece(shape.Name, Matrix.Identity);
                }
            }
            ProfilerShort.End();

            m_hitPoints = Shape.Volume * 100;
        }
예제 #2
0
        /// <summary>
        /// Sets model from havok to render component of this entity.
        /// </summary>
        public void SetDataFromHavok(HkdBreakableShape shape)
        {
            ProfilerShort.Begin("FP.SetDataFromHavok");
            Shape = shape;
            Shape.AddReference();
            if (Render != null)
            {
                if (shape.IsCompound() || string.IsNullOrEmpty(shape.Name))
                {
                    shape.GetChildren(m_shapeInfos);
                    Debug.Assert(m_shapeInfos.Count > 0);
                    foreach (var shapeInstanceInfo in m_shapeInfos)
                    {
                        //System.Diagnostics.Debug.Assert(shapeInstanceInfo.IsValid(), "Invalid shapeInstanceInfo!");
                        if (shapeInstanceInfo.IsValid())
                        {
                            Render.AddPiece(shapeInstanceInfo.ShapeName, shapeInstanceInfo.GetTransform());
                        }
                    }

                    m_shapeInfos.Clear();
                }
                else
                    Render.AddPiece(shape.Name, Matrix.Identity);
            }
            ProfilerShort.End();

            m_hitPoints = Shape.Volume * 100;
        }