Adjust Timings
This commit is contained in:
@@ -40,6 +40,21 @@ PrefabInstance:
|
|||||||
value:
|
value:
|
||||||
objectReference: {fileID: 21300000, guid: d1c82e015b38d4448bc1ba5e3eff90fa,
|
objectReference: {fileID: 21300000, guid: d1c82e015b38d4448bc1ba5e3eff90fa,
|
||||||
type: 3}
|
type: 3}
|
||||||
|
- target: {fileID: 7667143225876670884, guid: 724e93e48c6cc0b4ab3d44e5ea34f2ec,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_Color.b
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7667143225876670884, guid: 724e93e48c6cc0b4ab3d44e5ea34f2ec,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_Color.g
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7667143225876670884, guid: 724e93e48c6cc0b4ab3d44e5ea34f2ec,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_Color.r
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 7667143225876670885, guid: 724e93e48c6cc0b4ab3d44e5ea34f2ec,
|
- target: {fileID: 7667143225876670885, guid: 724e93e48c6cc0b4ab3d44e5ea34f2ec,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: type
|
propertyPath: type
|
||||||
@@ -139,3 +154,5 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: 7645dd1d371740729311dd834ab649f3, type: 3}
|
m_Script: {fileID: 11500000, guid: 7645dd1d371740729311dd834ab649f3, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
|
spawnScaleFrom: 0
|
||||||
|
spawnScaleDuration: 0.12
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ namespace Services {
|
|||||||
// remove existing gem/view at that position
|
// remove existing gem/view at that position
|
||||||
DestroyMatchedGems(position);
|
DestroyMatchedGems(position);
|
||||||
|
|
||||||
GemView gemView = this.objectPool.Get(GemType.Bomb, position, this.gameVariables.dropHeight);
|
GemView gemView = this.objectPool.Get(GemType.Bomb, position, 0);
|
||||||
gemView.name = "Gem - " + position.x + ", " + position.y + ' ' + GemType.Bomb;
|
gemView.name = "Gem - " + position.x + ", " + position.y + ' ' + GemType.Bomb;
|
||||||
|
|
||||||
int scoreValue = GemUtils.GetGemValues(color, this.gameVariables.gemsPrefabs).scoreValue;
|
int scoreValue = GemUtils.GetGemValues(color, this.gameVariables.gemsPrefabs).scoreValue;
|
||||||
@@ -258,18 +258,18 @@ namespace Services {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async UniTask FillBoard() {
|
private async UniTask FillBoard() {
|
||||||
await UniTask.Delay(5);
|
await UniTask.Delay(250);
|
||||||
RefillBoard();
|
RefillBoard();
|
||||||
await UniTask.Delay(5);
|
await UniTask.Delay(600);
|
||||||
|
|
||||||
this.matchService.FindAllMatches();
|
this.matchService.FindAllMatches();
|
||||||
if (this.matchService.CurrentMatches.Count > 0) {
|
if (this.matchService.CurrentMatches.Count > 0) {
|
||||||
await UniTask.Delay(5);
|
await UniTask.Delay(600);
|
||||||
|
|
||||||
// In cascades, there is no "creating slot" bomb protection.
|
// In cascades, there is no "creating slot" bomb protection.
|
||||||
await DestroyMatchesAsync(new List<Vector2Int>());
|
await DestroyMatchesAsync(new List<Vector2Int>());
|
||||||
} else {
|
} else {
|
||||||
await UniTask.Delay(5);
|
await UniTask.Delay(250);
|
||||||
this.currentState = GameState.Move;
|
this.currentState = GameState.Move;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using System.Threading;
|
||||||
using Cysharp.Threading.Tasks;
|
using Cysharp.Threading.Tasks;
|
||||||
using Enums;
|
using Enums;
|
||||||
using Services;
|
using Services;
|
||||||
@@ -10,21 +11,68 @@ namespace Views {
|
|||||||
public Gem Gem => this.gem;
|
public Gem Gem => this.gem;
|
||||||
|
|
||||||
private bool isFalling;
|
private bool isFalling;
|
||||||
|
[Header("Spawn Scale")]
|
||||||
|
[SerializeField] private float spawnScaleFrom = 0f;
|
||||||
|
[SerializeField] private float spawnScaleDuration = 0.12f;
|
||||||
|
|
||||||
|
private CancellationTokenSource spawnScaleCts;
|
||||||
|
|
||||||
public void Bind(Gem gem) {
|
public void Bind(Gem gem) {
|
||||||
this.gem = gem;
|
this.gem = gem;
|
||||||
this.gameObject.SetActive(true);
|
this.gameObject.SetActive(true);
|
||||||
|
|
||||||
|
PlaySpawnScale();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Unbind() {
|
public void Unbind() {
|
||||||
|
this.spawnScaleCts?.Cancel();
|
||||||
|
this.spawnScaleCts?.Dispose();
|
||||||
|
this.spawnScaleCts = null;
|
||||||
|
|
||||||
this.gem = null;
|
this.gem = null;
|
||||||
this.gameObject.SetActive(false);
|
this.gameObject.SetActive(false);
|
||||||
this.isFalling = false;
|
this.isFalling = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void PlaySpawnScale() {
|
||||||
|
this.spawnScaleCts?.Cancel();
|
||||||
|
this.spawnScaleCts?.Dispose();
|
||||||
|
this.spawnScaleCts = new CancellationTokenSource();
|
||||||
|
|
||||||
|
this.transform.localScale = Vector3.one * this.spawnScaleFrom;
|
||||||
|
AnimateSpawnScaleAsync(this.spawnScaleCts.Token).Forget();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async UniTask AnimateSpawnScaleAsync(CancellationToken ct) {
|
||||||
|
if (this.spawnScaleDuration <= 0f) {
|
||||||
|
this.transform.localScale = Vector3.one;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
float timer = 0f;
|
||||||
|
while (timer < this.spawnScaleDuration) {
|
||||||
|
ct.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
|
timer += Time.deltaTime;
|
||||||
|
float scale = Mathf.Clamp01(timer / this.spawnScaleDuration);
|
||||||
|
|
||||||
|
scale = Mathf.SmoothStep(0f, 1f, scale);
|
||||||
|
|
||||||
|
this.transform.localScale = Vector3.LerpUnclamped(
|
||||||
|
Vector3.one * this.spawnScaleFrom,
|
||||||
|
Vector3.one,
|
||||||
|
scale
|
||||||
|
);
|
||||||
|
|
||||||
|
await UniTask.Yield(PlayerLoopTiming.Update, ct);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.transform.localScale = Vector3.one;
|
||||||
|
}
|
||||||
|
|
||||||
private async UniTask FallDelay() {
|
private async UniTask FallDelay() {
|
||||||
float randomDelay = 1 * this.gem.Position.y / 100f;
|
float fallDelay = 1 * (this.gem.Position.y / 10f);
|
||||||
await UniTask.WaitForSeconds(randomDelay);
|
await UniTask.WaitForSeconds(fallDelay);
|
||||||
this.isFalling = true;
|
this.isFalling = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user