滑空追加

This commit is contained in:
kimura 2022-07-15 14:07:52 +09:00
parent 747e3e9a0e
commit 855714754c
3 changed files with 167 additions and 9 deletions

View File

@ -43,7 +43,7 @@ RenderSettings:
--- !u!157 &3 --- !u!157 &3
LightmapSettings: LightmapSettings:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
serializedVersion: 11 serializedVersion: 12
m_GIWorkflowMode: 1 m_GIWorkflowMode: 1
m_GISettings: m_GISettings:
serializedVersion: 2 serializedVersion: 2
@ -98,7 +98,7 @@ LightmapSettings:
m_TrainingDataDestination: TrainingData m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4 m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 0} m_LightingDataAsset: {fileID: 0}
m_UseShadowmask: 1 m_LightingSettings: {fileID: 1138715346}
--- !u!196 &4 --- !u!196 &4
NavMeshSettings: NavMeshSettings:
serializedVersion: 2 serializedVersion: 2
@ -118,6 +118,8 @@ NavMeshSettings:
manualTileSize: 0 manualTileSize: 0
tileSize: 256 tileSize: 256
accuratePlacement: 0 accuratePlacement: 0
maxJobWorkers: 0
preserveTilesOutsideBounds: 0
debug: debug:
m_Flags: 0 m_Flags: 0
m_NavMeshData: {fileID: 0} m_NavMeshData: {fileID: 0}
@ -147,6 +149,7 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 966618983} - {fileID: 966618983}
- {fileID: 1471947211} - {fileID: 1471947211}
@ -270,6 +273,7 @@ RectTransform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 1736734470} m_Father: {fileID: 1736734470}
m_RootOrder: 0 m_RootOrder: 0
@ -294,6 +298,7 @@ MonoBehaviour:
m_Material: {fileID: 0} m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_RaycastTarget: 1 m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1 m_Maskable: 1
m_OnCullStateChanged: m_OnCullStateChanged:
m_PersistentCalls: m_PersistentCalls:
@ -373,6 +378,7 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 582710106} - {fileID: 582710106}
- {fileID: 475061233} - {fileID: 475061233}
@ -567,6 +573,7 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 3 m_RootOrder: 3
@ -599,6 +606,7 @@ RectTransform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 1725870972} m_Father: {fileID: 1725870972}
m_RootOrder: 0 m_RootOrder: 0
@ -623,6 +631,7 @@ MonoBehaviour:
m_Material: {fileID: 0} m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_RaycastTarget: 1 m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1 m_Maskable: 1
m_OnCullStateChanged: m_OnCullStateChanged:
m_PersistentCalls: m_PersistentCalls:
@ -1165,6 +1174,7 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0} m_LocalScale: {x: 0, y: 0, z: 0}
m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 434624159} - {fileID: 434624159}
m_Father: {fileID: 1871342} m_Father: {fileID: 1871342}
@ -1226,6 +1236,7 @@ MonoBehaviour:
m_FallbackScreenDPI: 96 m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96 m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1 m_DynamicPixelsPerUnit: 1
m_PresetInfoIsWorld: 0
--- !u!223 &966618987 --- !u!223 &966618987
Canvas: Canvas:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1284,6 +1295,68 @@ RectTransform:
type: 3} type: 3}
m_PrefabInstance: {fileID: 7325523898178317159} m_PrefabInstance: {fileID: 7325523898178317159}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
--- !u!850595691 &1138715346
LightingSettings:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Settings.lighting
serializedVersion: 4
m_GIWorkflowMode: 1
m_EnableBakedLightmaps: 0
m_EnableRealtimeLightmaps: 0
m_RealtimeEnvironmentLighting: 1
m_BounceScale: 1
m_AlbedoBoost: 1
m_IndirectOutputScale: 1
m_UsingShadowmask: 1
m_BakeBackend: 1
m_LightmapMaxSize: 1024
m_BakeResolution: 40
m_Padding: 2
m_LightmapCompression: 3
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_ExtractAO: 0
m_MixedBakeMode: 2
m_LightmapsBakeMode: 1
m_FilterMode: 1
m_LightmapParameters: {fileID: 15204, guid: 0000000000000000f000000000000000, type: 0}
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_RealtimeResolution: 2
m_ForceWhiteAlbedo: 0
m_ForceUpdates: 0
m_FinalGather: 0
m_FinalGatherRayCount: 256
m_FinalGatherFiltering: 1
m_PVRCulling: 1
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 512
m_PVREnvironmentSampleCount: 256
m_PVREnvironmentReferencePointCount: 2048
m_LightProbeSampleCountMultiplier: 4
m_PVRBounces: 2
m_PVRMinBounces: 2
m_PVREnvironmentMIS: 1
m_PVRFilteringMode: 1
m_PVRDenoiserTypeDirect: 1
m_PVRDenoiserTypeIndirect: 1
m_PVRDenoiserTypeAO: 1
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_PVRTiledBaking: 0
--- !u!114 &1213307027 --- !u!114 &1213307027
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1314,6 +1387,16 @@ PrefabInstance:
propertyPath: hitTime propertyPath: hitTime
value: 1.4 value: 1.4
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 2607884839347368726, guid: acd6e6365b5fe4863aedc684a50b8028,
type: 3}
propertyPath: fallSpeed
value: 0.07
objectReference: {fileID: 0}
- target: {fileID: 2607884839347368726, guid: acd6e6365b5fe4863aedc684a50b8028,
type: 3}
propertyPath: flyingFallSpeed
value: 0.02
objectReference: {fileID: 0}
- target: {fileID: 4931350312200274921, guid: acd6e6365b5fe4863aedc684a50b8028, - target: {fileID: 4931350312200274921, guid: acd6e6365b5fe4863aedc684a50b8028,
type: 3} type: 3}
propertyPath: m_RootOrder propertyPath: m_RootOrder
@ -1417,6 +1500,7 @@ RectTransform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 2085388515} m_Father: {fileID: 2085388515}
m_RootOrder: 0 m_RootOrder: 0
@ -1441,6 +1525,7 @@ MonoBehaviour:
m_Material: {fileID: 0} m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_RaycastTarget: 1 m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1 m_Maskable: 1
m_OnCullStateChanged: m_OnCullStateChanged:
m_PersistentCalls: m_PersistentCalls:
@ -1500,6 +1585,7 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 1725870972} - {fileID: 1725870972}
- {fileID: 2085388515} - {fileID: 2085388515}
@ -1762,6 +1848,7 @@ Transform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 9.285316, y: -2.5877247, z: -5.716469} m_LocalPosition: {x: 9.285316, y: -2.5877247, z: -5.716469}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 2104274173} - {fileID: 2104274173}
m_Father: {fileID: 1871342} m_Father: {fileID: 1871342}
@ -1793,6 +1880,7 @@ Transform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 15.8, y: -11.06614, z: -46.71647} m_LocalPosition: {x: 15.8, y: -11.06614, z: -46.71647}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 894575454} - {fileID: 894575454}
- {fileID: 2044773546} - {fileID: 2044773546}
@ -1856,6 +1944,7 @@ RectTransform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 579812655} - {fileID: 579812655}
m_Father: {fileID: 1303086387} m_Father: {fileID: 1303086387}
@ -1880,6 +1969,7 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_Navigation: m_Navigation:
m_Mode: 3 m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0} m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0} m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0} m_SelectOnLeft: {fileID: 0}
@ -1924,6 +2014,7 @@ MonoBehaviour:
m_Material: {fileID: 0} m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1 m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1 m_Maskable: 1
m_OnCullStateChanged: m_OnCullStateChanged:
m_PersistentCalls: m_PersistentCalls:
@ -1975,6 +2066,7 @@ RectTransform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 275350937} - {fileID: 275350937}
m_Father: {fileID: 1303086387} m_Father: {fileID: 1303086387}
@ -1999,6 +2091,7 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_Navigation: m_Navigation:
m_Mode: 3 m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0} m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0} m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0} m_SelectOnLeft: {fileID: 0}
@ -2043,6 +2136,7 @@ MonoBehaviour:
m_Material: {fileID: 0} m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1 m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1 m_Maskable: 1
m_OnCullStateChanged: m_OnCullStateChanged:
m_PersistentCalls: m_PersistentCalls:
@ -2216,6 +2310,7 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 4 m_RootOrder: 4
@ -2444,6 +2539,7 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -10} m_LocalPosition: {x: 0, y: 0, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0 m_RootOrder: 0
@ -2519,6 +2615,7 @@ RectTransform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 1266828205} - {fileID: 1266828205}
m_Father: {fileID: 1303086387} m_Father: {fileID: 1303086387}
@ -2543,6 +2640,7 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_Navigation: m_Navigation:
m_Mode: 3 m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0} m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0} m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0} m_SelectOnLeft: {fileID: 0}
@ -2587,6 +2685,7 @@ MonoBehaviour:
m_Material: {fileID: 0} m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1 m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1 m_Maskable: 1
m_OnCullStateChanged: m_OnCullStateChanged:
m_PersistentCalls: m_PersistentCalls:

