diff --git a/Assets/Resources/Prefabs/Games/AnimalAcrobat/Elephant.prefab b/Assets/Resources/Prefabs/Games/AnimalAcrobat/Elephant.prefab index f530d050a..cadda108e 100644 --- a/Assets/Resources/Prefabs/Games/AnimalAcrobat/Elephant.prefab +++ b/Assets/Resources/Prefabs/Games/AnimalAcrobat/Elephant.prefab @@ -501,6 +501,7 @@ GameObject: - component: {fileID: 6198430257364661693} - component: {fileID: -5564384145903586768} - component: {fileID: -4645702950898394595} + - component: {fileID: 5550233630878919113} m_Layer: 0 m_Name: Elephant m_TagString: Untagged @@ -580,6 +581,21 @@ MonoBehaviour: m_EditorClassIdentifier: _monkey: {fileID: 4283362470282314707} _holdLength: 2 +--- !u!114 &5550233630878919113 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7540716611123628191} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e3924ec15f56dc74290292826f4e9649, type: 3} + m_Name: + m_EditorClassIdentifier: + _anim: {fileID: 6198430257364661693} + _animName: ElephantEar + _holdLength: 2 --- !u!1 &7805847212563886084 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Resources/Prefabs/Games/AnimalAcrobat/Giraffe.prefab b/Assets/Resources/Prefabs/Games/AnimalAcrobat/Giraffe.prefab index c892907e2..3a3634d54 100644 --- a/Assets/Resources/Prefabs/Games/AnimalAcrobat/Giraffe.prefab +++ b/Assets/Resources/Prefabs/Games/AnimalAcrobat/Giraffe.prefab @@ -264,6 +264,7 @@ GameObject: - component: {fileID: 1701002327333926128} - component: {fileID: 5248028064811562821} - component: {fileID: 3253363150451868373} + - component: {fileID: 5165305002464474939} m_Layer: 0 m_Name: Giraffe m_TagString: Untagged @@ -320,6 +321,21 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: _monkey: {fileID: 7559970804447045551} +--- !u!114 &5165305002464474939 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2939598505969617365} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e3924ec15f56dc74290292826f4e9649, type: 3} + m_Name: + m_EditorClassIdentifier: + _anim: {fileID: 7772794942310833959} + _animName: GiraffeEar + _holdLength: 4 --- !u!1 &3911272779464478738 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Games/AnimalAcrobat/EarFlap.cs b/Assets/Scripts/Games/AnimalAcrobat/EarFlap.cs new file mode 100644 index 000000000..e110d3204 --- /dev/null +++ b/Assets/Scripts/Games/AnimalAcrobat/EarFlap.cs @@ -0,0 +1,37 @@ +using HeavenStudio.Util; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace HeavenStudio.Games.Scripts_AnimalAcrobat +{ + public class EarFlap : MonoBehaviour + { + [SerializeField] private Animator _anim; + [SerializeField] private string _animName; + [SerializeField] private double _holdLength; + private AcrobatObstacle _mainScript; + + private void Awake() + { + _mainScript = GetComponent(); + _mainScript.OnInit += Init; + } + + private void Init(double beat, bool unused) + { + BeatAction.New(this, new() + { + new(beat + _holdLength - 2, delegate + { + _anim.DoScaledAnimationAsync(_animName, 0.5f); + }), + new(beat + _holdLength - 1, delegate + { + _anim.DoScaledAnimationAsync(_animName, 0.5f); + }) + }); + } + } +} + diff --git a/Assets/Scripts/Games/AnimalAcrobat/EarFlap.cs.meta b/Assets/Scripts/Games/AnimalAcrobat/EarFlap.cs.meta new file mode 100644 index 000000000..b3c46a6f5 --- /dev/null +++ b/Assets/Scripts/Games/AnimalAcrobat/EarFlap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e3924ec15f56dc74290292826f4e9649 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: