Exemplo n.º 1
0
        /// <summary>
        /// 为Sprite对象添加冲突检测的支持
        /// </summary>
        public void AddIntersectSupport()
        {
            mSupportIntersectDect = true;

            Color[] textureData = new Color[mTexture.Width * mTexture.Height];
            mTextureData = new bool[mTexture.Width * mTexture.Height];
            mTexture.GetData(textureData);
            for (int i = 0; i < textureData.Length; i++)
            {
                if (textureData[i].A >= SpriteBorder.minBlockAlpha)
                {
                    mTextureData[i] = true;
                }
                else
                {
                    mTextureData[i] = false;
                }
            }
            mBorder = new SpriteBorder(mTexture);
        }
Exemplo n.º 2
0
 /// <summary>
 /// 检查贴图的是否能建立边界,如果建立边界失败,将抛出异常。成功时则返回所建的边界。
 /// 在检测贴图是否能被正常的建立边界的情况下使用。
 /// </summary>
 /// <param name="tex"></param>
 /// <param name="borderMap">建立边界成功时返回结果</param>
 public static void CheckBorder(Texture2D tex, out SpriteBorder.BorderMap borderMap)
 {
     SpriteBorder border = new SpriteBorder(tex, out borderMap);
 }
Exemplo n.º 3
0
        /// <summary>
        /// 为Sprite对象添加冲突检测的支持
        /// </summary>
        public void AddIntersectSupport ()
        {
            mSupportIntersectDect = true;

            Color[] textureData = new Color[mTexture.Width * mTexture.Height];
            mTextureData = new bool[mTexture.Width * mTexture.Height];
            mTexture.GetData( textureData );
            for (int i = 0; i < textureData.Length; i++)
            {
                if (textureData[i].A >= SpriteBorder.minBlockAlpha)
                    mTextureData[i] = true;
                else
                    mTextureData[i] = false;
            }
            mBorder = new SpriteBorder( mTexture );
        }
Exemplo n.º 4
0
 /// <summary>
 /// 检查贴图的是否能建立边界,如果建立边界失败,将抛出异常。成功时则返回所建的边界。
 /// 在检测贴图是否能被正常的建立边界的情况下使用。
 /// </summary>
 /// <param name="tex"></param>
 /// <param name="borderMap">建立边界成功时返回结果</param>
 public static void CheckBorder ( Texture2D tex, out SpriteBorder.BorderMap borderMap )
 {
     SpriteBorder border = new SpriteBorder( tex, out borderMap );
 }
Exemplo n.º 5
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="curPoint"></param>
 /// <param name="prePoint"></param>
 /// <param name="borderMap"></param>
 public BorderBulidException ( Point curPoint, Point prePoint, SpriteBorder.BorderMap borderMap )
 {
     this.curPoint = curPoint;
     this.prePoint = prePoint;
     this.borderMap = borderMap;
 }
Exemplo n.º 6
0
 /// <summary>
 /// 构造指定贴图的边界,为了测试,返回borderMap
 /// </summary>
 /// <param name="tex"></param>
 /// <param name="borderMap"></param>
 public SpriteBorder ( Texture2D tex, out SpriteBorder.BorderMap borderMap )
     : this( tex )
 {
     borderMap = this.borderMap;
 }