View File

@ -239,6 +239,7 @@ namespace MyGame.Scenes.MiniGame.Scripts
{ {
player.Jump(); player.Jump();
} }
player.SetJumpHold(Input.GetMouseButton(0) || Input.GetKey(KeyCode.Space));
player.Move(); player.Move();
// カメラ移動 // カメラ移動
cameraTransform.position = playerTransform.position.x * Vector3.right + cameraOffset; cameraTransform.position = playerTransform.position.x * Vector3.right + cameraOffset;

View File

@ -13,6 +13,8 @@ namespace MyGame.Scenes.MiniGame.Scripts
[SerializeField] private float hitWaitTime = 1f; [SerializeField] private float hitWaitTime = 1f;
[SerializeField] private AnimationCurve jumpAnimationCurve; [SerializeField] private AnimationCurve jumpAnimationCurve;
[SerializeField] private AnimationCurve hitAnimationCurve; [SerializeField] private AnimationCurve hitAnimationCurve;
[SerializeField] private float flyingFallSpeed;
[SerializeField] private float fallSpeed;
[SerializeField] private GameObject itemHitCollider; [SerializeField] private GameObject itemHitCollider;
[SerializeField] private GameObject obstacleHitCollider; [SerializeField] private GameObject obstacleHitCollider;
[SerializeField] private GameObject level1; [SerializeField] private GameObject level1;
@ -24,12 +26,17 @@ namespace MyGame.Scenes.MiniGame.Scripts
[SerializeField] private GameObject hitEffectPrefab; [SerializeField] private GameObject hitEffectPrefab;
private Animator animator; private Animator animator;
private bool isJump; private bool isJump;
private bool isFall;
private bool isButtonHold;
private bool isFlying;
private bool isResult; private bool isResult;
private bool isHit; private bool isHit;
public bool IsHit => isHit; public bool IsHit => isHit;
private readonly BoolReactiveProperty isHitStay = new BoolReactiveProperty(); private readonly BoolReactiveProperty isHitStay = new BoolReactiveProperty();
private IDisposable hitDisposable; private IDisposable hitDisposable;
private IDisposable jumpHoldDisposable;
private Coroutine jumpCoroutine; private Coroutine jumpCoroutine;
private Coroutine jumpFallCoroutine;
private Vector3 basePos; private Vector3 basePos;
private int count; private int count;
public IObservable<Collider2D> OnHitItem => itemHitCollider.OnTriggerEnter2DAsObservable().TakeUntilDestroy(this); public IObservable<Collider2D> OnHitItem => itemHitCollider.OnTriggerEnter2DAsObservable().TakeUntilDestroy(this);
@ -75,21 +82,70 @@ namespace MyGame.Scenes.MiniGame.Scripts
SoundManager.Instance.PlaySE("se_minigame_Jump"); SoundManager.Instance.PlaySE("se_minigame_Jump");
animator?.Play("Brother_pink_jump", 0, 0); animator?.Play("Brother_pink_jump", 0, 0);
isJump = true; isJump = true;
isFall = false;
var lastFrame = jumpAnimationCurve[jumpAnimationCurve.length - 1]; var lastFrame = jumpAnimationCurve[jumpAnimationCurve.length - 1];
var jumpTime = lastFrame.time * 2; // 最高点までのジャンプ
jumpCoroutine = this.CallLerp(jumpTime, t => jumpCoroutine = this.CallLerp(lastFrame.time, t =>
{ {
transform.SetLocalPositionY(basePos.y + jumpAnimationCurve.Evaluate(t * jumpTime)); transform.SetLocalPositionY(basePos.y + jumpAnimationCurve.Evaluate(t * lastFrame.time));
}, () => }, () =>
{ {
isJump = false; // 最高点到達後、落下
if (isResult) isFall = true;
jumpFallCoroutine = this.CallLerp(lastFrame.time, t =>
{ {
Result(); transform.SetLocalPositionY(basePos.y + jumpAnimationCurve.Evaluate(t * lastFrame.time + lastFrame.time));
} }, () =>
{
isJump = false;
isFall = false;
if (isResult)
{
Result();
}
});
}); });
} }
/// <summary>
/// ジャンプ最高点到達後 isFall
/// 滑空時はflyingFallSpeedで緩やかに落ちる。滑空後にボタン離すとfallSpeedで落ちる
/// </summary>
/// <param name="active"></param>
public void SetJumpHold(bool active)
{
if (isHit)
{
return;
}
isButtonHold = active;
// 滑空モード開始
if (isFall && active && !isFlying)
{
isFlying = true;
this.SafeStopCoroutine(jumpFallCoroutine);
jumpHoldDisposable?.Dispose();
jumpHoldDisposable = this.UpdateAsObservable()
.TakeWhile(_ => transform.localPosition.y > basePos.y)
.Subscribe(_ =>
{
// 滑空or落下切り替え
var currentSpeed = isButtonHold ? -flyingFallSpeed : -fallSpeed;
transform.AddLocalPositionY(currentSpeed);
}, () =>
{
isJump = false;
isFall = false;
isFlying = false;
if (isResult)
{
Result();
}
}).AddTo(this);
}
}
// こける // こける
public void Hit(Vector3 hitPos) public void Hit(Vector3 hitPos)
{ {
@ -105,6 +161,8 @@ namespace MyGame.Scenes.MiniGame.Scripts
hitDisposable?.Dispose(); hitDisposable?.Dispose();
this.SafeStopCoroutine(jumpCoroutine); this.SafeStopCoroutine(jumpCoroutine);
this.SafeStopCoroutine(jumpFallCoroutine);
jumpHoldDisposable?.Dispose();
var diffHeight = transform.localPosition.y - basePos.y; var diffHeight = transform.localPosition.y - basePos.y;
jumpCoroutine = this.CallLerp(diffHeight == 0f ? 0f : fallTime, t => jumpCoroutine = this.CallLerp(diffHeight == 0f ? 0f : fallTime, t =>
{ {