finally... proper swinging anim
This commit is contained in:
parent
9a15f03aa4
commit
11e41dc898
|
|
@ -1894,6 +1894,7 @@ GameObject:
|
||||||
- component: {fileID: 3439047595127619699}
|
- component: {fileID: 3439047595127619699}
|
||||||
- component: {fileID: -3114631264593203074}
|
- component: {fileID: -3114631264593203074}
|
||||||
- component: {fileID: 3068772248330600904}
|
- component: {fileID: 3068772248330600904}
|
||||||
|
- component: {fileID: 6573424568878642626}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: WhiteMonkeys
|
m_Name: WhiteMonkeys
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
|
|
@ -1932,7 +1933,7 @@ MonoBehaviour:
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
_fullRotRange: 160
|
_fullRotRange: 160
|
||||||
_spawnOffset: 9.244
|
_spawnOffset: 3.0813334
|
||||||
_holdLength: 3
|
_holdLength: 3
|
||||||
_ease: 4
|
_ease: 4
|
||||||
_rotateRoot: {fileID: 3903953954711634507}
|
_rotateRoot: {fileID: 3903953954711634507}
|
||||||
|
|
@ -1951,6 +1952,22 @@ MonoBehaviour:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
_monkey: {fileID: 7753963699734426661}
|
_monkey: {fileID: 7753963699734426661}
|
||||||
_holdLength: 3
|
_holdLength: 3
|
||||||
|
--- !u!114 &6573424568878642626
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7969179947406382610}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 9286671ea1a56f543bfc2114c45006fa, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
_anim: {fileID: 8483464683545527156}
|
||||||
|
_animLength: 0.6
|
||||||
|
_beatLength: 2.5
|
||||||
|
_ease: 4
|
||||||
--- !u!1 &8302616130811808557
|
--- !u!1 &8302616130811808557
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
|
||||||
|
|
@ -8716,7 +8716,7 @@ AnimationClip:
|
||||||
m_Level: 0
|
m_Level: 0
|
||||||
m_CycleOffset: 0
|
m_CycleOffset: 0
|
||||||
m_HasAdditiveReferencePose: 0
|
m_HasAdditiveReferencePose: 0
|
||||||
m_LoopTime: 1
|
m_LoopTime: 0
|
||||||
m_LoopBlend: 0
|
m_LoopBlend: 0
|
||||||
m_LoopBlendOrientation: 0
|
m_LoopBlendOrientation: 0
|
||||||
m_LoopBlendPositionY: 0
|
m_LoopBlendPositionY: 0
|
||||||
|
|
|
||||||
41
Assets/Scripts/Games/AnimalAcrobat/WhiteMonkeysSwing.cs
Normal file
41
Assets/Scripts/Games/AnimalAcrobat/WhiteMonkeysSwing.cs
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
using HeavenStudio.Util;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace HeavenStudio.Games.Scripts_AnimalAcrobat
|
||||||
|
{
|
||||||
|
public class WhiteMonkeysSwing : MonoBehaviour
|
||||||
|
{
|
||||||
|
[SerializeField] private Animator _anim;
|
||||||
|
[SerializeField] private float _animLength = 0.6f;
|
||||||
|
[SerializeField] private double _beatLength = 3;
|
||||||
|
[SerializeField] private EasingFunction.Ease _ease = EasingFunction.Ease.EaseInOutQuad;
|
||||||
|
private AcrobatObstacle _mainScript;
|
||||||
|
|
||||||
|
private double _startBeat;
|
||||||
|
private EasingFunction.Function _func;
|
||||||
|
|
||||||
|
private void Awake()
|
||||||
|
{
|
||||||
|
_mainScript = GetComponent<AcrobatObstacle>();
|
||||||
|
_mainScript.OnInit += Init;
|
||||||
|
_func = EasingFunction.GetEasingFunction(_ease);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Init(double beat, bool _beforeGiraffe)
|
||||||
|
{
|
||||||
|
_startBeat = beat;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Update()
|
||||||
|
{
|
||||||
|
var cond = Conductor.instance;
|
||||||
|
if (!cond.isPlaying) return;
|
||||||
|
|
||||||
|
float normalized = cond.GetPositionFromBeat(_startBeat, _beatLength);
|
||||||
|
_anim.DoNormalizedAnimation("WhiteMonkeysSwing", _func(0, _animLength, Mathf.Clamp01(normalized)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
11
Assets/Scripts/Games/AnimalAcrobat/WhiteMonkeysSwing.cs.meta
Normal file
11
Assets/Scripts/Games/AnimalAcrobat/WhiteMonkeysSwing.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9286671ea1a56f543bfc2114c45006fa
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Loading…
Reference in a new issue