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