From ac5978055972e30f39e2066e58ee40e5216bb992 Mon Sep 17 00:00:00 2001 From: Rapandrasmus <78219215+Rapandrasmus@users.noreply.github.com> Date: Sun, 8 Oct 2023 11:31:19 +0200 Subject: [PATCH] in out circ --- .../Games/AnimalAcrobat/Elephant.prefab | 3 +-- .../Games/AnimalAcrobat/WhiteMonkey.prefab | 2 +- .../Games/AnimalAcrobat/WhiteMonkeys.prefab | 8 +++---- .../Games/AnimalAcrobat/AcrobatObstacle.cs | 2 ++ .../Games/AnimalAcrobat/AnimalAcrobat.cs | 24 +++++++++++++------ 5 files changed, 25 insertions(+), 14 deletions(-) diff --git a/Assets/Resources/Prefabs/Games/AnimalAcrobat/Elephant.prefab b/Assets/Resources/Prefabs/Games/AnimalAcrobat/Elephant.prefab index 75c302cfe..c22eafcc0 100644 --- a/Assets/Resources/Prefabs/Games/AnimalAcrobat/Elephant.prefab +++ b/Assets/Resources/Prefabs/Games/AnimalAcrobat/Elephant.prefab @@ -562,9 +562,8 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: _fullRotRange: 160 - _spawnOffset: -2 _holdLength: 2 - _ease: 4 + _ease: 22 _rotateRoot: {fileID: 2616646720197201304} _gripPoint: {fileID: 2131794628642567477} --- !u!114 &-4645702950898394595 diff --git a/Assets/Resources/Prefabs/Games/AnimalAcrobat/WhiteMonkey.prefab b/Assets/Resources/Prefabs/Games/AnimalAcrobat/WhiteMonkey.prefab index f4dbe60a6..fa44dd869 100644 --- a/Assets/Resources/Prefabs/Games/AnimalAcrobat/WhiteMonkey.prefab +++ b/Assets/Resources/Prefabs/Games/AnimalAcrobat/WhiteMonkey.prefab @@ -163,7 +163,7 @@ MonoBehaviour: m_EditorClassIdentifier: _fullRotRange: 160 _holdLength: 1 - _ease: 4 + _ease: 22 _rotateRoot: {fileID: 2068126119450832752} _gripPoint: {fileID: 8286548847234487440} --- !u!114 &3772265357728581139 diff --git a/Assets/Resources/Prefabs/Games/AnimalAcrobat/WhiteMonkeys.prefab b/Assets/Resources/Prefabs/Games/AnimalAcrobat/WhiteMonkeys.prefab index 32d200ecc..a2501d567 100644 --- a/Assets/Resources/Prefabs/Games/AnimalAcrobat/WhiteMonkeys.prefab +++ b/Assets/Resources/Prefabs/Games/AnimalAcrobat/WhiteMonkeys.prefab @@ -1934,7 +1934,7 @@ MonoBehaviour: m_EditorClassIdentifier: _fullRotRange: 160 _holdLength: 3 - _ease: 4 + _ease: 22 _rotateRoot: {fileID: 3903953954711634507} _gripPoint: {fileID: 3800820123473635694} --- !u!114 &3068772248330600904 @@ -1964,9 +1964,9 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: _anim: {fileID: 8483464683545527156} - _animLength: 0.6 - _beatLength: 2.5 - _ease: 4 + _animLength: 0.6785714 + _beatLength: 3 + _ease: 22 --- !u!1 &8302616130811808557 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Games/AnimalAcrobat/AcrobatObstacle.cs b/Assets/Scripts/Games/AnimalAcrobat/AcrobatObstacle.cs index 0bc9ee029..a2701b9e6 100644 --- a/Assets/Scripts/Games/AnimalAcrobat/AcrobatObstacle.cs +++ b/Assets/Scripts/Games/AnimalAcrobat/AcrobatObstacle.cs @@ -21,6 +21,8 @@ namespace HeavenStudio.Games.Scripts_AnimalAcrobat private float _halfRotRange; private EasingFunction.Function _func; + public EasingFunction.Ease Ease => _ease; + [Header("Components")] [SerializeField] private Transform _rotateRoot; [SerializeField] private Transform _gripPoint; diff --git a/Assets/Scripts/Games/AnimalAcrobat/AnimalAcrobat.cs b/Assets/Scripts/Games/AnimalAcrobat/AnimalAcrobat.cs index 8532166ef..619a7071a 100644 --- a/Assets/Scripts/Games/AnimalAcrobat/AnimalAcrobat.cs +++ b/Assets/Scripts/Games/AnimalAcrobat/AnimalAcrobat.cs @@ -88,6 +88,7 @@ namespace HeavenStudio.Games public double length; public float rotationDistance; public float rotationHeight; + public Util.EasingFunction.Ease ease; public double GetHoldLengthFromType() { @@ -106,8 +107,6 @@ namespace HeavenStudio.Games private int _animalPoolIndex = 0; private float _animalSummatedDistance = 0; private bool _lastAnimalWasGiraffe = false; - - private Util.EasingFunction.Function _funcEaseInOut; private Util.EasingFunction.Function _funcEaseOut; private double _jumpBeat = double.MaxValue; @@ -119,7 +118,6 @@ namespace HeavenStudio.Games private void Awake() { instance = this; - _funcEaseInOut = Util.EasingFunction.GetEasingFunction(Util.EasingFunction.Ease.EaseInOutQuad); _funcEaseOut = Util.EasingFunction.GetEasingFunction(Util.EasingFunction.Ease.EaseOutQuad); } @@ -214,9 +212,11 @@ namespace HeavenStudio.Games } if (normalizedHold >= 0 && normalizedHold <= 1) { - float newX = _funcEaseInOut(_lastCameraX + distance, _lastCameraX + distance + currentAnimal.rotationDistance, normalizedHold); + var func = Util.EasingFunction.GetEasingFunction(currentAnimal.ease); - float angle = _funcEaseInOut(0, 180, normalizedHold); + float newX = func(_lastCameraX + distance, _lastCameraX + distance + currentAnimal.rotationDistance, normalizedHold); + + float angle = func(0, 180, normalizedHold); float newY = Mathf.Sin(angle * Mathf.Deg2Rad) * currentAnimal.rotationHeight; _scroll.localPosition = new Vector3(-newX, -newY, 0); @@ -328,7 +328,8 @@ namespace HeavenStudio.Games length = 5, type = AnimalType.MonkeysLong, rotationDistance = _monkeysLong.GetRotationDistance(), - rotationHeight = _monkeysLong.GetRotationHeight() + rotationHeight = _monkeysLong.GetRotationHeight(), + ease = _monkeysLong.Ease }); _queuedAnimals.Add(new QueuedAnimal() { @@ -336,7 +337,8 @@ namespace HeavenStudio.Games length = 3, type = AnimalType.MonkeysShort, rotationDistance = _monkeysShort.GetRotationDistance(), - rotationHeight = _monkeysShort.GetRotationHeight() + rotationHeight = _monkeysShort.GetRotationHeight(), + ease = _monkeysShort.Ease }); continue; } @@ -374,6 +376,14 @@ namespace HeavenStudio.Games "animalAcrobat/monkeyLong" => _monkeysLong.GetRotationHeight(), "animalAcrobat/monkeyShort" => _monkeysShort.GetRotationHeight(), _ => throw new System.NotImplementedException() + }, + ease = animal.datamodel switch + { + "animalAcrobat/elephant" => _elephant.Ease, + "animalAcrobat/giraffe" => _giraffe.Ease, + "animalAcrobat/monkeyLong" => _monkeysLong.Ease, + "animalAcrobat/monkeyShort" => _monkeysShort.Ease, + _ => throw new System.NotImplementedException() } }); }