Player jumping part 1
This commit is contained in:
parent
1359fc3e0c
commit
c8c129724c
|
|
@ -570,6 +570,14 @@ PrefabInstance:
|
|||
m_Modification:
|
||||
m_TransformParent: {fileID: 6038557817912069913}
|
||||
m_Modifications:
|
||||
- target: {fileID: 1357014866786755007, guid: 8c681a700cd16784580f97e7f10a53e6, type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4065495025444683954, guid: 8c681a700cd16784580f97e7f10a53e6, type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4482739629151873282, guid: 8c681a700cd16784580f97e7f10a53e6, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: PlayerMonkey
|
||||
|
|
@ -596,15 +604,15 @@ PrefabInstance:
|
|||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6171382744519440479, guid: 8c681a700cd16784580f97e7f10a53e6, type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: -0
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6171382744519440479, guid: 8c681a700cd16784580f97e7f10a53e6, type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: -0
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6171382744519440479, guid: 8c681a700cd16784580f97e7f10a53e6, type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: -0
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6171382744519440479, guid: 8c681a700cd16784580f97e7f10a53e6, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
|
|
@ -618,6 +626,10 @@ PrefabInstance:
|
|||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7892337920641056061, guid: 8c681a700cd16784580f97e7f10a53e6, type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 8c681a700cd16784580f97e7f10a53e6, type: 3}
|
||||
--- !u!4 &2661844662320053337 stripped
|
||||
|
|
@ -642,7 +654,11 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 9018ffa2d40d7b841a140a5eb406d5e6, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_jumpDistance: 8
|
||||
_jumpHeight: 2
|
||||
_jumpDistanceGiraffe: 32
|
||||
_jumpHeightGiraffe: 8
|
||||
offset: {x: 0, y: 0, z: 0}
|
||||
_jumpDistanceStart: 6
|
||||
_jumpDistance: 4
|
||||
_jumpHeight: 4
|
||||
_jumpHeightInitial: 2
|
||||
_jumpDistanceGiraffe: 28
|
||||
_jumpHeightGiraffe: 7
|
||||
_jumpStartAngle: 120
|
||||
|
|
|
|||
|
|
@ -303,7 +303,7 @@ MonoBehaviour:
|
|||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_fullRotRange: 160
|
||||
_spawnOffset: 0.6
|
||||
_spawnOffset: -1
|
||||
_holdLength: 4
|
||||
_ease: 4
|
||||
_rotateRoot: {fileID: 4208995891253938729}
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ Transform:
|
|||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1326311291227833683}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: -1.78, z: 0}
|
||||
m_LocalPosition: {x: 0, y: -2.06, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
|
|
@ -162,7 +162,7 @@ MonoBehaviour:
|
|||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_fullRotRange: 160
|
||||
_spawnOffset: 5.204
|
||||
_spawnOffset: 0
|
||||
_holdLength: 1
|
||||
_ease: 4
|
||||
_rotateRoot: {fileID: 2068126119450832752}
|
||||
|
|
|
|||
|
|
@ -1933,7 +1933,7 @@ MonoBehaviour:
|
|||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_fullRotRange: 160
|
||||
_spawnOffset: 3.0813334
|
||||
_spawnOffset: 0
|
||||
_holdLength: 3
|
||||
_ease: 4
|
||||
_rotateRoot: {fileID: 3903953954711634507}
|
||||
|
|
@ -2160,7 +2160,7 @@ Transform:
|
|||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 9082431704919230402}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: -8.7300005, z: 0}
|
||||
m_LocalPosition: {x: 0, y: -8.85, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
|
|
|
|||
|
|
@ -164,6 +164,63 @@ AnimationClip:
|
|||
path: Arm
|
||||
classID: 1
|
||||
script: {fileID: 0}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_IsActive
|
||||
path: Hand
|
||||
classID: 1
|
||||
script: {fileID: 0}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_IsActive
|
||||
path: ArmBack
|
||||
classID: 1
|
||||
script: {fileID: 0}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_IsActive
|
||||
path: Cloud
|
||||
classID: 1
|
||||
script: {fileID: 0}
|
||||
m_PPtrCurves:
|
||||
- curve:
|
||||
- time: 0
|
||||
|
|
@ -256,6 +313,27 @@ AnimationClip:
|
|||
typeID: 1
|
||||
customType: 0
|
||||
isPPtrCurve: 0
|
||||
- serializedVersion: 2
|
||||
path: 2270227889
|
||||
attribute: 2086281974
|
||||
script: {fileID: 0}
|
||||
typeID: 1
|
||||
customType: 0
|
||||
isPPtrCurve: 0
|
||||
- serializedVersion: 2
|
||||
path: 3034582928
|
||||
attribute: 2086281974
|
||||
script: {fileID: 0}
|
||||
typeID: 1
|
||||
customType: 0
|
||||
isPPtrCurve: 0
|
||||
- serializedVersion: 2
|
||||
path: 4087167440
|
||||
attribute: 2086281974
|
||||
script: {fileID: 0}
|
||||
typeID: 1
|
||||
customType: 0
|
||||
isPPtrCurve: 0
|
||||
- serializedVersion: 2
|
||||
path: 130111906
|
||||
attribute: 0
|
||||
|
|
@ -777,6 +855,63 @@ AnimationClip:
|
|||
path: Tail
|
||||
classID: 4
|
||||
script: {fileID: 0}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_IsActive
|
||||
path: Hand
|
||||
classID: 1
|
||||
script: {fileID: 0}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_IsActive
|
||||
path: ArmBack
|
||||
classID: 1
|
||||
script: {fileID: 0}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_IsActive
|
||||
path: Cloud
|
||||
classID: 1
|
||||
script: {fileID: 0}
|
||||
m_EulerEditorCurves:
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
|
|
|
|||
|
|
@ -11,10 +11,13 @@ namespace HeavenStudio.Games.Scripts_AnimalAcrobat
|
|||
[SerializeField] private float _jumpDistanceStart = 6f;
|
||||
[SerializeField] private float _jumpDistance = 8f;
|
||||
[SerializeField] private float _jumpHeight = 4f;
|
||||
[SerializeField] private float _jumpHeightInitial = 2f;
|
||||
[SerializeField] private float _jumpDistanceGiraffe = 32f;
|
||||
[SerializeField] private float _jumpHeightGiraffe = 8f;
|
||||
[SerializeField] private float _jumpStartAngle = 120f;
|
||||
private Animator _anim;
|
||||
private Path _path;
|
||||
private float _restY;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
|
|
@ -23,6 +26,7 @@ namespace HeavenStudio.Games.Scripts_AnimalAcrobat
|
|||
{
|
||||
positions = new PathPos[2]
|
||||
};
|
||||
_restY = transform.localPosition.y;
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
|
|
@ -35,6 +39,20 @@ namespace HeavenStudio.Games.Scripts_AnimalAcrobat
|
|||
_anim.DoScaledAnimationAsync("PlayerBop", 0.5f);
|
||||
}
|
||||
|
||||
public void JumpBetweenAnimals(double beat, float startPoint)
|
||||
{
|
||||
_anim.Play("PlayerAir", 0, 0);
|
||||
Jump(beat, 2, startPoint, _jumpDistance, _jumpHeight, _restY);
|
||||
RotateJump(beat, 2);
|
||||
}
|
||||
|
||||
public void JumpBetweenGiraffe(double beat, float startPoint)
|
||||
{
|
||||
_anim.Play("PlayerAir", 0, 0);
|
||||
Jump(beat, 4, startPoint, _jumpDistanceGiraffe, _jumpHeightGiraffe, _restY);
|
||||
RotateJump(beat, 4);
|
||||
}
|
||||
|
||||
public void InitialJump(double beat)
|
||||
{
|
||||
StartCoroutine(InitialJumpCo(beat));
|
||||
|
|
@ -45,7 +63,7 @@ namespace HeavenStudio.Games.Scripts_AnimalAcrobat
|
|||
var cond = Conductor.instance;
|
||||
yield return new WaitUntil(() => cond.songPositionInBeatsAsDouble >= beat);
|
||||
_anim.DoScaledAnimationAsync("PlayerJump", 0.5f);
|
||||
Jump(beat, 1, transform.localPosition.x, _jumpDistanceStart, _jumpHeight, transform.localPosition.y);
|
||||
Jump(beat, 1, transform.localPosition.x, _jumpDistanceStart, _jumpHeightInitial, _restY);
|
||||
}
|
||||
|
||||
private void Jump(double beat, float length, float startPoint, float distance, float height, float restY)
|
||||
|
|
@ -72,6 +90,35 @@ namespace HeavenStudio.Games.Scripts_AnimalAcrobat
|
|||
yield return null;
|
||||
}
|
||||
}
|
||||
|
||||
private void RotateJump(double beat, double length)
|
||||
{
|
||||
StartCoroutine(RotateJumpCo(beat, length));
|
||||
}
|
||||
|
||||
private IEnumerator RotateJumpCo(double beat, double length)
|
||||
{
|
||||
var cond = Conductor.instance;
|
||||
float normalized = 0;
|
||||
while (normalized <= 1)
|
||||
{
|
||||
normalized = cond.GetPositionFromBeat(beat, length - 1);
|
||||
float newAngle = Mathf.Lerp(_jumpStartAngle, 360, normalized);
|
||||
|
||||
transform.localEulerAngles = new Vector3(0, 0, newAngle);
|
||||
yield return null;
|
||||
}
|
||||
|
||||
normalized = 0;
|
||||
while (normalized <= 1)
|
||||
{
|
||||
normalized = cond.GetPositionFromBeat(beat + length - 1, 0.5);
|
||||
float newAngle = Mathf.Lerp(0, 720, normalized);
|
||||
|
||||
transform.localEulerAngles = new Vector3(0, 0, newAngle);
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -133,6 +133,28 @@ namespace HeavenStudio.Games
|
|||
_playerMonkey.gameObject.SetActive(active);
|
||||
}
|
||||
|
||||
public void PlayerJump(double beat, bool giraffe)
|
||||
{
|
||||
float startPoint = GetDistanceAtBeat(beat) - (giraffe ? _jumpDistanceGiraffe : _jumpDistance);
|
||||
|
||||
PlayerSetActive(true);
|
||||
if (giraffe) _playerMonkey.JumpBetweenGiraffe(beat, startPoint);
|
||||
else _playerMonkey.JumpBetweenAnimals(beat, startPoint);
|
||||
}
|
||||
|
||||
private float GetDistanceAtBeat(double beat)
|
||||
{
|
||||
var animals = _queuedAnimals.FindAll(x => x.startBeat <= beat);
|
||||
|
||||
float result = (animals.Count == 0) ? 0 : _jumpStartCameraDistance;
|
||||
for (int i = 0; i < animals.Count; i++)
|
||||
{
|
||||
result += animals[i].rotationDistance;
|
||||
result += (animals[i].type == AnimalType.Giraffe) ? _jumpDistanceGiraffe : _jumpDistance;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public void Bop(double beat, float length)
|
||||
{
|
||||
List<BeatAction.Action> actions = new();
|
||||
|
|
@ -173,7 +195,7 @@ namespace HeavenStudio.Games
|
|||
{
|
||||
if (normalizedTravel < 0.5)
|
||||
{
|
||||
float normalizedOut = cond.GetPositionFromBeat(currentAnimal.startBeat - _cameraHoldTime, 0.5);
|
||||
float normalizedOut = cond.GetPositionFromBeat(currentAnimal.startBeat - _cameraHoldTime, 1);
|
||||
newZ = _funcEaseOut(0, _giraffeCameraZoom, Mathf.Clamp01(normalizedOut));
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ namespace HeavenStudio.Games.Scripts_AnimalAcrobat
|
|||
{
|
||||
SoundByte.PlayOneShotGame("animalAcrobat/giraffeJump");
|
||||
_monkey.gameObject.SetActive(false);
|
||||
_game.PlayerJump(caller.startBeat + caller.timer, true);
|
||||
|
||||
double beat = caller.startBeat + caller.timer;
|
||||
|
||||
|
|
|
|||
|
|
@ -73,6 +73,8 @@ namespace HeavenStudio.Games.Scripts_AnimalAcrobat
|
|||
SoundByte.PlayOneShotGame("animalAcrobat/turn", caller.startBeat + caller.timer + 1);
|
||||
|
||||
_monkey.gameObject.SetActive(false);
|
||||
|
||||
_game.PlayerJump(caller.startBeat + caller.timer, false);
|
||||
}
|
||||
|
||||
private void Empty(PlayerActionEvent caller) { }
|
||||
|
|
|
|||
Loading…
Reference in a new issue