diff --git a/Assets/02.Scripts/Character/SpineController.cs b/Assets/02.Scripts/Character/SpineController.cs index cb4db24e7..6e4293bd7 100644 --- a/Assets/02.Scripts/Character/SpineController.cs +++ b/Assets/02.Scripts/Character/SpineController.cs @@ -4,6 +4,7 @@ using Spine; using Spine.Unity; using UnityEngine; using AnimationState = Spine.AnimationState; +using Random = UnityEngine.Random; namespace BlueWater.Players { @@ -18,8 +19,14 @@ namespace BlueWater.Players private AnimationState _animationState; // Variables - [SerializeField] + [SerializeField, ShowIf("@!_isRandomSkin")] private string _initialSkinName = "default"; + + [SerializeField] + private bool _isRandomSkin; + + [SerializeField, ShowIf("@_isRandomSkin")] + private Vector2 _randomRange; #endregion @@ -41,8 +48,15 @@ namespace BlueWater.Players { SkeletonAnimation = transform.GetComponentInChildren(); _animationState = SkeletonAnimation.AnimationState; - - SetSkin(_initialSkinName); + + if (_isRandomSkin) + { + SetRandomSkin(); + } + else + { + SetSkin(_initialSkinName); + } } #endregion @@ -90,6 +104,16 @@ namespace BlueWater.Players SkeletonAnimation.Skeleton.SetSlotsToSetupPose(); _animationState.Apply(SkeletonAnimation.Skeleton); } + + public void SetRandomSkin() + { + if (SkeletonAnimation == null || SkeletonAnimation.Skeleton == null) return; + + var skins = SkeletonAnimation.skeleton.Data.Skins; + var randomSkin = Random.Range((int)_randomRange.x, (int)_randomRange.y); + var randomSkinName = skins.Items[randomSkin].Name; + SetSkin(randomSkinName); + } public async Awaitable WaitForAnimationCompletion(TrackEntry trackEntry, bool isReverse = false) { diff --git a/Assets/05.Prefabs/Characters/Npcs/Customer.prefab b/Assets/05.Prefabs/Characters/Npcs/Customer.prefab index fa539a04d..f859da7cc 100644 --- a/Assets/05.Prefabs/Characters/Npcs/Customer.prefab +++ b/Assets/05.Prefabs/Characters/Npcs/Customer.prefab @@ -253,7 +253,7 @@ MeshRenderer: m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: - - {fileID: 2100000, guid: c5ff73efdfe597a488e245216fd5d707, type: 2} + - {fileID: 2100000, guid: 9bc431c4668e0bc49ae9ddd68dcd2298, type: 2} m_StaticBatchInfo: firstSubMesh: 0 subMeshCount: 0 @@ -287,8 +287,8 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: d247ba06193faa74d9335f5481b2b56c, type: 3} m_Name: m_EditorClassIdentifier: - skeletonDataAsset: {fileID: 11400000, guid: ad9bc316ced5375449444c992ee73cee, type: 2} - initialSkinName: 02 + skeletonDataAsset: {fileID: 11400000, guid: db30adb40854e2f49a2c44863fe0c953, type: 2} + initialSkinName: 01 fixPrefabOverrideViaMeshFilter: 2 initialFlipX: 0 initialFlipY: 0 @@ -315,7 +315,7 @@ MonoBehaviour: physicsMovementRelativeTo: {fileID: 0} updateTiming: 1 unscaledTime: 0 - _animationName: idle + _animationName: Idle loop: 1 timeScale: 1 --- !u!1 &2781393898199067900 @@ -762,6 +762,8 @@ MonoBehaviour: m_EditorClassIdentifier: k__BackingField: {fileID: 0} _initialSkinName: 02 + _isRandomSkin: 1 + _randomRange: {x: 1, y: 3} --- !u!114 &17978457728262906 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/Assets/08.Spines/Characters/Npcs.meta b/Assets/08.Spines/Characters/Npcs.meta new file mode 100644 index 000000000..8cc6c6599 --- /dev/null +++ b/Assets/08.Spines/Characters/Npcs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d298265501e72064fa790f6fd2be81bf +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/08.Spines/Characters/Npcs/Customers.meta b/Assets/08.Spines/Characters/Npcs/Customers.meta new file mode 100644 index 000000000..6f53c87ce --- /dev/null +++ b/Assets/08.Spines/Characters/Npcs/Customers.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8b40d3a5845403a4eb9c2da0c28d1aa7 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/08.Spines/Characters/Npcs/Customers/01_Guest.atlas.txt b/Assets/08.Spines/Characters/Npcs/Customers/01_Guest.atlas.txt new file mode 100644 index 000000000..9b02fbba9 --- /dev/null +++ b/Assets/08.Spines/Characters/Npcs/Customers/01_Guest.atlas.txt @@ -0,0 +1,58 @@ +01_Guest.png +size:675,513 +filter:Linear,Linear +02_ArmL +bounds:460,227,101,113 +rotate:90 +02_ArmR +bounds:403,112,101,113 +02_Body +bounds:222,212,133,161 +02_EyeL +bounds:609,111,64,60 +02_EyeR +bounds:609,173,73,62 +rotate:90 +02_Face +bounds:2,299,218,212 +02_Hair +bounds:222,375,240,136 +02_LegL +bounds:215,2,78,132 +rotate:90 +02_LegR +bounds:2,3,80,133 +rotate:90 +02_Mouse +bounds:349,12,65,17 +rotate:90 +Arm_L +bounds:506,112,101,113 +Arm_R +bounds:403,9,101,112 +rotate:90 +Beer +bounds:222,82,128,128 +Body +bounds:464,384,127,153 +rotate:90 +Eye_L +bounds:575,248,69,80 +Eye_R +bounds:137,3,76,80 +Face02 +bounds:2,85,218,212 +Hair02 +bounds:619,362,149,54 +rotate:90 +Leg_L +bounds:352,79,49,131 +Leg_R +bounds:464,330,52,133 +rotate:90 +Mouse +bounds:517,8,102,81 +rotate:90 +하의 +bounds:357,235,138,101 +rotate:90 diff --git a/Assets/08.Spines/Characters/Npcs/Customers/01_Guest.atlas.txt.meta b/Assets/08.Spines/Characters/Npcs/Customers/01_Guest.atlas.txt.meta new file mode 100644 index 000000000..d550c70dc --- /dev/null +++ b/Assets/08.Spines/Characters/Npcs/Customers/01_Guest.atlas.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 3f09215082fbb6d4e8c4b62abfbe77a9 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/08.Spines/Characters/Npcs/Customers/01_Guest.png b/Assets/08.Spines/Characters/Npcs/Customers/01_Guest.png new file mode 100644 index 000000000..4ba7e03f4 Binary files /dev/null and b/Assets/08.Spines/Characters/Npcs/Customers/01_Guest.png differ diff --git a/Assets/08.Spines/Characters/Npcs/Customers/01_Guest.png.meta b/Assets/08.Spines/Characters/Npcs/Customers/01_Guest.png.meta new file mode 100644 index 000000000..02579589f --- /dev/null +++ b/Assets/08.Spines/Characters/Npcs/Customers/01_Guest.png.meta @@ -0,0 +1,141 @@ +fileFormatVersion: 2 +guid: dd6efa89a0500884cb09b545da7e5d2c +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 1 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 1 + - serializedVersion: 4 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 1 + - serializedVersion: 4 + buildTarget: WindowsStoreApps + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 1 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/08.Spines/Characters/Npcs/Customers/01_Guest.skel.bytes b/Assets/08.Spines/Characters/Npcs/Customers/01_Guest.skel.bytes new file mode 100644 index 000000000..936dd634f Binary files /dev/null and b/Assets/08.Spines/Characters/Npcs/Customers/01_Guest.skel.bytes differ diff --git a/Assets/08.Spines/Characters/Npcs/Customers/01_Guest.skel.bytes.meta b/Assets/08.Spines/Characters/Npcs/Customers/01_Guest.skel.bytes.meta new file mode 100644 index 000000000..730e7fb94 --- /dev/null +++ b/Assets/08.Spines/Characters/Npcs/Customers/01_Guest.skel.bytes.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 06716ee5a5dfc9d4c8a005f358987c74 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/08.Spines/Characters/Npcs/Customers/01_Guest_Atlas.asset b/Assets/08.Spines/Characters/Npcs/Customers/01_Guest_Atlas.asset new file mode 100644 index 000000000..0d435b693 --- /dev/null +++ b/Assets/08.Spines/Characters/Npcs/Customers/01_Guest_Atlas.asset @@ -0,0 +1,19 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a6b194f808b1af6499c93410e504af42, type: 3} + m_Name: 01_Guest_Atlas + m_EditorClassIdentifier: + textureLoadingMode: 0 + onDemandTextureLoader: {fileID: 0} + atlasFile: {fileID: 4900000, guid: 3f09215082fbb6d4e8c4b62abfbe77a9, type: 3} + materials: + - {fileID: 2100000, guid: 9bc431c4668e0bc49ae9ddd68dcd2298, type: 2} diff --git a/Assets/08.Spines/Characters/Npcs/Customers/01_Guest_Atlas.asset.meta b/Assets/08.Spines/Characters/Npcs/Customers/01_Guest_Atlas.asset.meta new file mode 100644 index 000000000..677d25365 --- /dev/null +++ b/Assets/08.Spines/Characters/Npcs/Customers/01_Guest_Atlas.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7d306bdfc9aff374a9bef2cb63de76dc +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/08.Spines/Characters/Npcs/Customers/01_Guest_Material.mat b/Assets/08.Spines/Characters/Npcs/Customers/01_Guest_Material.mat new file mode 100644 index 000000000..193815c21 --- /dev/null +++ b/Assets/08.Spines/Characters/Npcs/Customers/01_Guest_Material.mat @@ -0,0 +1,46 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: 01_Guest_Material + m_Shader: {fileID: 4800000, guid: b77e51f117177954ea863bdb422344fb, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: + - _STRAIGHT_ALPHA_INPUT + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _MainTex: + m_Texture: {fileID: 2800000, guid: dd6efa89a0500884cb09b545da7e5d2c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Cutoff: 0.1 + - _DoubleSidedLighting: 0 + - _LightAffectsAdditive: 0 + - _ReceiveShadows: 0 + - _StencilComp: 8 + - _StencilRef: 1 + - _StraightAlphaInput: 1 + - _TintBlack: 0 + - _ZWrite: 0 + m_Colors: + - _Black: {r: 0, g: 0, b: 0, a: 0} + - _Color: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 diff --git a/Assets/08.Spines/Characters/Npcs/Customers/01_Guest_Material.mat.meta b/Assets/08.Spines/Characters/Npcs/Customers/01_Guest_Material.mat.meta new file mode 100644 index 000000000..e7ce3c5d1 --- /dev/null +++ b/Assets/08.Spines/Characters/Npcs/Customers/01_Guest_Material.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9bc431c4668e0bc49ae9ddd68dcd2298 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/08.Spines/Characters/Npcs/Customers/01_Guest_SkeletonData.asset b/Assets/08.Spines/Characters/Npcs/Customers/01_Guest_SkeletonData.asset new file mode 100644 index 000000000..db05dc788 --- /dev/null +++ b/Assets/08.Spines/Characters/Npcs/Customers/01_Guest_SkeletonData.asset @@ -0,0 +1,31 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f1b3b4b945939a54ea0b23d3396115fb, type: 3} + m_Name: 01_Guest_SkeletonData + m_EditorClassIdentifier: + atlasAssets: + - {fileID: 11400000, guid: 7d306bdfc9aff374a9bef2cb63de76dc, type: 2} + scale: 0.0025 + skeletonJSON: {fileID: 4900000, guid: 06716ee5a5dfc9d4c8a005f358987c74, type: 3} + isUpgradingBlendModeMaterials: 0 + blendModeMaterials: + requiresBlendModeMaterials: 0 + applyAdditiveMaterial: 1 + additiveMaterials: [] + multiplyMaterials: [] + screenMaterials: [] + skeletonDataModifiers: [] + fromAnimation: [] + toAnimation: [] + duration: [] + defaultMix: 0.2 + controller: {fileID: 0} diff --git a/Assets/08.Spines/Characters/Npcs/Customers/01_Guest_SkeletonData.asset.meta b/Assets/08.Spines/Characters/Npcs/Customers/01_Guest_SkeletonData.asset.meta new file mode 100644 index 000000000..2cc9df6f9 --- /dev/null +++ b/Assets/08.Spines/Characters/Npcs/Customers/01_Guest_SkeletonData.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: db30adb40854e2f49a2c44863fe0c953 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: