in out circ

This commit is contained in:
Rapandrasmus 2023-10-08 11:31:19 +02:00
parent 0ac28ede0e
commit ac59780559
5 changed files with 25 additions and 14 deletions

View file

@ -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

View file

@ -163,7 +163,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
_fullRotRange: 160
_holdLength: 1
_ease: 4
_ease: 22
_rotateRoot: {fileID: 2068126119450832752}
_gripPoint: {fileID: 8286548847234487440}
--- !u!114 &3772265357728581139

View file

@ -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

View file

@ -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;

View file

@ -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()
}
});
}