メイン弟歩行追加
This commit is contained in:
parent
d32cdfb3c0
commit
bcef14ed5f
|
|
@ -26,6 +26,31 @@ AnimatorState:
|
||||||
m_MirrorParameter:
|
m_MirrorParameter:
|
||||||
m_CycleOffsetParameter:
|
m_CycleOffsetParameter:
|
||||||
m_TimeParameter:
|
m_TimeParameter:
|
||||||
|
--- !u!1101 &-6968845174723350288
|
||||||
|
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: Normal
|
||||||
|
m_EventTreshold: 0
|
||||||
|
m_DstStateMachine: {fileID: 0}
|
||||||
|
m_DstState: {fileID: -5348363866995552689}
|
||||||
|
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!1102 &-5348363866995552689
|
--- !u!1102 &-5348363866995552689
|
||||||
AnimatorState:
|
AnimatorState:
|
||||||
serializedVersion: 5
|
serializedVersion: 5
|
||||||
|
|
@ -60,7 +85,19 @@ AnimatorController:
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_Name: Brother_Blue_Main
|
m_Name: Brother_Blue_Main
|
||||||
serializedVersion: 5
|
serializedVersion: 5
|
||||||
m_AnimatorParameters: []
|
m_AnimatorParameters:
|
||||||
|
- m_Name: Tired
|
||||||
|
m_Type: 9
|
||||||
|
m_DefaultFloat: 0
|
||||||
|
m_DefaultInt: 0
|
||||||
|
m_DefaultBool: 0
|
||||||
|
m_Controller: {fileID: 0}
|
||||||
|
- m_Name: Normal
|
||||||
|
m_Type: 9
|
||||||
|
m_DefaultFloat: 0
|
||||||
|
m_DefaultInt: 0
|
||||||
|
m_DefaultBool: 0
|
||||||
|
m_Controller: {fileID: 0}
|
||||||
m_AnimatorLayers:
|
m_AnimatorLayers:
|
||||||
- serializedVersion: 5
|
- serializedVersion: 5
|
||||||
m_Name: Base Layer
|
m_Name: Base Layer
|
||||||
|
|
@ -74,6 +111,31 @@ AnimatorController:
|
||||||
m_IKPass: 0
|
m_IKPass: 0
|
||||||
m_SyncedLayerAffectsTiming: 0
|
m_SyncedLayerAffectsTiming: 0
|
||||||
m_Controller: {fileID: 9100000}
|
m_Controller: {fileID: 9100000}
|
||||||
|
--- !u!1101 &871869168590934795
|
||||||
|
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: Tired
|
||||||
|
m_EventTreshold: 0
|
||||||
|
m_DstStateMachine: {fileID: 0}
|
||||||
|
m_DstState: {fileID: -6981161888748237111}
|
||||||
|
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!1107 &3932633661409108207
|
--- !u!1107 &3932633661409108207
|
||||||
AnimatorStateMachine:
|
AnimatorStateMachine:
|
||||||
serializedVersion: 5
|
serializedVersion: 5
|
||||||
|
|
@ -85,12 +147,14 @@ AnimatorStateMachine:
|
||||||
m_ChildStates:
|
m_ChildStates:
|
||||||
- serializedVersion: 1
|
- serializedVersion: 1
|
||||||
m_State: {fileID: -5348363866995552689}
|
m_State: {fileID: -5348363866995552689}
|
||||||
m_Position: {x: 200, y: 0, z: 0}
|
m_Position: {x: 250, y: -10, z: 0}
|
||||||
- serializedVersion: 1
|
- serializedVersion: 1
|
||||||
m_State: {fileID: -6981161888748237111}
|
m_State: {fileID: -6981161888748237111}
|
||||||
m_Position: {x: 235, y: 65, z: 0}
|
m_Position: {x: 240, y: 110, z: 0}
|
||||||
m_ChildStateMachines: []
|
m_ChildStateMachines: []
|
||||||
m_AnyStateTransitions: []
|
m_AnyStateTransitions:
|
||||||
|
- {fileID: 871869168590934795}
|
||||||
|
- {fileID: -6968845174723350288}
|
||||||
m_EntryTransitions: []
|
m_EntryTransitions: []
|
||||||
m_StateMachineTransitions: {}
|
m_StateMachineTransitions: {}
|
||||||
m_StateMachineBehaviours: []
|
m_StateMachineBehaviours: []
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,25 @@ AnimatorController:
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_Name: Brother_pink_Main
|
m_Name: Brother_pink_Main
|
||||||
serializedVersion: 5
|
serializedVersion: 5
|
||||||
m_AnimatorParameters: []
|
m_AnimatorParameters:
|
||||||
|
- m_Name: Stay
|
||||||
|
m_Type: 9
|
||||||
|
m_DefaultFloat: 0
|
||||||
|
m_DefaultInt: 0
|
||||||
|
m_DefaultBool: 0
|
||||||
|
m_Controller: {fileID: 0}
|
||||||
|
- m_Name: Walk
|
||||||
|
m_Type: 9
|
||||||
|
m_DefaultFloat: 0
|
||||||
|
m_DefaultInt: 0
|
||||||
|
m_DefaultBool: 0
|
||||||
|
m_Controller: {fileID: 0}
|
||||||
|
- m_Name: Sleep
|
||||||
|
m_Type: 9
|
||||||
|
m_DefaultFloat: 0
|
||||||
|
m_DefaultInt: 0
|
||||||
|
m_DefaultBool: 0
|
||||||
|
m_Controller: {fileID: 0}
|
||||||
m_AnimatorLayers:
|
m_AnimatorLayers:
|
||||||
- serializedVersion: 5
|
- serializedVersion: 5
|
||||||
m_Name: Base Layer
|
m_Name: Base Layer
|
||||||
|
|
|
||||||
|
|
@ -3516,6 +3516,7 @@ GameObject:
|
||||||
- component: {fileID: 1870432534}
|
- component: {fileID: 1870432534}
|
||||||
- component: {fileID: 1870432533}
|
- component: {fileID: 1870432533}
|
||||||
- component: {fileID: 1870432535}
|
- component: {fileID: 1870432535}
|
||||||
|
- component: {fileID: 1870432536}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: Manager
|
m_Name: Manager
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
|
|
@ -3536,6 +3537,8 @@ MonoBehaviour:
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
cookingButton: {fileID: 414580708}
|
cookingButton: {fileID: 414580708}
|
||||||
|
adButton: {fileID: 445566315}
|
||||||
|
kitchenView: {fileID: 1870432536}
|
||||||
--- !u!4 &1870432534
|
--- !u!4 &1870432534
|
||||||
Transform:
|
Transform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -3568,6 +3571,21 @@ MonoBehaviour:
|
||||||
coinPrefab: {fileID: 0}
|
coinPrefab: {fileID: 0}
|
||||||
duration: 0.5
|
duration: 0.5
|
||||||
rootTransform: {fileID: 0}
|
rootTransform: {fileID: 0}
|
||||||
|
--- !u!114 &1870432536
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1870432532}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 3d9baa2356fe4faca7be16d62c7cc84f, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
blueBrotherAnimator: {fileID: 1124341218}
|
||||||
|
pinkBrotherAnimator: {fileID: 519190656}
|
||||||
|
pinkTransform: {fileID: 519190655}
|
||||||
--- !u!1 &1906074463
|
--- !u!1 &1906074463
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -4559,6 +4577,11 @@ PrefabInstance:
|
||||||
propertyPath: m_IsActive
|
propertyPath: m_IsActive
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6396292362141172708, guid: caaa748dbeed576499e8cae74d33f689,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_IsActive
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
m_RemovedComponents: []
|
m_RemovedComponents: []
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: caaa748dbeed576499e8cae74d33f689, type: 3}
|
m_SourcePrefab: {fileID: 100100000, guid: caaa748dbeed576499e8cae74d33f689, type: 3}
|
||||||
--- !u!114 &3664916832445709977 stripped
|
--- !u!114 &3664916832445709977 stripped
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,8 @@ using UnityEngine.UI;
|
||||||
public class KitchenManager : MonoBehaviour
|
public class KitchenManager : MonoBehaviour
|
||||||
{
|
{
|
||||||
[SerializeField] private Button cookingButton;
|
[SerializeField] private Button cookingButton;
|
||||||
|
[SerializeField] private Button adButton;
|
||||||
|
[SerializeField] private KitchenView kitchenView;
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
|
|
@ -26,7 +28,9 @@ public class KitchenManager : MonoBehaviour
|
||||||
|
|
||||||
SetData();
|
SetData();
|
||||||
|
|
||||||
|
#if UNITY_EDITOR
|
||||||
Market.StockFlavorLog();
|
Market.StockFlavorLog();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetData()
|
private void SetData()
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,98 @@
|
||||||
|
using System;
|
||||||
|
using UniRx;
|
||||||
|
using UniRx.Triggers;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class KitchenView : MonoBehaviour
|
||||||
|
{
|
||||||
|
// blue
|
||||||
|
private static readonly int Normal = Animator.StringToHash("Normal");
|
||||||
|
private static readonly int Tired = Animator.StringToHash("Tired");
|
||||||
|
// pink
|
||||||
|
private static readonly int Walk = Animator.StringToHash("Walk");
|
||||||
|
private static readonly int Stay = Animator.StringToHash("Stay");
|
||||||
|
private static readonly int Sleep = Animator.StringToHash("Sleep");
|
||||||
|
[SerializeField] private Animator blueBrotherAnimator;
|
||||||
|
[SerializeField] private Animator pinkBrotherAnimator;
|
||||||
|
[SerializeField] private Transform pinkTransform;
|
||||||
|
[SerializeField] private float pinkWalkspeed = .8f;
|
||||||
|
private readonly (int trigger, Vector2 wayPoint, float wait)[] pinkMoves =
|
||||||
|
{
|
||||||
|
(Walk, new Vector2(3.28f,0.726f), 0f),
|
||||||
|
// (Stay, new Vector2(3.28f,0.726f), 2f),
|
||||||
|
(Walk, new Vector2(0f,0.726f), 0f),
|
||||||
|
(Stay, new Vector2(0f,0.726f), 3f),
|
||||||
|
(Walk, new Vector2(-3.28f,0.726f), 0f),
|
||||||
|
// (Stay, new Vector2(-3.28f,0.726f), 2f),
|
||||||
|
(Walk, new Vector2(0f,0.726f), 0f),
|
||||||
|
(Stay, new Vector2(0f,0.726f), 3f),
|
||||||
|
};
|
||||||
|
|
||||||
|
private int moveIndex;
|
||||||
|
private Vector2 wayPoint;
|
||||||
|
private float durationDelta;
|
||||||
|
private float completedDuration;
|
||||||
|
private bool isTired;
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
moveIndex = 0;
|
||||||
|
SetPinkMove();
|
||||||
|
this.UpdateAsObservable().Subscribe(_ =>
|
||||||
|
{
|
||||||
|
if (isTired)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var localPosition = pinkTransform.localPosition;
|
||||||
|
localPosition = Vector2.MoveTowards(localPosition, wayPoint, pinkWalkspeed * Time.deltaTime);
|
||||||
|
pinkTransform.localPosition = localPosition;
|
||||||
|
if (Vector2.Distance(localPosition, wayPoint) < .01f)
|
||||||
|
{
|
||||||
|
if (durationDelta < completedDuration)
|
||||||
|
{
|
||||||
|
durationDelta += Time.deltaTime;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
durationDelta = 0;
|
||||||
|
moveIndex++;
|
||||||
|
if (moveIndex == pinkMoves.Length)
|
||||||
|
{
|
||||||
|
moveIndex = 0;
|
||||||
|
}
|
||||||
|
SetPinkMove();
|
||||||
|
}
|
||||||
|
}).AddTo(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetPinkMove()
|
||||||
|
{
|
||||||
|
var move = pinkMoves[moveIndex];
|
||||||
|
wayPoint = move.wayPoint;
|
||||||
|
completedDuration = move.wait;
|
||||||
|
pinkBrotherAnimator.SetTrigger(move.trigger);
|
||||||
|
if (Vector2.Distance(wayPoint, pinkTransform.localPosition.ToVector2()) < .01f)
|
||||||
|
{
|
||||||
|
// nop
|
||||||
|
} else if ((wayPoint - pinkTransform.localPosition.ToVector2()).x > 0)
|
||||||
|
{
|
||||||
|
pinkTransform.localRotation = Quaternion.Euler(Vector3.up * 180);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pinkTransform.localRotation = Quaternion.Euler(Vector3.zero);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetNormalAnimation()
|
||||||
|
{
|
||||||
|
isTired = false;
|
||||||
|
blueBrotherAnimator.SetTrigger(Normal);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetTiredAnimation()
|
||||||
|
{
|
||||||
|
isTired = true;
|
||||||
|
blueBrotherAnimator.SetTrigger(Tired);
|
||||||
|
pinkBrotherAnimator.SetTrigger(Sleep);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 3d9baa2356fe4faca7be16d62c7cc84f
|
||||||
|
timeCreated: 1632291311
|
||||||
Loading…
Reference in New Issue