diff --git a/popcorn/Assets/MyGame/Scenes/Cooking/Cooking.unity b/popcorn/Assets/MyGame/Scenes/Cooking/Cooking.unity index f2f8d88e..9e771bbf 100644 --- a/popcorn/Assets/MyGame/Scenes/Cooking/Cooking.unity +++ b/popcorn/Assets/MyGame/Scenes/Cooking/Cooking.unity @@ -8914,10 +8914,6 @@ MonoBehaviour: type: 3} spilledCornAnimationPrefab: {fileID: 2449901118440757730, guid: 7e7fbf241bd7f461fb46363ff0c6be3e, type: 3} - missCornAnimationPrefab: {fileID: 4156092651619109751, guid: 59ad9ca2628fc4f9d8f03900854207ac, - type: 3} - cornMissMeter: {fileID: 1871878300} - missTextSpawnTransform: {fileID: 676036207} cornSpawnCount: 50 maxFailedCornCount: 25 baseGrowSpeed: 1 @@ -8943,18 +8939,6 @@ RectTransform: type: 3} m_PrefabInstance: {fileID: 8509883328564265099} m_PrefabAsset: {fileID: 0} ---- !u!114 &1871878300 stripped -MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 4080947763864399562, guid: 1a47fa9bdeb434bffa410f731816203f, - type: 3} - m_PrefabInstance: {fileID: 8509883328564265099} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 2537d840e3a243a1883f1c5289412fd9, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!1 &1928679189 GameObject: m_ObjectHideFlags: 0 diff --git a/popcorn/Assets/MyGame/Scenes/Cooking/Prefabs/corn.prefab b/popcorn/Assets/MyGame/Scenes/Cooking/Prefabs/corn.prefab index f59b51f8..b0544ed8 100644 --- a/popcorn/Assets/MyGame/Scenes/Cooking/Prefabs/corn.prefab +++ b/popcorn/Assets/MyGame/Scenes/Cooking/Prefabs/corn.prefab @@ -70,6 +70,11 @@ MonoBehaviour: cornSkin: {fileID: 7130900939474693981} effectBurnt: {fileID: 3984349228049242719, guid: 02298b5aac4434a4c81aec58ad2caa9d, type: 3} + effectSpillSeed: {fileID: 5078088515886692167, guid: 6e11516cabfc8450593dee19282ddd0d, + type: 3} + effectSpillPopped: {fileID: 4783546067326661837, guid: b66901098e7af4bd483c1dda2a423941, + type: 3} + burntMaterial: {fileID: 2100000, guid: bec51957e6eb5467abd3d46dc72f642a, type: 2} animator: {fileID: 5972257590091015193} --- !u!50 &7195010600253370228 Rigidbody2D: diff --git a/popcorn/Assets/MyGame/Scenes/Cooking/Scripts/Corn.cs b/popcorn/Assets/MyGame/Scenes/Cooking/Scripts/Corn.cs index 4d47ba60..8f911f80 100644 --- a/popcorn/Assets/MyGame/Scenes/Cooking/Scripts/Corn.cs +++ b/popcorn/Assets/MyGame/Scenes/Cooking/Scripts/Corn.cs @@ -22,6 +22,9 @@ public class Corn : MonoBehaviour [SerializeField] private CornSkin cornSkin; [SerializeField] private GameObject effectBurnt; + [SerializeField] private GameObject effectSpillSeed; + [SerializeField] private GameObject effectSpillPopped; + [SerializeField] private Material burntMaterial; [SerializeField] private Animator animator; private Rigidbody2D rigidbody; @@ -68,12 +71,21 @@ public class Corn : MonoBehaviour .Subscribe(_ => { spilled.Value = true; - var clone = Instantiate(cornSkin); - clone.ChangeSkin(condition.Value); - var cloneRigidBody = clone.gameObject.AddComponent(); - cloneRigidBody.gravityScale = 0; - cloneRigidBody.AddForce(rigidbody.velocity.normalized * 20f, ForceMode2D.Impulse); - this.CallWaitForSeconds(2f, () => Destroy(clone.gameObject)); + GameObject effect; + if (condition.Value == CornCondition.Seed) + { + effect = Instantiate(effectSpillSeed, transform.position, Quaternion.identity, null); + this.CallWaitForSeconds(5f, () => Destroy(effect)); + } + else + { + effect = Instantiate(effectSpillPopped, transform.position, Quaternion.identity, null); + if (condition.Value == CornCondition.Burnt) + { + effect.transform.GetChild(0).GetComponentInChildren().material = burntMaterial; + } + this.CallWaitForSeconds(5f, () => Destroy(effect)); + } }).AddTo(this); condition.Pairwise().Subscribe(x =>