Skip to content

Commit

Permalink
Level slide tweens on success are created
Browse files Browse the repository at this point in the history
  • Loading branch information
arifemrebulut committed Sep 22, 2022
1 parent 7e4d787 commit 7b4fc88
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
3 changes: 2 additions & 1 deletion Assets/Scenes/Game.unity
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,8 @@ MonoBehaviour:
levelBasePrefab: {fileID: 546593753614098565, guid: 19294428ce35f254fb56b3fdf1fc54ac, type: 3}
nextLevelInstantiatePoint: {fileID: 820352262}
levelDestroyPoint: {fileID: 820352261}
moveDuration: 0.2
oldLevelSlideDuration: 0.25
newLevelSlideDuration: 0.4
--- !u!1 &604123958
GameObject:
m_ObjectHideFlags: 0
Expand Down
13 changes: 7 additions & 6 deletions Assets/Scripts/LevelManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ public class LevelManager : MonoBehaviour
[SerializeField] private Transform nextLevelInstantiatePoint;
[SerializeField] private Transform levelDestroyPoint;

[Header("Move Level Tween")]
[SerializeField] private float moveDuration;
[Header("Level Success Slide Tween")]
[SerializeField] private float oldLevelSlideDuration;
[SerializeField] private float newLevelSlideDuration;

private GameObject currentLevel;
private LevelData currentLevelData;
Expand Down Expand Up @@ -110,8 +111,8 @@ private void MoveOldLevelToDestroyPoint()
{
Sequence sequence = DOTween.Sequence();

sequence.Append(currentLevel.transform.DOMove(levelDestroyPoint.position, moveDuration)
.SetEase(Ease.Linear)
sequence.Append(currentLevel.transform.DOMove(levelDestroyPoint.position, oldLevelSlideDuration)
.SetEase(Ease.InCirc)
.OnComplete(() =>
{
Destroy(currentLevel);
Expand All @@ -124,8 +125,8 @@ private void MoveOldLevelToDestroyPoint()

private void MoveNewLevelToCenter()
{
currentLevel.transform.DOMove(Vector3.zero, moveDuration)
.SetEase(Ease.Linear);
currentLevel.transform.DOMove(Vector3.zero, newLevelSlideDuration)
.SetEase(Ease.OutCirc);
}

private GameObject GetPrefabFromColor(Color color)
Expand Down

0 comments on commit 7b4fc88

Please sign in to comment.