Esempio n. 1
0
        public FaceMatInfo GetFaceMatInfo(int index)
        {
            FaceMatInfo info = new FaceMatInfo();

            if ((index >= 0) && (index < this.textures.Length))
            {
                info.texture = this.textures[index];
                info.tile    = new Vector2(1f, 1f);
                info.offset  = Vector2.zero;
            }
            return(info);
        }
Esempio n. 2
0
 public void SetFacePartIndex(int index)
 {
     if ((this._faceMatInfoProvider != null) && (this._facePartRenderer != null))
     {
         FaceMatInfo info = (index != 0) ? this._faceMatInfoProvider.GetFaceMatInfo(index - 1) : this._originFaceMatInfo;
         if (info.valid)
         {
             this._facePartRenderer.material.mainTexture       = info.texture;
             this._facePartRenderer.material.mainTextureScale  = info.tile;
             this._facePartRenderer.material.mainTextureOffset = info.offset;
         }
     }
 }
Esempio n. 3
0
        public FaceMatInfo GetFaceMatInfo(int index)
        {
            if ((index < 0) || (index >= this.items.Length))
            {
                return(new FaceMatInfo());
            }
            FaceMatInfo info = new FaceMatInfo();
            Texture2D   item = Resources.Load <Texture2D>(string.Format("{0}/{1}", this.basePath, this.items[index].textureName));

            if (!this._texturesToUnload.Contains(item))
            {
                this._texturesToUnload.Add(item);
            }
            info.texture = item;
            this.CalcTileAndOffset(this.items[index].rect, out info.tile, out info.offset);
            return(info);
        }
Esempio n. 4
0
        public void Init(IFaceMatInfoProvider provider, Renderer part)
        {
            this._faceMatInfoProvider = provider;
            this._facePartRenderer    = part;
            FaceMatInfo info = new FaceMatInfo {
                texture = part.material.mainTexture as Texture2D,
                tile    = part.material.mainTextureScale,
                offset  = part.material.mainTextureOffset
            };

            this._originFaceMatInfo = info;
            string[] matInfoNames = provider.GetMatInfoNames();
            this._frameNames    = new string[matInfoNames.Length + 1];
            this._frameNames[0] = "origin";
            int index  = 0;
            int length = matInfoNames.Length;

            while (index < length)
            {
                this._frameNames[index + 1] = matInfoNames[index];
                index++;
            }
        }