diff --git a/popcorn/Assets/CornSpilled.cs b/popcorn/Assets/CornSpilled.cs new file mode 100644 index 00000000..88072283 --- /dev/null +++ b/popcorn/Assets/CornSpilled.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class CornSpilled : MonoBehaviour +{ + [SerializeField] private Sprite spilledBurntCornSprite; + [SerializeField] private Sprite spilledBurntCornGrainSprite; + [SerializeField] private SpriteRenderer spilledCornRenderer; + [SerializeField] private SpriteRenderer spilledCornGrainRenderer; + + public void ChangeCornSkin(CornCondition condition) + { + switch (condition) + { + case CornCondition.Simple: + break; + case CornCondition.Burnt: + spilledCornRenderer.sprite = spilledBurntCornSprite; + spilledCornGrainRenderer.sprite = spilledBurntCornGrainSprite; + break; + default: + throw new ArgumentOutOfRangeException(nameof(condition), condition, null); + } + } +} diff --git a/popcorn/Assets/CornSpilled.cs.meta b/popcorn/Assets/CornSpilled.cs.meta new file mode 100644 index 00000000..d5557b83 --- /dev/null +++ b/popcorn/Assets/CornSpilled.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c0066f30e1e10486984ea2182365c6be +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/MyGame/Scenes/Cooking/Prefabs/Directing_com_jump.prefab b/popcorn/Assets/MyGame/Scenes/Cooking/Prefabs/Directing_com_jump.prefab index 21b699ef..5c7f57dc 100644 --- a/popcorn/Assets/MyGame/Scenes/Cooking/Prefabs/Directing_com_jump.prefab +++ b/popcorn/Assets/MyGame/Scenes/Cooking/Prefabs/Directing_com_jump.prefab @@ -9,6 +9,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 2449901118440757731} + - component: {fileID: 5772735612732435450} m_Layer: 0 m_Name: Directing_com_jump m_TagString: Untagged @@ -31,6 +32,24 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &5772735612732435450 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2449901118440757730} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c0066f30e1e10486984ea2182365c6be, type: 3} + m_Name: + m_EditorClassIdentifier: + spilledBurntCornSprite: {fileID: 21300000, guid: 8d287beb744ac6b458a3088ac499a1dd, + type: 3} + spilledBurntCornGrainSprite: {fileID: 21300000, guid: f4d57e416b08c7548b51da9ec0840251, + type: 3} + spilledCornRenderer: {fileID: 2449901118546329402} + spilledCornGrainRenderer: {fileID: 2449901119278880608} --- !u!1 &2449901118525682483 GameObject: m_ObjectHideFlags: 0 diff --git a/popcorn/Assets/MyGame/Scenes/Cooking/Scripts/Corn.cs b/popcorn/Assets/MyGame/Scenes/Cooking/Scripts/Corn.cs index ce1ab17d..df73e8be 100644 --- a/popcorn/Assets/MyGame/Scenes/Cooking/Scripts/Corn.cs +++ b/popcorn/Assets/MyGame/Scenes/Cooking/Scripts/Corn.cs @@ -159,6 +159,8 @@ public class Corn : MonoBehaviour Destroy(gameObject); // 画面KO再生(同時飛び出し時ランダム) var animation = Instantiate(spilledCornAnimationPrefab, new Vector2(Random.value * worldWidth * 2 - worldWidth, Random.value * 2 * 2 - 2), Quaternion.identity); + // KOコーンスキン変更 + animation.GetComponent().ChangeCornSkin(prevCondition); VibrationManager.Instance.PlayVibrationOnce(); Observable.Timer(TimeSpan.FromSeconds(1.5f)).Subscribe(__ => {