当前位置: 首页 > news >正文

Unity3D仿星露谷物语开发60之定制角色其他部位

1、目标

上一篇中定制了角色的衬衫、手臂。

本篇中将定制角色其他部位的图形,包括:裤子、发型、皮肤、帽子等。

2、定制裤子

(1)修改ApplyCharacterCustomisation.cs脚本

我们需要设置一个输入框选择裤子的颜色。

 // Select Trouser Color[SerializeField] private Color inputTrouserColor = Color.blue;

 Color字段序列化之后,点击就会在编辑器中弹出一个颜色选择器。

目前角色的裤子颜色,基本上都是白色和灰色的,我们要做的是取那个被选中的颜色,在这些裤子上层绘制新的颜色。

添加新的处理方法:

添加如下方法:

    private void ProcessTrousers(){// Get trouser pixels to recolorColor[] farmerTrouserPixels = farmerBaseTexture.GetPixels(288, 0, 96, farmerBaseTexture.height);// Change trouser colorsTintPixelColors(farmerTrouserPixels, inputTrouserColor);// Set changed trouser pixelsfarmerBaseCustomised.SetPixels(288, 0, 96, farmerBaseTexture.height, farmerTrouserPixels);// Apply texture changesfarmerBaseCustomised.Apply();}private void TintPixelColors(Color[] basePixelArray, Color tintColor){// Loop through pixels to tintfor(int i = 0; i < basePixelArray.Length; i++){basePixelArray[i].r = basePixelArray[i].r * tintColor.r;basePixelArray[i].g = basePixelArray[i].g * tintColor.g;basePixelArray[i].b = basePixelArray[i].b * tintColor.b;}}

为了得到新的像素,我们将基础像素和色调颜色相乘。

在MergeCustomisations方法中,将farmerBaseTexture修改为farmerBaseCustomised。

(2)游戏效果

运行游戏后,查看以下文件,可以看到精灵表中裤子都换成了蓝色。

选择黄色裤子后,可以看到角色的裤子更新了。

3、定制发型

(1)修改ApplyCharacterCustomisation.cs脚本

添加1个输入:

在下面可以看到所有的发型信息:

这些发型没有颜色,只是白色和灰色的阴影。这里面有2种(列)发型,每种发型有3个方向的发型。

添加1个输出:

添加输入项:

添加发型的维度信息:

添加处理发型的方法:

添加处理方法:

    private void ProcessHair(){// Create Selected Hair TextureAddHairToTexture(inputHairStyleNo);// Get hair pixels to recolorColor[] farmerSelectedHairPixels = hairCustomised.GetPixels();// Tint hair pixelsTintPixelColors(farmerSelectedHairPixels, inputHairColor);hairCustomised.SetPixels(farmerSelectedHairPixels);hairCustomised.Apply();}private void AddHairToTexture(int hairStyleNo){// Calculate coordinates for hair pixelsint y = (hairStyleNo / hairStylesInSpriteWidth) * hairTextureHeight;int x = (hairStyleNo % hairStylesInSpriteWidth) * hairTextureWidth;// Get hair pixelsColor[] hairPixels = hairBaseTexture.GetPixels(x, y, hairTextureWidth, hairTextureHeight);// Apply selected hair pixels to texturehairCustomised.SetPixels(hairPixels);hairCustomised.Apply();}

(2)配置Player对象

配置CharacterCustomiser对象。

程序会从assets -> Sprites -> Output Textures中读取数据(真实有用,而不仅仅为了展示效果) 

反选hat避免遮挡发型。

(3)游戏效果

运行游戏,可以看到红色的新发型。

4、定制肤色

(1)修改ApplyCharacterCustomisation.cs脚本

定义要替换的皮肤颜色:

   // Target skin colours for color replacementprivate Color32 skinTargetColor1 = new Color32(145, 117, 90, 255); // darkestprivate Color32 skinTargetColor2 = new Color32(204, 155, 108, 255); // next darkestprivate Color32 skinTargetColor3 = new Color32(207, 166, 128, 255); // next darkestprivate Color32 skinTargetColor4 = new Color32(238, 195, 154, 255); // lightest

这4个颜色对应脸部、手掌上的颜色如下:

   

后面会用新定义的颜色来代替上面这些颜色。

增加新的函数如下:

    private void ProcessSkin(){// Get skin pixels to recolorColor[] farmerPixelsToRecolor = farmerBaseCustomised.GetPixels(0, 0, 288, farmerBaseTexture.height);// Populate Skin Color Swap ListPopulateSkinColorSwapList(inputSkinType);// Change skin colorsChangePixelColors(farmerPixelsToRecolor, colorSwapList);// Set recoloured pixelsfarmerBaseCustomised.SetPixels(0, 0, 288, farmerBaseTexture.height, farmerPixelsToRecolor);// Apply texture changesfarmerBaseCustomised.Apply();}private void PopulateSkinColorSwapList(int skinType){// Clear color swap listcolorSwapList.Clear();// Skin replacement colors//Switch on skin typeswitch(skinType){case 0:colorSwapList.Add(new colorSwap(skinTargetColor1, skinTargetColor1));colorSwapList.Add(new colorSwap(skinTargetColor2, skinTargetColor2));colorSwapList.Add(new colorSwap(skinTargetColor3, skinTargetColor3));colorSwapList.Add(new colorSwap(skinTargetColor4, skinTargetColor4));break;case 1:colorSwapList.Add(new colorSwap(skinTargetColor1, new Color32(187, 157, 128, 255)));colorSwapList.Add(new colorSwap(skinTargetColor2, new Color32(231, 187, 144, 255)));colorSwapList.Add(new colorSwap(skinTargetColor3, new Color32(221, 186, 154, 255)));colorSwapList.Add(new colorSwap(skinTargetColor4, new Color32(213, 189, 167, 255)));break;case 2:colorSwapList.Add(new colorSwap(skinTargetColor1, new Color32(105, 69, 2, 255)));colorSwapList.Add(new colorSwap(skinTargetColor2, new Color32(128, 87, 12, 255)));colorSwapList.Add(new colorSwap(skinTargetColor3, new Color32(145, 103, 26, 255)));colorSwapList.Add(new colorSwap(skinTargetColor4, new Color32(161, 114, 25, 255)));break;case 3:colorSwapList.Add(new colorSwap(skinTargetColor1, new Color32(151, 132, 0, 255)));colorSwapList.Add(new colorSwap(skinTargetColor2, new Color32(187, 166, 15, 255)));colorSwapList.Add(new colorSwap(skinTargetColor3, new Color32(209, 188, 39, 255)));colorSwapList.Add(new colorSwap(skinTargetColor4, new Color32(211, 199, 112, 255)));break;default:colorSwapList.Add(new colorSwap(skinTargetColor1, skinTargetColor1));colorSwapList.Add(new colorSwap(skinTargetColor2, skinTargetColor2));colorSwapList.Add(new colorSwap(skinTargetColor3, skinTargetColor3));colorSwapList.Add(new colorSwap(skinTargetColor4, skinTargetColor4));break;}}

(2)游戏效果

理论上脸部要发生颜色变化,实际上脸部颜色没有发生变化,尝试了修改skinTargetColor1~4也无果。

5、定制帽子

目前角色使用到的帽子的精灵图(output目录下)位于:

输入的帽子的精灵图位于:

目前只有一种帽子,此时构造2个选择:0没有帽子,1有帽子。

编写ApplyCharacterCustomisation.cs脚本:

    private void ProcessHat(){// Create Selected Hat TextureAddHatToTexture(inputHatStyleNo);}private void AddHatToTexture(int hatStyleNo){// Calculate coordinates for hat pixelsint y = (hatStyleNo / hatStylesInSpriteWidth) * hatTextureHeight;int x = (hatStyleNo % hatStylesInSpriteWidth) * hatTextureWidth;// Get hat pixelsColor[] hatPixels = hatsBaseTexture.GetPixels(x, y, hatTextureWidth, hatTextureHeight);// Apply selected hat pixels to texturehatsCustomised.SetPixels(hatPixels);hatsCustomised.Apply();}

配置CharacterCustomiser的信息:

运行游戏:

Select Hat Style=0时没有帽子:

Select Hat Style=1时有帽子:

6、定制角色装饰

目标:用户选择不同的装饰(0没有,1眼镜,2胡子)。

下面可以看到装饰信息:

第一个位置是空的,下一个位置为眼镜,再下一个位置是胡子。并且只有正面和侧面的图片。

 private void ProcessAdornments(){// Initialise body adornments offset arraybodyAdornmentsOffsetArray = new Vector2Int[bodyColumns, bodyRows];// Populate body adornments offset arrayPopulateBodyAdornmentsOffsetArray();// Create Selected Adornments TextureAddAdornmentsToTexture(inputAdornmentsStyleNo);// Create new adornments base texturefarmerBaseAdornmentsUpdated = new Texture2D(farmerBaseTexture.width, farmerBaseTexture.height);farmerBaseAdornmentsUpdated.filterMode = FilterMode.Point;// Set adornments base texture to transparentSetTextureToTransparent(farmerBaseAdornmentsUpdated);ApplyAdornmentsTextureToBase();}private void AddAdornmentsToTexture(int adornmentsStyleNo){// Create adornment textureselectedAdornment = new Texture2D(adornmentsTextureWidth, adornmentsTextureHeight);selectedAdornment.filterMode = FilterMode.Point;// Calculate coordinates for adornments pixelsint y = (adornmentsStyleNo / adornmentsStylesInSpriteWidth) * adornmentsTextureHeight;int x = (adornmentsStyleNo % adornmentsStylesInSpriteWidth) * adornmentsTextureWidth;// Get adornments pixelsColor[] adornmentsPixels = adornmentsBaseTexture.GetPixels(x, y, adornmentsTextureWidth, adornmentsTextureHeight);// Apply selected adornments pixels to textureselectedAdornment.SetPixels(adornmentsPixels);selectedAdornment.Apply();  }private void ApplyAdornmentsTextureToBase(){Color[] frontAdornmentsPixels;Color[] rightAdornmentsPixels;frontAdornmentsPixels = selectedAdornment.GetPixels(0, adornmentsSpriteHeight * 1, adornmentsSpriteWidth, adornmentsSpriteHeight);rightAdornmentsPixels = selectedAdornment.GetPixels(0, adornmentsSpriteHeight * 0, adornmentsSpriteWidth, adornmentsSpriteHeight);// Loop through base texture and apply adornments pixelsfor(int x = 0; x < bodyColumns; x++){for(int y = 0; y < bodyRows; y++){int pixelX = x * farmerSpriteWidth;int pixelY = y * farmerSpriteHeight;if (bodyAdornmentsOffsetArray[x, y] != null){pixelX += bodyAdornmentsOffsetArray[x, y].x;pixelY += bodyAdornmentsOffsetArray[x, y].y;}// Switch on facing directionswitch(bodyFacingArray[x, y]){case Facing.none:break;case Facing.front:// Populate front adornments pixelsfarmerBaseAdornmentsUpdated.SetPixels(pixelX, pixelY, adornmentsSpriteWidth, adornmentsSpriteHeight, frontAdornmentsPixels);break;case Facing.right:// Populate right adornments pixelsfarmerBaseAdornmentsUpdated.SetPixels(pixelX, pixelY, adornmentsSpriteWidth, adornmentsSpriteHeight, rightAdornmentsPixels);break;default:break;}}}// Apply adornments texture pixelsfarmerBaseAdornmentsUpdated.Apply();}

ApplyCharacterCustomisation.cs的完整代码如下:

using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;[System.Serializable]
public class colorSwap
{public Color fromColor;public Color toColor;public colorSwap(Color fromColor, Color toColor){this.fromColor = fromColor;this.toColor = toColor;}
}public class ApplyCharacterCustomisation : MonoBehaviour
{// Input Textures[Header("Base Textures")][SerializeField] private Texture2D maleFarmerBaseTexture = null;[SerializeField] private Texture2D femaleFarmerBaseTexture = null;[SerializeField] private Texture2D shirtsBaseTexture = null;[SerializeField] private Texture2D hairBaseTexture = null;[SerializeField] private Texture2D hatsBaseTexture = null;[SerializeField] private Texture2D adornmentsBaseTexture = null;private Texture2D farmerBaseTexture;// Created Textures[Header("OutputBase Texture To Be Used For Animation")][SerializeField] private Texture2D farmerBaseCustomised = null;[SerializeField] private Texture2D hairCustomised = null;[SerializeField] private Texture2D hatsCustomised = null;private Texture2D farmerBaseShirtsUpdated;private Texture2D selectedShirt;private Texture2D farmerBaseAdornmentsUpdated;private Texture2D selectedAdornment;// Select Shirt style[Header("Select Shirt Style")][Range(0, 1)]   // 红色衬衫或者绿色衬衫[SerializeField] private int inputShirtStyleNo = 0;// Select Hair Style[Header("Select Hair Style")][Range(0, 2)][SerializeField] private int inputHairStyleNo = 0;// Select Hat Style[Header("Select Hat Style")][Range(0, 1)][SerializeField] private int inputHatStyleNo = 0;// Select Adornments Style[Header("Select Adornments Style")][Range(0, 2)][SerializeField] private int inputAdornmentsStyleNo = 0;// Select Skin Type[Header("Select Skin Type")][Range(0, 3)][SerializeField] private int inputSkinType = 0;// Select Hair Color[SerializeField] private Color inputHairColor = Color.black;// Selecct Sex[Header("Select Sex:0=Male, 1=female")][Range(0, 1)][SerializeField] private int inputSex = 0;// Select Trouser Color[SerializeField] private Color inputTrouserColor = Color.blue;private Facing[,] bodyFacingArray;private Vector2Int[,] bodyShirtOffsetArray;private Vector2Int[,] bodyAdornmentsOffsetArray;// 定义精灵表的维度信息private int bodyRows = 21;private int bodyColumns = 6;private int farmerSpriteWidth = 16;private int farmerSpriteHeight = 32;private int shirtTextureWidth = 9;private int shirtTextureHeight = 36;private int shirtSpriteWidth = 9;private int shirtSpriteHeight = 9;private int shirtStylesInSpriteWidth = 16;  // 纹理可以容纳衬衫的件数private int hairTextureWidth = 16;private int hairTextureHeight = 96;private int hairStylesInSpriteWidth = 8;  // 发型的最多数量private int hatTextureWidth = 20;private int hatTextureHeight = 80; // output中的hat的texture就是20*80大小private int hatStylesInSpriteWidth = 12; // 帽子的最多数量private int adornmentsTextureWidth = 16;private int adornmentsTextureHeight = 32;private int adornmentsStylesInSpriteWidth = 8;private int adornmentsSpriteWidth = 16;private int adornmentsSpriteHeight = 16;// 颜色交换列表private List<colorSwap> colorSwapList;// Target arm colours for color replacementprivate Color32 armTargetColor1 = new Color32(77, 13, 13, 255); // darkestprivate Color32 armTargetColor2 = new Color32(138, 41, 41, 255); // next darkestprivate Color32 armTargetColor3 = new Color32(172, 50, 50, 255); // lightest// Target skin colours for color replacementprivate Color32 skinTargetColor1 = new Color32(145, 117, 90, 255); // darkestprivate Color32 skinTargetColor2 = new Color32(204, 155, 108, 255); // next darkestprivate Color32 skinTargetColor3 = new Color32(207, 166, 128, 255); // next darkestprivate Color32 skinTargetColor4 = new Color32(238, 195, 154, 255); // lightestprivate void Awake(){// Initialise color swap listcolorSwapList = new List<colorSwap>();// Process CustomisationProcessCustomisation();}private void ProcessCustomisation(){ProcessGender();ProcessShirt();ProcessArms();ProcessTrousers();ProcessHair();ProcessSkin();ProcessHat();ProcessAdornments();MergeCustomisations();}private void ProcessGender(){// Set base spritesheet by genderif(inputSex == 0){farmerBaseTexture = maleFarmerBaseTexture;}else if(inputSex == 1){farmerBaseTexture = femaleFarmerBaseTexture;}// Get base pixelsColor[] farmerBasePixels = farmerBaseTexture.GetPixels();// Set changed base pixelsfarmerBaseCustomised.SetPixels(farmerBasePixels);farmerBaseCustomised.Apply();}private void ProcessShirt(){// Initialise body facing shirt arraybodyFacingArray = new Facing[bodyColumns, bodyRows];// Populate body facing shirt arrayPopulateBodyFacingArray();// Initialise body shirt offset arraybodyShirtOffsetArray = new Vector2Int[bodyColumns, bodyRows];// Populate body shirt offset arrayPopulateBodyShirtOffsetArray();// Create Selected Shirt TextureAddShirtToTexture(inputShirtStyleNo);// Apply shirt texture to baseApplyShirtTextureToBase();}private void ProcessArms(){// Get arm pixels to recolorColor[] farmerPixelsToRecolor = farmerBaseTexture.GetPixels(0, 0, 288, farmerBaseTexture.height);// Populate arm color swap listPopulateArmColorSwapList();// Change arm colorsChangePixelColors(farmerPixelsToRecolor, colorSwapList);// Set recolored pixelsfarmerBaseCustomised.SetPixels(0, 0, 288, farmerBaseTexture.height, farmerPixelsToRecolor);// Apply texture changesfarmerBaseCustomised.Apply();}private void ProcessTrousers(){// Get trouser pixels to recolorColor[] farmerTrouserPixels = farmerBaseTexture.GetPixels(288, 0, 96, farmerBaseTexture.height);// Change trouser colorsTintPixelColors(farmerTrouserPixels, inputTrouserColor);// Set changed trouser pixelsfarmerBaseCustomised.SetPixels(288, 0, 96, farmerBaseTexture.height, farmerTrouserPixels);// Apply texture changesfarmerBaseCustomised.Apply();}private void ProcessHair(){// Create Selected Hair TextureAddHairToTexture(inputHairStyleNo);// Get hair pixels to recolorColor[] farmerSelectedHairPixels = hairCustomised.GetPixels();// Tint hair pixelsTintPixelColors(farmerSelectedHairPixels, inputHairColor);hairCustomised.SetPixels(farmerSelectedHairPixels);hairCustomised.Apply();}private void ProcessSkin(){// Get skin pixels to recolorColor[] farmerPixelsToRecolor = farmerBaseCustomised.GetPixels(0, 0, 288, farmerBaseTexture.height);// Populate Skin Color Swap ListPopulateSkinColorSwapList(inputSkinType);// Change skin colorsChangePixelColors(farmerPixelsToRecolor, colorSwapList);// Set recoloured pixelsfarmerBaseCustomised.SetPixels(0, 0, 288, farmerBaseTexture.height, farmerPixelsToRecolor);// Apply texture changesfarmerBaseCustomised.Apply();}private void ProcessHat(){// Create Selected Hat TextureAddHatToTexture(inputHatStyleNo);}private void ProcessAdornments(){// Initialise body adornments offset arraybodyAdornmentsOffsetArray = new Vector2Int[bodyColumns, bodyRows];// Populate body adornments offset arrayPopulateBodyAdornmentsOffsetArray();// Create Selected Adornments TextureAddAdornmentsToTexture(inputAdornmentsStyleNo);// Create new adornments base texturefarmerBaseAdornmentsUpdated = new Texture2D(farmerBaseTexture.width, farmerBaseTexture.height);farmerBaseAdornmentsUpdated.filterMode = FilterMode.Point;// Set adornments base texture to transparentSetTextureToTransparent(farmerBaseAdornmentsUpdated);ApplyAdornmentsTextureToBase();}private void AddAdornmentsToTexture(int adornmentsStyleNo){// Create adornment textureselectedAdornment = new Texture2D(adornmentsTextureWidth, adornmentsTextureHeight);selectedAdornment.filterMode = FilterMode.Point;// Calculate coordinates for adornments pixelsint y = (adornmentsStyleNo / adornmentsStylesInSpriteWidth) * adornmentsTextureHeight;int x = (adornmentsStyleNo % adornmentsStylesInSpriteWidth) * adornmentsTextureWidth;// Get adornments pixelsColor[] adornmentsPixels = adornmentsBaseTexture.GetPixels(x, y, adornmentsTextureWidth, adornmentsTextureHeight);// Apply selected adornments pixels to textureselectedAdornment.SetPixels(adornmentsPixels);selectedAdornment.Apply();  }private void ApplyAdornmentsTextureToBase(){Color[] frontAdornmentsPixels;Color[] rightAdornmentsPixels;frontAdornmentsPixels = selectedAdornment.GetPixels(0, adornmentsSpriteHeight * 1, adornmentsSpriteWidth, adornmentsSpriteHeight);rightAdornmentsPixels = selectedAdornment.GetPixels(0, adornmentsSpriteHeight * 0, adornmentsSpriteWidth, adornmentsSpriteHeight);// Loop through base texture and apply adornments pixelsfor(int x = 0; x < bodyColumns; x++){for(int y = 0; y < bodyRows; y++){int pixelX = x * farmerSpriteWidth;int pixelY = y * farmerSpriteHeight;if (bodyAdornmentsOffsetArray[x, y] != null){pixelX += bodyAdornmentsOffsetArray[x, y].x;pixelY += bodyAdornmentsOffsetArray[x, y].y;}// Switch on facing directionswitch(bodyFacingArray[x, y]){case Facing.none:break;case Facing.front:// Populate front adornments pixelsfarmerBaseAdornmentsUpdated.SetPixels(pixelX, pixelY, adornmentsSpriteWidth, adornmentsSpriteHeight, frontAdornmentsPixels);break;case Facing.right:// Populate right adornments pixelsfarmerBaseAdornmentsUpdated.SetPixels(pixelX, pixelY, adornmentsSpriteWidth, adornmentsSpriteHeight, rightAdornmentsPixels);break;default:break;}}}// Apply adornments texture pixelsfarmerBaseAdornmentsUpdated.Apply();}private void AddHatToTexture(int hatStyleNo){// Calculate coordinates for hat pixelsint y = (hatStyleNo / hatStylesInSpriteWidth) * hatTextureHeight;int x = (hatStyleNo % hatStylesInSpriteWidth) * hatTextureWidth;// Get hat pixelsColor[] hatPixels = hatsBaseTexture.GetPixels(x, y, hatTextureWidth, hatTextureHeight);// Apply selected hat pixels to texturehatsCustomised.SetPixels(hatPixels);hatsCustomised.Apply();}private void PopulateSkinColorSwapList(int skinType){// Clear color swap listcolorSwapList.Clear();// Skin replacement colors//Switch on skin typeswitch(skinType){case 0:colorSwapList.Add(new colorSwap(skinTargetColor1, skinTargetColor1));colorSwapList.Add(new colorSwap(skinTargetColor2, skinTargetColor2));colorSwapList.Add(new colorSwap(skinTargetColor3, skinTargetColor3));colorSwapList.Add(new colorSwap(skinTargetColor4, skinTargetColor4));break;case 1:colorSwapList.Add(new colorSwap(skinTargetColor1, new Color32(187, 157, 128, 255)));colorSwapList.Add(new colorSwap(skinTargetColor2, new Color32(231, 187, 144, 255)));colorSwapList.Add(new colorSwap(skinTargetColor3, new Color32(221, 186, 154, 255)));colorSwapList.Add(new colorSwap(skinTargetColor4, new Color32(213, 189, 167, 255)));break;case 2:colorSwapList.Add(new colorSwap(skinTargetColor1, new Color32(105, 69, 2, 255)));colorSwapList.Add(new colorSwap(skinTargetColor2, new Color32(128, 87, 12, 255)));colorSwapList.Add(new colorSwap(skinTargetColor3, new Color32(145, 103, 26, 255)));colorSwapList.Add(new colorSwap(skinTargetColor4, new Color32(161, 114, 25, 255)));break;case 3:colorSwapList.Add(new colorSwap(skinTargetColor1, new Color32(151, 132, 0, 255)));colorSwapList.Add(new colorSwap(skinTargetColor2, new Color32(187, 166, 15, 255)));colorSwapList.Add(new colorSwap(skinTargetColor3, new Color32(209, 188, 39, 255)));colorSwapList.Add(new colorSwap(skinTargetColor4, new Color32(211, 199, 112, 255)));break;default:colorSwapList.Add(new colorSwap(skinTargetColor1, skinTargetColor1));colorSwapList.Add(new colorSwap(skinTargetColor2, skinTargetColor2));colorSwapList.Add(new colorSwap(skinTargetColor3, skinTargetColor3));colorSwapList.Add(new colorSwap(skinTargetColor4, skinTargetColor4));break;}}private void AddHairToTexture(int hairStyleNo){// Calculate coordinates for hair pixelsint y = (hairStyleNo / hairStylesInSpriteWidth) * hairTextureHeight;int x = (hairStyleNo % hairStylesInSpriteWidth) * hairTextureWidth;// Get hair pixelsColor[] hairPixels = hairBaseTexture.GetPixels(x, y, hairTextureWidth, hairTextureHeight);// Apply selected hair pixels to texturehairCustomised.SetPixels(hairPixels);hairCustomised.Apply();}private void TintPixelColors(Color[] basePixelArray, Color tintColor){// Loop through pixels to tintfor(int i = 0; i < basePixelArray.Length; i++){basePixelArray[i].r = basePixelArray[i].r * tintColor.r;basePixelArray[i].g = basePixelArray[i].g * tintColor.g;basePixelArray[i].b = basePixelArray[i].b * tintColor.b;}}private void MergeCustomisations(){// Farmer Shirt pixelsColor[] farmerShirtPixels = farmerBaseShirtsUpdated.GetPixels(0, 0, bodyColumns * farmerSpriteWidth, farmerBaseTexture.height);// Farmer Trouser PixelsColor[] farmerTrouserPixelsSelection = farmerBaseCustomised.GetPixels(288, 0, 96, farmerBaseTexture.height);// Farmer Adornments PixelsColor[] farmerAdornmentsPixels = farmerBaseAdornmentsUpdated.GetPixels(0, 0, bodyColumns * farmerSpriteWidth, farmerBaseTexture.height);// Farmer Body PixelsColor[] farmerBodyPixels = farmerBaseCustomised.GetPixels(0, 0, bodyColumns * farmerSpriteWidth, farmerBaseTexture.height);MergeColorArray(farmerBodyPixels, farmerTrouserPixelsSelection);MergeColorArray(farmerBodyPixels, farmerShirtPixels);MergeColorArray(farmerBodyPixels, farmerAdornmentsPixels);// Paste merged pixelsfarmerBaseCustomised.SetPixels(0, 0, bodyColumns * farmerSpriteWidth, farmerBaseTexture.height, farmerBodyPixels);// Apply texture changesfarmerBaseCustomised.Apply();}private void MergeColorArray(Color[] baseArray, Color[] mergeArray){for(int i = 0; i < baseArray.Length; i++){if (mergeArray[i].a > 0){// Merge array has colorif (mergeArray[i].a >= 1){// Fully replacebaseArray[i] = mergeArray[i];}else{// Interpolate colorsfloat alpha = mergeArray[i].a;baseArray[i].r += (mergeArray[i].r - baseArray[i].r) * alpha;baseArray[i].g += (mergeArray[i].g - baseArray[i].g) * alpha;baseArray[i].b += (mergeArray[i].b - baseArray[i].b) * alpha;baseArray[i].a += mergeArray[i].a;}}}}private void PopulateArmColorSwapList(){// Clear color swap listcolorSwapList.Clear();// Arms replacement colorscolorSwapList.Add(new colorSwap(armTargetColor1, selectedShirt.GetPixel(0, 7)));colorSwapList.Add(new colorSwap(armTargetColor2, selectedShirt.GetPixel(0, 6)));colorSwapList.Add(new colorSwap(armTargetColor3, selectedShirt.GetPixel(0, 5)));}private void ChangePixelColors(Color[] baseArray, List<colorSwap> colorSwapList){for(int i = 0; i < baseArray.Length; i++){// Loop through color swap listif(colorSwapList.Count > 0){for(int j = 0; j < colorSwapList.Count; j++){if (isSameColor(baseArray[i], colorSwapList[j].fromColor)){baseArray[i] = colorSwapList[j].toColor;}}}}}private bool isSameColor(Color color1, Color color2){if ((color1.r == color2.r) && (color1.g == color2.g) && (color1.b == color2.b) && (color1.a == color2.a)){return true;}else{return false;}}private void AddShirtToTexture(int shirtStyleNo){// Create shirt textureselectedShirt = new Texture2D(shirtTextureWidth, shirtTextureHeight);selectedShirt.filterMode = FilterMode.Point;// Calculate coordinates for shirt pixelsint y = (shirtStyleNo / shirtStylesInSpriteWidth) * shirtTextureHeight;int x = (shirtStyleNo % shirtStylesInSpriteWidth) * shirtTextureWidth;// Get shirts pixelsColor[] shirtPixels = shirtsBaseTexture.GetPixels(x, y, shirtTextureWidth, shirtTextureHeight);// Apply selected shirt pixels to textureselectedShirt.SetPixels(shirtPixels);selectedShirt.Apply();}private void ApplyShirtTextureToBase(){// Create new shirt base texturefarmerBaseShirtsUpdated = new Texture2D(farmerBaseTexture.width, farmerBaseTexture.height);farmerBaseShirtsUpdated.filterMode = FilterMode.Point;// Set shirt base texture to transparentSetTextureToTransparent(farmerBaseShirtsUpdated);Color[] frontShirtPixels;Color[] backShirtPixels;Color[] rightShirtPixels;frontShirtPixels = selectedShirt.GetPixels(0, shirtSpriteHeight * 3, shirtSpriteWidth, shirtSpriteHeight);backShirtPixels = selectedShirt.GetPixels(0, shirtSpriteHeight * 0, shirtSpriteWidth, shirtSpriteHeight);rightShirtPixels = selectedShirt.GetPixels(0, shirtSpriteHeight * 2, shirtSpriteWidth, shirtSpriteHeight);// Loop through base texture and apply shirt pixelsfor(int x = 0; x < bodyColumns; x++){for(int y = 0; y < bodyRows; y++){int pixelX = x * farmerSpriteWidth;int pixelY = y * farmerSpriteHeight;if (bodyShirtOffsetArray[x, y] != null){if (bodyShirtOffsetArray[x, y].x == 99 && bodyShirtOffsetArray[x, y].y == 99) // do not populate with shirtcontinue;pixelX += bodyShirtOffsetArray[x, y].x;pixelY += bodyShirtOffsetArray[x, y].y;}// Switch on facing directionswitch(bodyFacingArray[x, y]){case Facing.none:break;case Facing.front:// populate front shirt pixelsfarmerBaseShirtsUpdated.SetPixels(pixelX, pixelY, shirtSpriteWidth, shirtSpriteHeight, frontShirtPixels);break;case Facing.back:// populate back shirt pixelsfarmerBaseShirtsUpdated.SetPixels(pixelX, pixelY, shirtSpriteWidth, shirtSpriteHeight, backShirtPixels);break;case Facing.right:// populate right shirt pixelsfarmerBaseShirtsUpdated.SetPixels(pixelX, pixelY, shirtSpriteWidth, shirtSpriteHeight, rightShirtPixels);break;default:break;}}}// Apply shirt texture pixelsfarmerBaseShirtsUpdated.Apply();}private void SetTextureToTransparent(Texture2D texture2D){// fill texture with transparencyColor[] fill = new Color[texture2D.height * texture2D.width];for(int i = 0; i < fill.Length; i++){fill[i] = Color.clear;}texture2D.SetPixels(fill);}private void PopulateBodyFacingArray(){bodyFacingArray[0, 0] = Facing.none;bodyFacingArray[1, 0] = Facing.none;bodyFacingArray[2, 0] = Facing.none;bodyFacingArray[3, 0] = Facing.none;bodyFacingArray[4, 0] = Facing.none;bodyFacingArray[5, 0] = Facing.none;bodyFacingArray[0, 1] = Facing.none;bodyFacingArray[1, 1] = Facing.none;bodyFacingArray[2, 1] = Facing.none;bodyFacingArray[3, 1] = Facing.none;bodyFacingArray[4, 1] = Facing.none;bodyFacingArray[5, 1] = Facing.none;bodyFacingArray[0, 2] = Facing.none;bodyFacingArray[1, 2] = Facing.none;bodyFacingArray[2, 2] = Facing.none;bodyFacingArray[3, 2] = Facing.none;bodyFacingArray[4, 2] = Facing.none;bodyFacingArray[5, 2] = Facing.none;bodyFacingArray[0, 3] = Facing.none;bodyFacingArray[1, 3] = Facing.none;bodyFacingArray[2, 3] = Facing.none;bodyFacingArray[3, 3] = Facing.none;bodyFacingArray[4, 3] = Facing.none;bodyFacingArray[5, 3] = Facing.none;bodyFacingArray[0, 4] = Facing.none;bodyFacingArray[1, 4] = Facing.none;bodyFacingArray[2, 4] = Facing.none;bodyFacingArray[3, 4] = Facing.none;bodyFacingArray[4, 4] = Facing.none;bodyFacingArray[5, 4] = Facing.none;bodyFacingArray[0, 5] = Facing.none;bodyFacingArray[1, 5] = Facing.none;bodyFacingArray[2, 5] = Facing.none;bodyFacingArray[3, 5] = Facing.none;bodyFacingArray[4, 5] = Facing.none;bodyFacingArray[5, 5] = Facing.none;bodyFacingArray[0, 6] = Facing.none;bodyFacingArray[1, 6] = Facing.none;bodyFacingArray[2, 6] = Facing.none;bodyFacingArray[3, 6] = Facing.none;bodyFacingArray[4, 6] = Facing.none;bodyFacingArray[5, 6] = Facing.none;bodyFacingArray[0, 7] = Facing.none;bodyFacingArray[1, 7] = Facing.none;bodyFacingArray[2, 7] = Facing.none;bodyFacingArray[3, 7] = Facing.none;bodyFacingArray[4, 7] = Facing.none;bodyFacingArray[5, 7] = Facing.none;bodyFacingArray[0, 8] = Facing.none;bodyFacingArray[1, 8] = Facing.none;bodyFacingArray[2, 8] = Facing.none;bodyFacingArray[3, 8] = Facing.none;bodyFacingArray[4, 8] = Facing.none;bodyFacingArray[5, 8] = Facing.none;bodyFacingArray[0, 9] = Facing.none;bodyFacingArray[1, 9] = Facing.none;bodyFacingArray[2, 9] = Facing.none;bodyFacingArray[3, 9] = Facing.none;bodyFacingArray[4, 9] = Facing.none;bodyFacingArray[5, 9] = Facing.none;bodyFacingArray[0, 10] = Facing.back;bodyFacingArray[1, 10] = Facing.back;bodyFacingArray[2, 10] = Facing.right;bodyFacingArray[3, 10] = Facing.right;bodyFacingArray[4, 10] = Facing.right;bodyFacingArray[5, 10] = Facing.right;bodyFacingArray[0, 11] = Facing.front;bodyFacingArray[1, 11] = Facing.front;bodyFacingArray[2, 11] = Facing.front;bodyFacingArray[3, 11] = Facing.front;bodyFacingArray[4, 11] = Facing.back;bodyFacingArray[5, 11] = Facing.back;bodyFacingArray[0, 12] = Facing.back;bodyFacingArray[1, 12] = Facing.back;bodyFacingArray[2, 12] = Facing.right;bodyFacingArray[3, 12] = Facing.right;bodyFacingArray[4, 12] = Facing.right;bodyFacingArray[5, 12] = Facing.right;bodyFacingArray[0, 13] = Facing.front;bodyFacingArray[1, 13] = Facing.front;bodyFacingArray[2, 13] = Facing.front;bodyFacingArray[3, 13] = Facing.front;bodyFacingArray[4, 13] = Facing.back;bodyFacingArray[5, 13] = Facing.back;bodyFacingArray[0, 14] = Facing.back;bodyFacingArray[1, 14] = Facing.back;bodyFacingArray[2, 14] = Facing.right;bodyFacingArray[3, 14] = Facing.right;bodyFacingArray[4, 14] = Facing.right;bodyFacingArray[5, 14] = Facing.right;bodyFacingArray[0, 15] = Facing.front;bodyFacingArray[1, 15] = Facing.front;bodyFacingArray[2, 15] = Facing.front;bodyFacingArray[3, 15] = Facing.front;bodyFacingArray[4, 15] = Facing.back;bodyFacingArray[5, 15] = Facing.back;bodyFacingArray[0, 16] = Facing.back;bodyFacingArray[1, 16] = Facing.back;bodyFacingArray[2, 16] = Facing.right;bodyFacingArray[3, 16] = Facing.right;bodyFacingArray[4, 16] = Facing.right;bodyFacingArray[5, 16] = Facing.right;bodyFacingArray[0, 17] = Facing.front;bodyFacingArray[1, 17] = Facing.front;bodyFacingArray[2, 17] = Facing.front;bodyFacingArray[3, 17] = Facing.front;bodyFacingArray[4, 17] = Facing.back;bodyFacingArray[5, 17] = Facing.back;bodyFacingArray[0, 18] = Facing.back;bodyFacingArray[1, 18] = Facing.back;bodyFacingArray[2, 18] = Facing.back;bodyFacingArray[3, 18] = Facing.right;bodyFacingArray[4, 18] = Facing.right;bodyFacingArray[5, 18] = Facing.right;bodyFacingArray[0, 19] = Facing.right;bodyFacingArray[1, 19] = Facing.right;bodyFacingArray[2, 19] = Facing.right;bodyFacingArray[3, 19] = Facing.front;bodyFacingArray[4, 19] = Facing.front;bodyFacingArray[5, 19] = Facing.front;bodyFacingArray[0, 20] = Facing.front;bodyFacingArray[1, 20] = Facing.front;bodyFacingArray[2, 20] = Facing.front;bodyFacingArray[3, 20] = Facing.back;bodyFacingArray[4, 20] = Facing.back;bodyFacingArray[5, 20] = Facing.back;}private void PopulateBodyShirtOffsetArray(){bodyShirtOffsetArray[0, 0] = new Vector2Int(99, 99);bodyShirtOffsetArray[1, 0] = new Vector2Int(99, 99);bodyShirtOffsetArray[2, 0] = new Vector2Int(99, 99);bodyShirtOffsetArray[3, 0] = new Vector2Int(99, 99);bodyShirtOffsetArray[4, 0] = new Vector2Int(99, 99);bodyShirtOffsetArray[5, 0] = new Vector2Int(99, 99);bodyShirtOffsetArray[0, 1] = new Vector2Int(99, 99);bodyShirtOffsetArray[1, 1] = new Vector2Int(99, 99);bodyShirtOffsetArray[2, 1] = new Vector2Int(99, 99);bodyShirtOffsetArray[3, 1] = new Vector2Int(99, 99);bodyShirtOffsetArray[4, 1] = new Vector2Int(99, 99);bodyShirtOffsetArray[5, 1] = new Vector2Int(99, 99);bodyShirtOffsetArray[0, 2] = new Vector2Int(99, 99);bodyShirtOffsetArray[1, 2] = new Vector2Int(99, 99);bodyShirtOffsetArray[2, 2] = new Vector2Int(99, 99);bodyShirtOffsetArray[3, 2] = new Vector2Int(99, 99);bodyShirtOffsetArray[4, 2] = new Vector2Int(99, 99);bodyShirtOffsetArray[5, 2] = new Vector2Int(99, 99);bodyShirtOffsetArray[0, 3] = new Vector2Int(99, 99);bodyShirtOffsetArray[1, 3] = new Vector2Int(99, 99);bodyShirtOffsetArray[2, 3] = new Vector2Int(99, 99);bodyShirtOffsetArray[3, 3] = new Vector2Int(99, 99);bodyShirtOffsetArray[4, 3] = new Vector2Int(99, 99);bodyShirtOffsetArray[5, 3] = new Vector2Int(99, 99);bodyShirtOffsetArray[0, 4] = new Vector2Int(99, 99);bodyShirtOffsetArray[1, 4] = new Vector2Int(99, 99);bodyShirtOffsetArray[2, 4] = new Vector2Int(99, 99);bodyShirtOffsetArray[3, 4] = new Vector2Int(99, 99);bodyShirtOffsetArray[4, 4] = new Vector2Int(99, 99);bodyShirtOffsetArray[5, 4] = new Vector2Int(99, 99);bodyShirtOffsetArray[0, 5] = new Vector2Int(99, 99);bodyShirtOffsetArray[1, 5] = new Vector2Int(99, 99);bodyShirtOffsetArray[2, 5] = new Vector2Int(99, 99);bodyShirtOffsetArray[3, 5] = new Vector2Int(99, 99);bodyShirtOffsetArray[4, 5] = new Vector2Int(99, 99);bodyShirtOffsetArray[5, 5] = new Vector2Int(99, 99);bodyShirtOffsetArray[0, 6] = new Vector2Int(99, 99);bodyShirtOffsetArray[1, 6] = new Vector2Int(99, 99);bodyShirtOffsetArray[2, 6] = new Vector2Int(99, 99);bodyShirtOffsetArray[3, 6] = new Vector2Int(99, 99);bodyShirtOffsetArray[4, 6] = new Vector2Int(99, 99);bodyShirtOffsetArray[5, 6] = new Vector2Int(99, 99);bodyShirtOffsetArray[0, 7] = new Vector2Int(99, 99);bodyShirtOffsetArray[1, 7] = new Vector2Int(99, 99);bodyShirtOffsetArray[2, 7] = new Vector2Int(99, 99);bodyShirtOffsetArray[3, 7] = new Vector2Int(99, 99);bodyShirtOffsetArray[4, 7] = new Vector2Int(99, 99);bodyShirtOffsetArray[5, 7] = new Vector2Int(99, 99);bodyShirtOffsetArray[0, 8] = new Vector2Int(99, 99);bodyShirtOffsetArray[1, 8] = new Vector2Int(99, 99);bodyShirtOffsetArray[2, 8] = new Vector2Int(99, 99);bodyShirtOffsetArray[3, 8] = new Vector2Int(99, 99);bodyShirtOffsetArray[4, 8] = new Vector2Int(99, 99);bodyShirtOffsetArray[5, 8] = new Vector2Int(99, 99);bodyShirtOffsetArray[0, 9] = new Vector2Int(99, 99);bodyShirtOffsetArray[1, 9] = new Vector2Int(99, 99);bodyShirtOffsetArray[2, 9] = new Vector2Int(99, 99);bodyShirtOffsetArray[3, 9] = new Vector2Int(99, 99);bodyShirtOffsetArray[4, 9] = new Vector2Int(99, 99);bodyShirtOffsetArray[5, 9] = new Vector2Int(99, 99);bodyShirtOffsetArray[0, 10] = new Vector2Int(4, 11);bodyShirtOffsetArray[1, 10] = new Vector2Int(4, 10);bodyShirtOffsetArray[2, 10] = new Vector2Int(4, 11);bodyShirtOffsetArray[3, 10] = new Vector2Int(4, 12);bodyShirtOffsetArray[4, 10] = new Vector2Int(4, 11);bodyShirtOffsetArray[5, 10] = new Vector2Int(4, 10);bodyShirtOffsetArray[0, 11] = new Vector2Int(4, 11);bodyShirtOffsetArray[1, 11] = new Vector2Int(4, 12);bodyShirtOffsetArray[2, 11] = new Vector2Int(4, 11);bodyShirtOffsetArray[3, 11] = new Vector2Int(4, 10);bodyShirtOffsetArray[4, 11] = new Vector2Int(4, 11);bodyShirtOffsetArray[5, 11] = new Vector2Int(4, 12);bodyShirtOffsetArray[0, 12] = new Vector2Int(3, 9);bodyShirtOffsetArray[1, 12] = new Vector2Int(3, 9);bodyShirtOffsetArray[2, 12] = new Vector2Int(4, 10);bodyShirtOffsetArray[3, 12] = new Vector2Int(4, 9);bodyShirtOffsetArray[4, 12] = new Vector2Int(4, 9);bodyShirtOffsetArray[5, 12] = new Vector2Int(4, 9);bodyShirtOffsetArray[0, 13] = new Vector2Int(4, 10);bodyShirtOffsetArray[1, 13] = new Vector2Int(4, 9);bodyShirtOffsetArray[2, 13] = new Vector2Int(5, 9);bodyShirtOffsetArray[3, 13] = new Vector2Int(5, 9);bodyShirtOffsetArray[4, 13] = new Vector2Int(4, 10);bodyShirtOffsetArray[5, 13] = new Vector2Int(4, 9);bodyShirtOffsetArray[0, 14] = new Vector2Int(4, 9);bodyShirtOffsetArray[1, 14] = new Vector2Int(4, 12);bodyShirtOffsetArray[2, 14] = new Vector2Int(5, 7);bodyShirtOffsetArray[3, 14] = new Vector2Int(5, 5);bodyShirtOffsetArray[4, 14] = new Vector2Int(4, 9);bodyShirtOffsetArray[5, 14] = new Vector2Int(4, 12);bodyShirtOffsetArray[0, 15] = new Vector2Int(4, 8);bodyShirtOffsetArray[1, 15] = new Vector2Int(4, 5);bodyShirtOffsetArray[2, 15] = new Vector2Int(4, 9);bodyShirtOffsetArray[3, 15] = new Vector2Int(4, 12);bodyShirtOffsetArray[4, 15] = new Vector2Int(4, 8);bodyShirtOffsetArray[5, 15] = new Vector2Int(4, 5);bodyShirtOffsetArray[0, 16] = new Vector2Int(4, 9);bodyShirtOffsetArray[1, 16] = new Vector2Int(4, 10);bodyShirtOffsetArray[2, 16] = new Vector2Int(4, 7);bodyShirtOffsetArray[3, 16] = new Vector2Int(4, 8);bodyShirtOffsetArray[4, 16] = new Vector2Int(4, 9);bodyShirtOffsetArray[5, 16] = new Vector2Int(4, 10);bodyShirtOffsetArray[0, 17] = new Vector2Int(4, 7);bodyShirtOffsetArray[1, 17] = new Vector2Int(4, 8);bodyShirtOffsetArray[2, 17] = new Vector2Int(4, 9);bodyShirtOffsetArray[3, 17] = new Vector2Int(4, 10);bodyShirtOffsetArray[4, 17] = new Vector2Int(4, 7);bodyShirtOffsetArray[5, 17] = new Vector2Int(4, 8);bodyShirtOffsetArray[0, 18] = new Vector2Int(4, 10);bodyShirtOffsetArray[1, 18] = new Vector2Int(4, 9);bodyShirtOffsetArray[2, 18] = new Vector2Int(4, 9);bodyShirtOffsetArray[3, 18] = new Vector2Int(4, 10);bodyShirtOffsetArray[4, 18] = new Vector2Int(4, 9);bodyShirtOffsetArray[5, 18] = new Vector2Int(4, 9);bodyShirtOffsetArray[0, 19] = new Vector2Int(4, 10);bodyShirtOffsetArray[1, 19] = new Vector2Int(4, 9);bodyShirtOffsetArray[2, 19] = new Vector2Int(4, 9);bodyShirtOffsetArray[3, 19] = new Vector2Int(4, 10);bodyShirtOffsetArray[4, 19] = new Vector2Int(4, 9);bodyShirtOffsetArray[5, 19] = new Vector2Int(4, 9);bodyShirtOffsetArray[0, 20] = new Vector2Int(4, 10);bodyShirtOffsetArray[1, 20] = new Vector2Int(4, 9);bodyShirtOffsetArray[2, 20] = new Vector2Int(4, 9);bodyShirtOffsetArray[3, 20] = new Vector2Int(4, 10);bodyShirtOffsetArray[4, 20] = new Vector2Int(4, 9);bodyShirtOffsetArray[5, 20] = new Vector2Int(4, 9);}private void PopulateBodyAdornmentsOffsetArray(){bodyAdornmentsOffsetArray[0, 1] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[1, 1] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[2, 1] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[3, 1] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[4, 1] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[5, 1] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[0, 2] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[1, 2] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[2, 2] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[3, 2] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[4, 2] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[5, 2] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[0, 3] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[1, 3] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[2, 3] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[3, 3] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[4, 3] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[5, 3] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[0, 4] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[1, 4] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[2, 4] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[3, 4] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[4, 4] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[5, 4] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[0, 5] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[1, 5] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[2, 5] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[3, 5] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[4, 5] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[5, 5] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[0, 6] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[1, 6] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[2, 6] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[3, 6] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[4, 6] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[5, 6] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[0, 7] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[1, 7] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[2, 7] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[3, 7] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[4, 7] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[5, 7] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[0, 8] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[1, 8] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[2, 8] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[3, 8] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[4, 8] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[5, 8] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[0, 9] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[1, 9] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[2, 9] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[3, 9] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[4, 9] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[5, 9] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[0, 10] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[1, 10] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[2, 10] = new Vector2Int(0, 1 + 16);bodyAdornmentsOffsetArray[3, 10] = new Vector2Int(0, 2 + 16);bodyAdornmentsOffsetArray[4, 10] = new Vector2Int(0, 1 + 16);bodyAdornmentsOffsetArray[5, 10] = new Vector2Int(0, 0 + 16);bodyAdornmentsOffsetArray[0, 11] = new Vector2Int(0, 1 + 16);bodyAdornmentsOffsetArray[1, 11] = new Vector2Int(0, 2 + 16);bodyAdornmentsOffsetArray[2, 11] = new Vector2Int(0, 1 + 16);bodyAdornmentsOffsetArray[3, 11] = new Vector2Int(0, 0 + 16);bodyAdornmentsOffsetArray[4, 11] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[5, 11] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[0, 12] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[1, 12] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[2, 12] = new Vector2Int(0, 0 + 16);bodyAdornmentsOffsetArray[3, 12] = new Vector2Int(0, -1 + 16);bodyAdornmentsOffsetArray[4, 12] = new Vector2Int(0, -1 + 16);bodyAdornmentsOffsetArray[5, 12] = new Vector2Int(0, -1 + 16);bodyAdornmentsOffsetArray[0, 13] = new Vector2Int(0, 0 + 16);bodyAdornmentsOffsetArray[1, 13] = new Vector2Int(0, -1 + 16);bodyAdornmentsOffsetArray[2, 13] = new Vector2Int(1, -1 + 16);bodyAdornmentsOffsetArray[3, 13] = new Vector2Int(1, -1 + 16);bodyAdornmentsOffsetArray[4, 13] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[5, 13] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[0, 14] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[1, 14] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[2, 14] = new Vector2Int(0, -3 + 16);bodyAdornmentsOffsetArray[3, 14] = new Vector2Int(0, -5 + 16);bodyAdornmentsOffsetArray[4, 14] = new Vector2Int(0, -1 + 16);bodyAdornmentsOffsetArray[5, 14] = new Vector2Int(0, 1 + 16);bodyAdornmentsOffsetArray[0, 15] = new Vector2Int(0, -2 + 16);bodyAdornmentsOffsetArray[1, 15] = new Vector2Int(0, -5 + 16);bodyAdornmentsOffsetArray[2, 15] = new Vector2Int(0, -1 + 16);bodyAdornmentsOffsetArray[3, 15] = new Vector2Int(0, 2 + 16);bodyAdornmentsOffsetArray[4, 15] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[5, 15] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[0, 16] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[1, 16] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[2, 16] = new Vector2Int(0, -3 + 16);bodyAdornmentsOffsetArray[3, 16] = new Vector2Int(0, -2 + 16);bodyAdornmentsOffsetArray[4, 16] = new Vector2Int(0, -1 + 16);bodyAdornmentsOffsetArray[5, 16] = new Vector2Int(0, 0 + 16);bodyAdornmentsOffsetArray[0, 17] = new Vector2Int(0, -3 + 16);bodyAdornmentsOffsetArray[1, 17] = new Vector2Int(0, -2 + 16);bodyAdornmentsOffsetArray[2, 17] = new Vector2Int(0, -1 + 16);bodyAdornmentsOffsetArray[3, 17] = new Vector2Int(0, 0 + 16);bodyAdornmentsOffsetArray[4, 17] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[5, 17] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[0, 18] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[1, 18] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[2, 18] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[3, 18] = new Vector2Int(0, 0 + 16);bodyAdornmentsOffsetArray[4, 18] = new Vector2Int(0, -1 + 16);bodyAdornmentsOffsetArray[5, 18] = new Vector2Int(0, -1 + 16);bodyAdornmentsOffsetArray[0, 19] = new Vector2Int(0, 0 + 16);bodyAdornmentsOffsetArray[1, 19] = new Vector2Int(0, -1 + 16);bodyAdornmentsOffsetArray[2, 19] = new Vector2Int(0, -1 + 16);bodyAdornmentsOffsetArray[3, 19] = new Vector2Int(0, 0 + 16);bodyAdornmentsOffsetArray[4, 19] = new Vector2Int(0, -1 + 16);bodyAdornmentsOffsetArray[5, 19] = new Vector2Int(0, -1 + 16);bodyAdornmentsOffsetArray[0, 20] = new Vector2Int(0, 0 + 16);bodyAdornmentsOffsetArray[1, 20] = new Vector2Int(0, -1 + 16);bodyAdornmentsOffsetArray[2, 20] = new Vector2Int(0, -1 + 16);bodyAdornmentsOffsetArray[3, 20] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[4, 20] = new Vector2Int(99, 99);bodyAdornmentsOffsetArray[5, 20] = new Vector2Int(99, 99);}}

运行效果:

Select Adornments Style=1时:

Select Adornments Style=2时:

http://www.xdnf.cn/news/913375.html

相关文章:

  • Jpackage
  • 信号电压高,传输稳定性变强,但是传输速率下降?
  • Window Server 2019--11 虚拟专用网络
  • 软件测试python学习
  • 第十届电子技术和信息科学国际学术会议(ICETIS 2025)
  • 如何选择正确的团队交互模式:协作、服务还是促进?
  • 【普及+/提高】洛谷P2114 ——[NOI2014] 起床困难综合症
  • 耦合和内聚
  • BECKHOFF(倍福)PLC --北尔HMI ADS Symbolc 通讯
  • 电动螺丝刀-多实体拆图建模案例
  • 全球数控金属切削机床市场:现状、趋势与应对策略
  • # 从底层架构到应用实践:为何部分大模型在越狱攻击下失守?
  • 2025/6/6—halcon知识点总结
  • 高精度加减乘除
  • 艾体宝案例丨Transavia如何借助LambdaTest测试平台高效起飞?
  • 阿里联合上海AI Lab提出DMM!多个模型压缩成一个通用T2I模型!可控任意风格生成!
  • PSpice软件快速入门系列--08.如何进行PSpice AA灵敏度分析
  • 轻松备份和恢复 Android 系统 | 4 种解决方案
  • 【Linux】ls 命令详解及使用示例:列出目录中的内容
  • 【动手学MCP从0到1】2.5 MCP中的Context日志输出、进度汇报和服务端调用客户端的大模型项目实现步骤详解
  • MultipartFile
  • Date类型时间比较
  • 亚马逊跨境:亚马逊优惠券新规和促销机制大改后的定价策略
  • 代驾数据库
  • ISO 26262-6
  • 箭头函数和普通函数的区别?
  • 在UI界面内修改了对象名,在#include “ui_mainwindow.h“没更新
  • 电子电路基础2(杂乱)
  • 登高架设作业操作证考试:理论题库高频考点有哪些?
  • MCP协议三种传输机制全解析