// スプライトに頂点カラーをセットする. public void setVertexColorToSprite(Sprite2DControl sprite, Color color) { MeshRenderer mesh_render = sprite.GetComponent <MeshRenderer>(); MeshFilter mesh_filter = sprite.GetComponent <MeshFilter>(); int div_count = sprite.getDivCount(); Color[] colors = new Color[div_count * div_count]; foreach (var i in System.Linq.Enumerable.Range(0, div_count * div_count)) { colors[i] = color; } mesh_filter.mesh.colors = colors; mesh_render.enabled = false; mesh_render.enabled = true; }
// 스프라이트에 정점 색을 설정한다. public void setVertexColorToSprite(Sprite2DControl sprite, Color color) { MeshRenderer mesh_render = sprite.GetComponent<MeshRenderer>(); MeshFilter mesh_filter = sprite.GetComponent<MeshFilter>(); int div_count = sprite.getDivCount(); Color[] colors = new Color[div_count*div_count]; foreach(var i in System.Linq.Enumerable.Range(0, div_count*div_count)) { colors[i] = color; } mesh_filter.mesh.colors = colors; mesh_render.enabled = false; mesh_render.enabled = true; }
// 스프라이트 크기를 설정한다. public void setSizeToSprite(Sprite2DControl sprite, Vector2 size) { sprite.internalSetSize(size); Vector3[] positions = this.calcVertexPositions(sprite.getSize().x, sprite.getSize().y, sprite.getDivCount()); this.setVertexPositionsToSprite(sprite, positions); }
// スプライトのサイズをセットする. public void setSizeToSprite(Sprite2DControl sprite, Vector2 size) { sprite.internalSetSize(size); Vector3[] positions = this.calcVertexPositions(sprite.getSize().x, sprite.getSize().y, sprite.getDivCount()); this.setVertexPositionsToSprite(sprite, positions); }