販売シーンお客さんの行動ロジックにタップ時(2パターン)追加
This commit is contained in:
parent
b98e6fd18c
commit
2435cfbc92
|
|
@ -25,6 +25,31 @@ AnimatorStateTransition:
|
||||||
m_InterruptionSource: 0
|
m_InterruptionSource: 0
|
||||||
m_OrderedInterruption: 1
|
m_OrderedInterruption: 1
|
||||||
m_CanTransitionToSelf: 1
|
m_CanTransitionToSelf: 1
|
||||||
|
--- !u!1101 &-7478015001457210062
|
||||||
|
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: TouchQuestion
|
||||||
|
m_EventTreshold: 0
|
||||||
|
m_DstStateMachine: {fileID: 0}
|
||||||
|
m_DstState: {fileID: 6535728550172591273}
|
||||||
|
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 &-6933872665675759000
|
--- !u!1101 &-6933872665675759000
|
||||||
AnimatorStateTransition:
|
AnimatorStateTransition:
|
||||||
m_ObjectHideFlags: 1
|
m_ObjectHideFlags: 1
|
||||||
|
|
@ -76,6 +101,31 @@ AnimatorState:
|
||||||
m_MirrorParameter:
|
m_MirrorParameter:
|
||||||
m_CycleOffsetParameter:
|
m_CycleOffsetParameter:
|
||||||
m_TimeParameter:
|
m_TimeParameter:
|
||||||
|
--- !u!1101 &-6356878970760290594
|
||||||
|
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: TouchNotice
|
||||||
|
m_EventTreshold: 0
|
||||||
|
m_DstStateMachine: {fileID: 0}
|
||||||
|
m_DstState: {fileID: 8010061560052996781}
|
||||||
|
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 &-3557210042345114067
|
--- !u!1107 &-3557210042345114067
|
||||||
AnimatorStateMachine:
|
AnimatorStateMachine:
|
||||||
serializedVersion: 5
|
serializedVersion: 5
|
||||||
|
|
@ -166,6 +216,18 @@ AnimatorController:
|
||||||
m_DefaultInt: 0
|
m_DefaultInt: 0
|
||||||
m_DefaultBool: 0
|
m_DefaultBool: 0
|
||||||
m_Controller: {fileID: 9100000}
|
m_Controller: {fileID: 9100000}
|
||||||
|
- m_Name: TouchNotice
|
||||||
|
m_Type: 9
|
||||||
|
m_DefaultFloat: 0
|
||||||
|
m_DefaultInt: 0
|
||||||
|
m_DefaultBool: 0
|
||||||
|
m_Controller: {fileID: 9100000}
|
||||||
|
- m_Name: TouchQuestion
|
||||||
|
m_Type: 9
|
||||||
|
m_DefaultFloat: 0
|
||||||
|
m_DefaultInt: 0
|
||||||
|
m_DefaultBool: 0
|
||||||
|
m_Controller: {fileID: 9100000}
|
||||||
m_AnimatorLayers:
|
m_AnimatorLayers:
|
||||||
- serializedVersion: 5
|
- serializedVersion: 5
|
||||||
m_Name: Base Layer
|
m_Name: Base Layer
|
||||||
|
|
@ -299,6 +361,8 @@ AnimatorStateMachine:
|
||||||
- {fileID: 6505056884794429815}
|
- {fileID: 6505056884794429815}
|
||||||
- {fileID: 8021089965930707737}
|
- {fileID: 8021089965930707737}
|
||||||
- {fileID: -6933872665675759000}
|
- {fileID: -6933872665675759000}
|
||||||
|
- {fileID: -6356878970760290594}
|
||||||
|
- {fileID: -7478015001457210062}
|
||||||
m_EntryTransitions: []
|
m_EntryTransitions: []
|
||||||
m_StateMachineTransitions: {}
|
m_StateMachineTransitions: {}
|
||||||
m_StateMachineBehaviours: []
|
m_StateMachineBehaviours: []
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,8 @@ public enum CustomerMovingType
|
||||||
WalkSide,
|
WalkSide,
|
||||||
WalkSideEat,
|
WalkSideEat,
|
||||||
WalkCenter,
|
WalkCenter,
|
||||||
|
TouchNotice,
|
||||||
|
TouchQuestion,
|
||||||
StayBackOrder,
|
StayBackOrder,
|
||||||
StayBack,
|
StayBack,
|
||||||
WalkBack,
|
WalkBack,
|
||||||
|
|
@ -23,6 +25,8 @@ public enum CustomerState
|
||||||
Walk,
|
Walk,
|
||||||
WalkShop,
|
WalkShop,
|
||||||
CenterStop,
|
CenterStop,
|
||||||
|
TouchNotice,
|
||||||
|
TouchQuestion,
|
||||||
Wait,
|
Wait,
|
||||||
Order,
|
Order,
|
||||||
Leave,
|
Leave,
|
||||||
|
|
@ -63,6 +67,9 @@ public class CustomerController : MonoBehaviour
|
||||||
private float speed = 0f;
|
private float speed = 0f;
|
||||||
private float completedDuration;
|
private float completedDuration;
|
||||||
private float durationDelta;
|
private float durationDelta;
|
||||||
|
|
||||||
|
public float DurationDelta => durationDelta;
|
||||||
|
|
||||||
// 左右どちらから出るか
|
// 左右どちらから出るか
|
||||||
private float walkSideDirection;
|
private float walkSideDirection;
|
||||||
public IReadOnlyReactiveProperty<CustomerMovingType> CurrentMovingType => currentMovingType;
|
public IReadOnlyReactiveProperty<CustomerMovingType> CurrentMovingType => currentMovingType;
|
||||||
|
|
@ -111,6 +118,7 @@ public class CustomerController : MonoBehaviour
|
||||||
}
|
}
|
||||||
var localPosition = transform.localPosition;
|
var localPosition = transform.localPosition;
|
||||||
localPosition = Vector2.MoveTowards(localPosition, wayPoint, speed * Time.deltaTime);
|
localPosition = Vector2.MoveTowards(localPosition, wayPoint, speed * Time.deltaTime);
|
||||||
|
// キャラの奥行き描画順のため、y方向に対応したz軸を設定
|
||||||
localPosition = localPosition + Vector3.forward * (localPosition.y + Mathf.Abs(walkSideBottomPos));
|
localPosition = localPosition + Vector3.forward * (localPosition.y + Mathf.Abs(walkSideBottomPos));
|
||||||
transform.localPosition = localPosition;
|
transform.localPosition = localPosition;
|
||||||
if (Vector2.Distance(localPosition, wayPoint) < .01f)
|
if (Vector2.Distance(localPosition, wayPoint) < .01f)
|
||||||
|
|
@ -179,12 +187,21 @@ public class CustomerController : MonoBehaviour
|
||||||
break;
|
break;
|
||||||
case CustomerState.WalkShop:
|
case CustomerState.WalkShop:
|
||||||
ForceSetMove(CustomerMovingType.WalkCenter);
|
ForceSetMove(CustomerMovingType.WalkCenter);
|
||||||
|
AddMove(CustomerMovingType.WalkSide);
|
||||||
break;
|
break;
|
||||||
case CustomerState.CenterStop:
|
case CustomerState.CenterStop:
|
||||||
// 中央付近で立ち止まる
|
// 中央付近で立ち止まる
|
||||||
ForceSetMove(CustomerMovingType.WalkCenter);
|
ForceSetMove(CustomerMovingType.WalkCenter);
|
||||||
AddMove(CustomerMovingType.StayBack);
|
AddMove(CustomerMovingType.StayBack);
|
||||||
break;
|
break;
|
||||||
|
case CustomerState.TouchNotice:
|
||||||
|
ForceSetMove(CustomerMovingType.TouchNotice, 1f);
|
||||||
|
break;
|
||||||
|
case CustomerState.TouchQuestion:
|
||||||
|
ForceSetMove(CustomerMovingType.TouchQuestion, 1.2f);
|
||||||
|
AddMove(CustomerMovingType.StayBack);
|
||||||
|
AddMove(CustomerMovingType.WalkSide);
|
||||||
|
break;
|
||||||
case CustomerState.Wait:
|
case CustomerState.Wait:
|
||||||
// 店に向かう&順番待ち
|
// 店に向かう&順番待ち
|
||||||
// 近くの場合その場に待機
|
// 近くの場合その場に待機
|
||||||
|
|
@ -225,7 +242,6 @@ public class CustomerController : MonoBehaviour
|
||||||
SetMove(type, duration);
|
SetMove(type, duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
// キャラの奥行き描画順のため、y方向に対応したz軸を設定
|
|
||||||
private void SetMove(CustomerMovingType type, float duration = 0f)
|
private void SetMove(CustomerMovingType type, float duration = 0f)
|
||||||
{
|
{
|
||||||
if (currentMovingType.Value == type)
|
if (currentMovingType.Value == type)
|
||||||
|
|
@ -255,10 +271,11 @@ public class CustomerController : MonoBehaviour
|
||||||
}
|
}
|
||||||
speed = walkSideSpeed;
|
speed = walkSideSpeed;
|
||||||
break;
|
break;
|
||||||
case CustomerMovingType.StayBackOrder:
|
case CustomerMovingType.TouchNotice:
|
||||||
// オーダー
|
case CustomerMovingType.TouchQuestion:
|
||||||
speed = 0f;
|
SetWayPoint(transform.localPosition);
|
||||||
break;
|
break;
|
||||||
|
case CustomerMovingType.StayBackOrder:
|
||||||
case CustomerMovingType.StayBack:
|
case CustomerMovingType.StayBack:
|
||||||
speed = 0f;
|
speed = 0f;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -305,30 +305,20 @@ public class Market : SingletonMonoBehaviour<Market>
|
||||||
customerController.CustomerPrefab = prefab;
|
customerController.CustomerPrefab = prefab;
|
||||||
customerControllerList.Add(customerController);
|
customerControllerList.Add(customerController);
|
||||||
|
|
||||||
|
customerController.ChangeCustomerState(isCustomer ? CustomerState.WalkShop : CustomerState.Walk);
|
||||||
if (isCustomer)
|
customerController.TappedObservable
|
||||||
{
|
.Take(1)
|
||||||
// 近くまで歩く(タップされたらcustomerList.Add()
|
.Subscribe(_ =>
|
||||||
customerController.ChangeCustomerState(CustomerState.WalkShop);
|
{
|
||||||
customerController.TappedObservable
|
if (shopState.Value == ShopState.Open)
|
||||||
.TakeUntil(customerController.MoveEndObservable.Where(type => type == CustomerMovingType.WalkCenter))
|
|
||||||
.Take(1)
|
|
||||||
.Subscribe(_ =>
|
|
||||||
{
|
{
|
||||||
customerList.Add(customerController);
|
customerController.ChangeCustomerState(CustomerState.TouchNotice);
|
||||||
}).AddTo(customerController);
|
}
|
||||||
}
|
else
|
||||||
else
|
|
||||||
{
|
|
||||||
// 歩行者はタップ後customerList.Add()
|
|
||||||
customerController.ChangeCustomerState(CustomerState.Walk);
|
|
||||||
customerController.TappedObservable
|
|
||||||
.Take(1)
|
|
||||||
.Subscribe(_ =>
|
|
||||||
{
|
{
|
||||||
customerList.Add(customerController);
|
customerController.ChangeCustomerState(CustomerState.TouchQuestion);
|
||||||
}).AddTo(customerController);
|
}
|
||||||
}
|
}).AddTo(customerController);
|
||||||
}).AddTo(this);
|
}).AddTo(this);
|
||||||
|
|
||||||
// お客さんが少なくなったら弟が走る
|
// お客さんが少なくなったら弟が走る
|
||||||
|
|
@ -370,10 +360,16 @@ public class Market : SingletonMonoBehaviour<Market>
|
||||||
customerControllerList.Remove(customerController);
|
customerControllerList.Remove(customerController);
|
||||||
Destroy(customerController.gameObject);
|
Destroy(customerController.gameObject);
|
||||||
break;
|
break;
|
||||||
|
case CustomerMovingType.TouchNotice:
|
||||||
|
customerList.Add(customerController);
|
||||||
|
break;
|
||||||
case CustomerMovingType.WalkCenter:
|
case CustomerMovingType.WalkCenter:
|
||||||
if (customerController.State.Value == CustomerState.WalkShop)
|
if (customerController.State.Value == CustomerState.WalkShop)
|
||||||
{
|
{
|
||||||
customerList.Add(customerController);
|
if (shopState.Value == ShopState.Open)
|
||||||
|
{
|
||||||
|
customerList.Add(customerController);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CustomerMovingType.WalkBackHalf:
|
case CustomerMovingType.WalkBackHalf:
|
||||||
|
|
@ -534,13 +530,13 @@ public class Market : SingletonMonoBehaviour<Market>
|
||||||
customerController.CustomerPrefab = customerData.ChooseNormalPrefab();
|
customerController.CustomerPrefab = customerData.ChooseNormalPrefab();
|
||||||
customerControllerList.Add(customerController);
|
customerControllerList.Add(customerController);
|
||||||
|
|
||||||
// タップ後customerList.Add()
|
// タップ
|
||||||
customerController.ChangeCustomerState(CustomerState.CenterStop);
|
customerController.ChangeCustomerState(CustomerState.CenterStop);
|
||||||
customerController.TappedObservable
|
customerController.TappedObservable
|
||||||
.Take(1)
|
.Take(1)
|
||||||
.Subscribe(_ =>
|
.Subscribe(_ =>
|
||||||
{
|
{
|
||||||
customerList.Add(customerController);
|
customerController.ChangeCustomerState(CustomerState.TouchNotice);
|
||||||
}).AddTo(customerController);
|
}).AddTo(customerController);
|
||||||
return customerController;
|
return customerController;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue