bopping
This commit is contained in:
parent
67276a3b17
commit
e26406b72d
|
|
@ -524,10 +524,11 @@ MonoBehaviour:
|
|||
_monkeysLong: {fileID: -3114631264593203074, guid: f52ef60e472be3047bb77f54d5a3229d, type: 3}
|
||||
_monkeysShort: {fileID: 7370747047491091311, guid: 0dfca7cb5fedf0d40aa26ffd9b4595ae, type: 3}
|
||||
_scroll: {fileID: 6038557817912069913}
|
||||
_playerMonkeyAnim: {fileID: 1240570777207442752}
|
||||
_jumpDistance: 8
|
||||
_jumpDistanceGiraffe: 32
|
||||
_jumpStartCameraDistance: 3
|
||||
_giraffeCameraZoom: 10
|
||||
_giraffeCameraZoom: 12
|
||||
--- !u!1 &9154566379104488428
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -619,6 +620,11 @@ PrefabInstance:
|
|||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 8c681a700cd16784580f97e7f10a53e6, type: 3}
|
||||
--- !u!95 &1240570777207442752 stripped
|
||||
Animator:
|
||||
m_CorrespondingSourceObject: {fileID: 6945261984245565766, guid: 8c681a700cd16784580f97e7f10a53e6, type: 3}
|
||||
m_PrefabInstance: {fileID: 8166682498639938566}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!4 &2661844662320053337 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 6171382744519440479, guid: 8c681a700cd16784580f97e7f10a53e6, type: 3}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,15 @@ namespace HeavenStudio.Games.Loaders
|
|||
{
|
||||
return new Minigame("animalAcrobat", "Animal Acrobat", "FFFFFF", false, false, new List<GameAction>()
|
||||
{
|
||||
new GameAction("bop", "Bop")
|
||||
{
|
||||
function = delegate
|
||||
{
|
||||
var e = eventCaller.currentEntity;
|
||||
AnimalAcrobat.instance.Bop(e.beat, e.length);
|
||||
},
|
||||
resizable = true
|
||||
},
|
||||
new GameAction("elephant", "Elephant")
|
||||
{
|
||||
defaultLength = 4
|
||||
|
|
@ -53,6 +62,7 @@ namespace HeavenStudio.Games
|
|||
|
||||
[Header("Components")]
|
||||
[SerializeField] private Transform _scroll;
|
||||
[SerializeField] private Animator _playerMonkeyAnim;
|
||||
|
||||
[Header("Values")]
|
||||
[SerializeField] private float _jumpDistance = 8;
|
||||
|
|
@ -97,7 +107,6 @@ namespace HeavenStudio.Games
|
|||
private bool _lastAnimalWasGiraffe = false;
|
||||
|
||||
private Util.EasingFunction.Function _funcEaseInOut;
|
||||
private Util.EasingFunction.Function _funcEaseIn;
|
||||
private Util.EasingFunction.Function _funcEaseOut;
|
||||
private Util.EasingFunction.Function _funcSharp;
|
||||
|
||||
|
|
@ -107,7 +116,6 @@ namespace HeavenStudio.Games
|
|||
{
|
||||
instance = this;
|
||||
_funcEaseInOut = Util.EasingFunction.GetEasingFunction(Util.EasingFunction.Ease.EaseInOutQuad);
|
||||
_funcEaseIn = Util.EasingFunction.GetEasingFunction(Util.EasingFunction.Ease.EaseInQuad);
|
||||
_funcEaseOut = Util.EasingFunction.GetEasingFunction(Util.EasingFunction.Ease.EaseOutQuad);
|
||||
_funcSharp = Util.EasingFunction.GetEasingFunction(Util.EasingFunction.Ease.EaseOutQuart);
|
||||
}
|
||||
|
|
@ -120,6 +128,22 @@ namespace HeavenStudio.Games
|
|||
CameraUpdate(cond);
|
||||
}
|
||||
|
||||
public void Bop(double beat, float length)
|
||||
{
|
||||
if (!_playerMonkeyAnim.gameObject.activeSelf) return;
|
||||
|
||||
List<BeatAction.Action> actions = new();
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
actions.Add(new BeatAction.Action(beat + i, delegate
|
||||
{
|
||||
_playerMonkeyAnim.DoScaledAnimationAsync("PlayerBop", 0.5f);
|
||||
}));
|
||||
}
|
||||
|
||||
BeatAction.New(this, actions);
|
||||
}
|
||||
|
||||
private int _animalCameraIndex = 0;
|
||||
private float _lastCameraX = 0;
|
||||
private double _cameraHoldTime = 1;
|
||||
|
|
@ -145,8 +169,8 @@ namespace HeavenStudio.Games
|
|||
{
|
||||
if (normalizedTravel < 0.5)
|
||||
{
|
||||
float normalizedOut = Mathf.Clamp01(cond.GetPositionFromBeat(currentAnimal.startBeat - _cameraHoldTime, 1));
|
||||
newZ = _funcSharp(0, _giraffeCameraZoom, normalizedOut);
|
||||
float normalizedOut = cond.GetPositionFromBeat(currentAnimal.startBeat - _cameraHoldTime, 1);
|
||||
newZ = _funcSharp(0, _giraffeCameraZoom, Mathf.Clamp01(normalizedOut));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue