カウンター修正

This commit is contained in:
kimura 2021-10-29 18:04:31 +09:00
parent 4774954a5c
commit 15c6b856b3
3 changed files with 92 additions and 59 deletions

View File

@ -801,6 +801,82 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 323920545}
m_CullTransparentMesh: 0
--- !u!1 &347092270
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 347092271}
- component: {fileID: 347092273}
- component: {fileID: 347092272}
m_Layer: 5
m_Name: StockCorn_addition
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &347092271
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 347092270}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1106859980}
m_Father: {fileID: 387414334}
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 66, y: -241}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 1}
--- !u!114 &347092272
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 347092270}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 36e90b93a284494f950c1e35f9b68535, type: 3}
m_Name:
m_EditorClassIdentifier:
counterAnimator: {fileID: 1106859981}
counter: {fileID: 323920547}
triggerThrottle: 0.2
countDuration: 0.5
waitDisappeared: 3
--- !u!223 &347092273
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 347092270}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 2
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 1
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 0
m_SortingLayerID: 0
m_SortingOrder: 39
m_TargetDisplay: 0
--- !u!1 &355725951
GameObject:
m_ObjectHideFlags: 0
@ -2320,7 +2396,7 @@ MonoBehaviour:
fertilizerButtonView: {fileID: 525465089}
brotherFertilizerAnimation: {fileID: 715847677}
counterView: {fileID: 1507187603938887411}
additionView: {fileID: 1106859982}
additionView: {fileID: 347092272}
animationTarget: {fileID: 1881129199}
plantLines:
- {fileID: 1656378502}
@ -3099,8 +3175,6 @@ GameObject:
m_Component:
- component: {fileID: 1106859980}
- component: {fileID: 1106859981}
- component: {fileID: 1106859982}
- component: {fileID: 1106859983}
m_Layer: 5
m_Name: StockCorn_addition_Animation
m_TagString: Untagged
@ -3120,14 +3194,14 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 457045028}
m_Father: {fileID: 387414334}
m_RootOrder: 7
m_Father: {fileID: 347092271}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 66, y: -241}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 1}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!95 &1106859981
Animator:
serializedVersion: 3
@ -3147,44 +3221,6 @@ Animator:
m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorControllerStateOnDisable: 0
--- !u!114 &1106859982
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1106859979}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 36e90b93a284494f950c1e35f9b68535, type: 3}
m_Name:
m_EditorClassIdentifier:
counterAnimator: {fileID: 1106859981}
counter: {fileID: 323920547}
triggerThrottle: 0.2
countDuration: 0.5
waitDisappeared: 3
--- !u!223 &1106859983
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1106859979}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 2
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 1
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 0
m_SortingLayerID: 0
m_SortingOrder: 39
m_TargetDisplay: 0
--- !u!1 &1120224446
GameObject:
m_ObjectHideFlags: 0
@ -14773,7 +14809,7 @@ PrefabInstance:
- target: {fileID: 4293843006989820480, guid: 1c993e9707f1a4fada56020be27dde28,
type: 3}
propertyPath: m_RootOrder
value: 9
value: 10
objectReference: {fileID: 0}
- target: {fileID: 4293843006989820480, guid: 1c993e9707f1a4fada56020be27dde28,
type: 3}

View File

@ -203,7 +203,7 @@ public class CornField : MonoBehaviour
// 収穫カウンター+吸収演出
cornHarvester.FinishHarvested
.Scan((list, newList) => (newList.count, list.colliders.Concat(newList.colliders).ToList()))
.Scan((list, newList) => (list.count += newList.count, list.colliders.Concat(newList.colliders).ToList()))
.Throttle(TimeSpan.FromSeconds(countThrottle))
.Take(1)
.RepeatUntilDestroy(this)
@ -247,10 +247,12 @@ public class CornField : MonoBehaviour
additionView.AddHarvestedCount(x.count);
});
}).AddTo(this);
additionView.EndObservable.Subscribe(x =>
var counterTotalCorn = gameData.CornSeed;
additionView.EndObservable.Subscribe(addCount =>
{
counterTotalCorn += addCount;
counterView.PlayEffect();
counterView.SetHarvestedCount(gameData.CornSeed);
counterView.SetHarvestedCount(counterTotalCorn);
}).AddTo(this);
}

View File

@ -20,7 +20,7 @@ public class HarvestedAdditionView : MonoBehaviour
[SerializeField] private float countDuration = .4f;
[Tooltip("コーンが来なくなってから待つ時間")]
[SerializeField] private float waitDisappeared = 2f;
public bool IsStopDisapper;
[NonSerialized] public bool IsStopDisapper;
private static readonly string harvestedCountFormat = "{0}";
private static readonly string hasCountFormat = "{0}";
private readonly Subject<Unit> playEffectObserve = new Subject<Unit>();
@ -38,10 +38,10 @@ public class HarvestedAdditionView : MonoBehaviour
.ThrottleFirst(TimeSpan.FromSeconds(triggerThrottle))
.Subscribe(_ =>
{
transform.SetLocalScale(1);
this.SafeStopCoroutine(disapperCoroutine);
if (flag)
{
counterAnimator.transform.SetLocalScale(1);
counterAnimator.SetTrigger(Appear);
}
else
@ -69,18 +69,13 @@ public class HarvestedAdditionView : MonoBehaviour
{
Reset();
counterAnimator.SetTrigger(Disappear);
this.CallWaitForSeconds(.25f, () =>
{
counterAnimator.transform.SetLocalScale(0);
});
});
}).AddTo(this);
}
public void Initialize(int count)
{
counterAnimator.transform.SetLocalScale(0);
counterAnimator.SetTrigger(Disappear);
transform.SetLocalScale(0);
Reset();
}