Ejemplo n.º 1
0
 //todo 动画分组和状态机
 public override void OnAwake()
 {
     base.OnAwake();
     sr = gameObject.GetComponent <SpriteRender>();
     if (sr == null)//如果没有sr,直接关闭组件
     {
         Enable = false;
     }
 }
Ejemplo n.º 2
0
        public void SliceImage(int _row, int _line, int fpi)
        {
            sr             = gameObject.GetComponent <SpriteRender>();
            row            = _row;
            line           = _line;
            framesPerImage = fpi;
            int Slice_x = sr.Sprite.Width / row;
            int Slice_y = sr.Sprite.Height / line;

            for (int i = 0; i < row; i++)
            {
                for (int j = 0; j < line; j++)
                {
                    RectList.Add(new Rectangle(j * Slice_x, i * Slice_y, Slice_x, Slice_y));
                }
            }
        }