The code (script) of such an animation cut scene (duration 4 seconds) -
private IEnumerator ExampleAnim()
{
TrackEntry teK;
TrackEntry teZ = zombieAnim.state.GetCurrent(0);
DOVirtual.Float(boneHandRightZ.Rotation, 20, 0.5f, (v) => angleRightHand = v);
HitHandRotateBack(teZ);
yield return new WaitForSeconds(0.05f);
zombie.DOMoveX(zombie.position.x + 5f, 0.65f);
cam.DOOrthoSize(12, 0.65f);
knight.DOMoveX(knight.position.x - 5f, 0.65f);
zombieAnim.state.SetAnimation(0, hitZ, false);
yield return new WaitForSeconds(0.1f);
knightAnim.state.SetAnimation(0, attackK, false);
knightAnim.timeScale = 1.4f;
yield return new WaitForSeconds(0.4f);
Transform flySword = Instantiate(objFlySword, new Vector2(-3.79f, -0.94f), Quaternion.identity, transform);
flySword.DOMoveX(4.09f, 0.45f);
slotSword.Attachment = null;
adrenalinSword.StopParticles();
yield return new WaitForSeconds(0.15f);
zombieAnim.UpdateLocal -= UpdateBonesRightHand;
cam.DOOrthoSize(5, 0.3f);
camTra.DOMoveX(4.36f, 0.3f);
Zombie.In.SetSortOrder(3);
zombieAnim.state.SetAnimation(0, attackZ, false);
teZ = zombieAnim.state.GetCurrent(0);
teZ.MixTime = 1;
teZ.TimeScale = 0.7f;
teZ.AnimationStart = 0.36f;
yield return new WaitForSeconds(0.1f);
particlesHitRed.Play();
yield return new WaitForSeconds(0.025f);
adrenalinSword.PlayFatalityParticles();
yield return new WaitForSeconds(0.025f);
knight.position = new Vector3(-0.7f, basePosKnight.y, 0);
knight.DOMoveX(2, 0.1f);
knightAnim.state.SetAnimation(0, runShiledK, false);
teK = knightAnim.state.GetCurrent(0);
teK.MixTime = 1;
teK.TimeScale = 1.2f;
Time.timeScale = 0.1f;
flySword.DORotate(Vector3.forward * -26.6f, 0.1f);
flySword.DOMoveY(-1.14f, 0.1f);
yield return new WaitForSeconds(0.075f);
particlesHitRed.Play();
particlesHitRed2.Play();
adrenalinSword.PlayParticles();
angleArm = 45.4f;
angleHandL = 15.8f;
angleSword = -92.6f;
angleLeftShilder = -177;
knightAnim.UpdateLocal += UpdateBonesLeftShilder;
DOVirtual.Float(angleLeftShilder, -94f, 0.025f, (v) => angleLeftShilder = v).SetEase(Ease.Linear);
DOVirtual.Float(boneBody2K.Rotation, 20, 0.025f, (v) => angleBody2 = v).SetEase(Ease.Linear);
yield return new WaitForSeconds(0.025f);
flySword.gameObject.SetActive(false);
Time.timeScale = 1f;
teZ.TimeScale = 1f;
slotSword.Attachment = saveSwordAttachment;
cam.DOOrthoSize(12, 0.8f);
slotShadow.Attachment = null;
knightAnim.state.SetAnimation(0, jumpK, false);
teK = knightAnim.state.GetCurrent(0);
teK.AnimationStart = 0.5f;
teK.MixTime = 1;
knightAnim.timeScale = 0f;
particlesHitRed.transform.localScale = Vector3.one * 4;
particlesHitRed.transform.position = new Vector2(5.29f, -0.64f);
angleLeftShilder = -120;
yield return new WaitForSeconds(0.025f);
DOVirtual.Float(angleLeftShilder, -80f, 0.025f, (v) => angleLeftShilder = v).SetEase(Ease.Linear);
Time.timeScale = 0.05f;
knight.DOJump(new Vector2(-1.73f, charactersBasicPosY), 9, 1, 1).SetEase(Ease.Linear);
knight.DORotate(new Vector3(0, 0, 60), 0.2f, DG.Tweening.RotateMode.FastBeyond360).SetEase(Ease.Linear);
StartCoroutine(Jump());
yield return new WaitForSeconds(0.025f);
knightAnim.UpdateLocal -= UpdateBonesLeftShilder;
Time.timeScale = 1f;
yield return new WaitForSeconds(0.1f);
knightAnim.timeScale = 0;
knight.DORotate(new Vector3(0, 0, 250), 0.35f, DG.Tweening.RotateMode.FastBeyond360).SetEase(Ease.Linear);
yield return new WaitForSeconds(0.35f);
knight.DORotate(new Vector3(0, 0, 360), 0.45f, DG.Tweening.RotateMode.FastBeyond360).SetEase(Ease.Linear);
boneSwordK.Rotation = 84.77f;
yield return new WaitForSeconds(0.15f);
knightAnim.timeScale = 0.8f;
yield return new WaitForSeconds(0.1f);
FastMode.In.Off();
yield return new WaitForSeconds(0.25f);
slotShadow.Attachment = saveShadowAttachment;
}
private IEnumerator Jump()
{
zombieAnim.state.SetAnimation(0, dieZ, false);
zombieAnim.timeScale = 2f;
zombie.DOJump(new Vector2(zombie.position.x + 2.5f, zombie.position.y + 0.52f), 5, 1, 0.5f);
zombie.DORotate(-Vector3.forward * 182, 0.3f, DG.Tweening.RotateMode.LocalAxisAdd);
yield return new WaitForSeconds(0.05f);
zombieAnim.timeScale = 1f;
}
private void UpdateBonesLeftShilder(ISkeletonAnimation animated)
{
boneBody2K.Rotation = angleBody2;
boneShilderLeftK.Rotation = angleLeftShilder;
boneArmLeftK.Rotation = angleArm;
boneHandLeftK.Rotation = angleHandL;
boneSwordK.Rotation = angleSword;
}
private void HitHandRotateBack(TrackEntry teZ)
{
angleRightHand = boneHandRightZ.Rotation;
zombieAnim.UpdateLocal += UpdateBonesRightHand;
}
private void UpdateBonesRightHand(ISkeletonAnimation animated)
{
boneHandRightZ.Rotation = angleRightHand;
}
The main problem is not the amount of code, the main problem is how I change many values in this script for the more correct animation I need for the cut scene.
To change the value and see how it will look, I do a lot of things -
1) I need to exit the unity play mode.
2) Change the value in the script.
3) Run play mode.
4) Set up the prototype of the game in the desired cut scene.
5) Wait until the cutscene reaches the desired second in which there is a defective visual animation.
In this video, you can move at any second of the cut scene and change the values!
But I don't understand how to do this with your spine+animation+bone rotation(overwrite) . I want to do all this in the timeline in the editor. Is it possible to do this?