예제 #1
0
파일: Tilable.cs 프로젝트: wty0512/FyWorld
 /// Get the matrice of our tilable
 public Matrix4x4 GetMatrice(int graphicUID)
 {
     if (this._matrices == null || this.resetMatrices)
     {
         this._matrices     = new Dictionary <int, Matrix4x4>();
         this.resetMatrices = true;
     }
     if (!this._matrices.ContainsKey(graphicUID))
     {
         Matrix4x4 mat = Matrix4x4.identity;
         mat.SetTRS(
             new Vector3(
                 this.position.x
                 - this.def.graphics.pivot.x * this.scale.x
                 + (1f - this.scale.x) / 2f
                 , this.position.y
                 - this.def.graphics.pivot.y * this.scale.y
                 + (1f - this.scale.y) / 2f
                 , LayerUtils.Height(this.def.layer) + GraphicInstance.instances[graphicUID].priority
                 ),
             Quaternion.identity,
             this.scale
             );
         this._matrices.Add(graphicUID, mat);
     }
     return(this._matrices[graphicUID]);
 }
예제 #2
0
 private void Awake()
 {
     this.transform.position = new Vector3(0, 0, LayerUtils.Height(Layer.Stackable));
     this._tm           = this.gameObject.GetComponent <TextMeshPro>();
     this._rt           = (RectTransform)this.transform;
     this._rt.offsetMin = Vector2.zero;
     this._rt.offsetMax = Vector2.one;
     this._tm.alignment = TextAlignmentOptions.MidlineGeoAligned;
     this._tm.fontStyle = FontStyles.Bold;
     this._tm.fontSize  = 4;
 }