From a12794cfec6d6d80f39865f5fdffeeaed81ef7f5 Mon Sep 17 00:00:00 2001 From: kimura Date: Thu, 5 Aug 2021 13:28:28 +0900 Subject: [PATCH] =?UTF-8?q?=E6=BC=94=E5=87=BA=E3=82=BF=E3=82=A4=E3=83=9F?= =?UTF-8?q?=E3=83=B3=E3=82=B0=E3=81=AE=E8=AA=BF=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MyGame/Resource/Animation/corn.controller | 71 +++++++++++++++++-- .../MyGame/Scenes/Cooking/Cooking.unity | 7 ++ .../MyGame/Scenes/Cooking/Scripts/Corn.cs | 6 ++ .../Scenes/Cooking/Scripts/CornManager.cs | 10 +++ .../Cooking/Scripts/PopcornGameManager.cs | 2 + .../Scenes/Cooking/Scripts/PopcornGameView.cs | 2 + 6 files changed, 93 insertions(+), 5 deletions(-) diff --git a/popcorn/Assets/MyGame/Resource/Animation/corn.controller b/popcorn/Assets/MyGame/Resource/Animation/corn.controller index 2714b949..10914c40 100644 --- a/popcorn/Assets/MyGame/Resource/Animation/corn.controller +++ b/popcorn/Assets/MyGame/Resource/Animation/corn.controller @@ -25,6 +25,31 @@ AnimatorStateTransition: m_InterruptionSource: 0 m_OrderedInterruption: 1 m_CanTransitionToSelf: 1 +--- !u!1101 &-8351496413139389895 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: + - m_ConditionMode: 1 + m_ConditionEvent: CornWait + m_EventTreshold: 0 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: -6451913813719917424} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0 + m_TransitionOffset: 0 + m_ExitTime: 0.75 + m_HasExitTime: 0 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 --- !u!1101 &-8175191986188642306 AnimatorStateTransition: m_ObjectHideFlags: 1 @@ -90,19 +115,25 @@ AnimatorController: m_DefaultFloat: 0 m_DefaultInt: 0 m_DefaultBool: 0 - m_Controller: {fileID: 9100000} + m_Controller: {fileID: 0} - m_Name: CornBurn m_Type: 9 m_DefaultFloat: 0 m_DefaultInt: 0 m_DefaultBool: 0 - m_Controller: {fileID: 9100000} + m_Controller: {fileID: 0} + - m_Name: CornWait + m_Type: 9 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 0} - m_Name: WaitOffset m_Type: 1 m_DefaultFloat: 0 m_DefaultInt: 0 m_DefaultBool: 0 - m_Controller: {fileID: 9100000} + m_Controller: {fileID: 0} m_AnimatorLayers: - serializedVersion: 5 m_Name: Base Layer @@ -127,17 +158,21 @@ AnimatorStateMachine: m_ChildStates: - serializedVersion: 1 m_State: {fileID: -6451913813719917424} - m_Position: {x: 270, y: 40, z: 0} + m_Position: {x: 270, y: -20, z: 0} - serializedVersion: 1 m_State: {fileID: 6341160211334192665} m_Position: {x: 270, y: -100, z: 0} - serializedVersion: 1 m_State: {fileID: 7193984417312256253} m_Position: {x: 270, y: -190, z: 0} + - serializedVersion: 1 + m_State: {fileID: 1339744208946830200} + m_Position: {x: 270, y: 60, z: 0} m_ChildStateMachines: [] m_AnyStateTransitions: - {fileID: -8175191986188642306} - {fileID: -8797755764172867904} + - {fileID: -8351496413139389895} m_EntryTransitions: [] m_StateMachineTransitions: {} m_StateMachineBehaviours: [] @@ -145,7 +180,33 @@ AnimatorStateMachine: m_EntryPosition: {x: 40, y: 40, z: 0} m_ExitPosition: {x: 550, y: 50, z: 0} m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} - m_DefaultState: {fileID: -6451913813719917424} + m_DefaultState: {fileID: 1339744208946830200} +--- !u!1102 &1339744208946830200 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: CornStill + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 0} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: --- !u!1102 &6341160211334192665 AnimatorState: serializedVersion: 5 diff --git a/popcorn/Assets/MyGame/Scenes/Cooking/Cooking.unity b/popcorn/Assets/MyGame/Scenes/Cooking/Cooking.unity index fa0bbf66..25fbfe31 100644 --- a/popcorn/Assets/MyGame/Scenes/Cooking/Cooking.unity +++ b/popcorn/Assets/MyGame/Scenes/Cooking/Cooking.unity @@ -127,6 +127,12 @@ Transform: type: 3} m_PrefabInstance: {fileID: 1244643143} m_PrefabAsset: {fileID: 0} +--- !u!1 &158786353 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 6414470378191658949, guid: b6b05cbc51c744ac2ad95a8b229d4ddd, + type: 3} + m_PrefabInstance: {fileID: 2137549891} + m_PrefabAsset: {fileID: 0} --- !u!1 &162168169 GameObject: m_ObjectHideFlags: 0 @@ -8948,6 +8954,7 @@ MonoBehaviour: startingGuide: {fileID: 8786490829224139677} fire: {fileID: 1295632042} oilEffect: {fileID: 2137549893} + streamEffect: {fileID: 158786353} characterSweat: {fileID: 580170368} characterFlower: {fileID: 785034261} --- !u!224 &1871878299 stripped diff --git a/popcorn/Assets/MyGame/Scenes/Cooking/Scripts/Corn.cs b/popcorn/Assets/MyGame/Scenes/Cooking/Scripts/Corn.cs index 68db7048..3909a0a0 100644 --- a/popcorn/Assets/MyGame/Scenes/Cooking/Scripts/Corn.cs +++ b/popcorn/Assets/MyGame/Scenes/Cooking/Scripts/Corn.cs @@ -16,6 +16,7 @@ public enum CornCondition [RequireComponent(typeof(Rigidbody2D))] public class Corn : MonoBehaviour { + private static readonly int HashCornWait = Animator.StringToHash("CornWait"); private static readonly int HashCornGrow = Animator.StringToHash("CornGrow"); private static readonly int HashCornBurn = Animator.StringToHash("CornBurn"); private static readonly int HashWaitOffset = Animator.StringToHash("WaitOffset"); @@ -171,4 +172,9 @@ public class Corn : MonoBehaviour { isHot = status; } + + public void StartCornDance() + { + animator.SetTrigger(HashCornWait); + } } diff --git a/popcorn/Assets/MyGame/Scenes/Cooking/Scripts/CornManager.cs b/popcorn/Assets/MyGame/Scenes/Cooking/Scripts/CornManager.cs index 14e9cb28..ed2bea02 100644 --- a/popcorn/Assets/MyGame/Scenes/Cooking/Scripts/CornManager.cs +++ b/popcorn/Assets/MyGame/Scenes/Cooking/Scripts/CornManager.cs @@ -34,6 +34,9 @@ public class CornManager : MonoBehaviour public IReadOnlyReactiveProperty Result => result; private readonly ReactiveProperty result = new ReactiveProperty(); + + public ReactiveProperty GameState => gameState; + private readonly ReactiveProperty gameState = new ReactiveProperty(); private Corn[] cornArray; private bool isHot; @@ -149,6 +152,13 @@ public class CornManager : MonoBehaviour corn.ChangeGrowSpeed(x); corn.ChangeHotStatus(isHot); }).AddTo(compositeDisposable); + + gameState + .Where(x => x == global::GameState.Playing) + .Subscribe(x => + { + corn.StartCornDance(); + }).AddTo(compositeDisposable); corn.Condition diff --git a/popcorn/Assets/MyGame/Scenes/Cooking/Scripts/PopcornGameManager.cs b/popcorn/Assets/MyGame/Scenes/Cooking/Scripts/PopcornGameManager.cs index 65616310..2ffea480 100644 --- a/popcorn/Assets/MyGame/Scenes/Cooking/Scripts/PopcornGameManager.cs +++ b/popcorn/Assets/MyGame/Scenes/Cooking/Scripts/PopcornGameManager.cs @@ -44,6 +44,8 @@ public class PopcornGameManager : MonoBehaviour gameView.ChangeCharactorState(x); }).AddTo(this); + state.Subscribe(x => cornManager.GameState.Value = x); + ResetGame(); #if DEVELOPMENT_BUILD || UNITY_EDITOR diff --git a/popcorn/Assets/MyGame/Scenes/Cooking/Scripts/PopcornGameView.cs b/popcorn/Assets/MyGame/Scenes/Cooking/Scripts/PopcornGameView.cs index 6212810b..6efbfc66 100644 --- a/popcorn/Assets/MyGame/Scenes/Cooking/Scripts/PopcornGameView.cs +++ b/popcorn/Assets/MyGame/Scenes/Cooking/Scripts/PopcornGameView.cs @@ -6,6 +6,7 @@ public class PopcornGameView : MonoBehaviour [SerializeField] private GameObject startingGuide; [SerializeField] private GameObject fire; [SerializeField] private GameObject oilEffect; + [SerializeField] private GameObject streamEffect; [SerializeField] private GameObject characterSweat; [SerializeField] private GameObject characterFlower; @@ -25,6 +26,7 @@ public class PopcornGameView : MonoBehaviour { fire.SetActive(isActive); oilEffect.SetActive(isActive); + streamEffect.SetActive(isActive); } public void ChangeCharactorState(ThermalCondition condition)