new rotation
This commit is contained in:
parent
aa5484f440
commit
ea304d51c7
|
|
@ -10,6 +10,7 @@ GameObject:
|
|||
m_Component:
|
||||
- component: {fileID: 6707971432346881136}
|
||||
- component: {fileID: 3578111811869010179}
|
||||
- component: {fileID: -6887511602651794248}
|
||||
m_Layer: 0
|
||||
m_Name: BigObject
|
||||
m_TagString: Untagged
|
||||
|
|
@ -30,6 +31,8 @@ Transform:
|
|||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 7773712820662594969}
|
||||
- {fileID: 752161195283805122}
|
||||
- {fileID: 8326417408316877396}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
|
|
@ -45,11 +48,27 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 2402aaa1d4e67df479cc626100110795, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_rotationStart: -22
|
||||
_rotationEnd: 22
|
||||
_ease: 4
|
||||
_logSR: {fileID: 8098522755323641548}
|
||||
_logCutSprite: {fileID: 192267312, guid: 8e17e4341f5f44e44b892a9c0cacc5ba, type: 3}
|
||||
--- !u!114 &-6887511602651794248
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2626744427758038457}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 7e7d1e893c935d84b9b2f07e9cd6abfb, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_rotationLeft: 22
|
||||
_rotationRight: -22
|
||||
_ease: 4
|
||||
_pivotLeft: {fileID: 752161195283805122}
|
||||
_pivotRight: {fileID: 8326417408316877396}
|
||||
_objectsToMove:
|
||||
- {fileID: 7773712820662594969}
|
||||
--- !u!1 &3051440580972758910
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -134,3 +153,65 @@ SpriteRenderer:
|
|||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!1 &4704686587982800349
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 8326417408316877396}
|
||||
m_Layer: 0
|
||||
m_Name: RightPivot
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &8326417408316877396
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4704686587982800349}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0.6832434, y: -0.16833535, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 6707971432346881136}
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &6725241522388431689
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 752161195283805122}
|
||||
m_Layer: 0
|
||||
m_Name: LeftPivot
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &752161195283805122
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6725241522388431689}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: -0.97040373, y: 0.31686652, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 6707971432346881136}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
|
|
|
|||
|
|
@ -84,6 +84,37 @@ SpriteRenderer:
|
|||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!1 &1568131847105573085
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 3806889583028043832}
|
||||
m_Layer: 0
|
||||
m_Name: LeftPivot
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &3806889583028043832
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1568131847105573085}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: -0.8754555, y: 0.04249759, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1592825473973314041}
|
||||
m_RootOrder: 3
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &2882691843822496395
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -178,6 +209,7 @@ GameObject:
|
|||
m_Component:
|
||||
- component: {fileID: 1592825473973314041}
|
||||
- component: {fileID: -3577666667379746924}
|
||||
- component: {fileID: 5105326711578084775}
|
||||
m_Layer: 0
|
||||
m_Name: HugeObject
|
||||
m_TagString: Untagged
|
||||
|
|
@ -200,6 +232,8 @@ Transform:
|
|||
- {fileID: 6021178669303329105}
|
||||
- {fileID: 4937915693495104335}
|
||||
- {fileID: 6881175763873126838}
|
||||
- {fileID: 3806889583028043832}
|
||||
- {fileID: 1793761810317541304}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
|
|
@ -215,9 +249,6 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: c24e5872094ce204ababcbfdc6db7b9d, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_rotationStart: -22
|
||||
_rotationEnd: 22
|
||||
_ease: 4
|
||||
_logSR: {fileID: 4676914009505337857}
|
||||
_logCutSprites:
|
||||
- {fileID: -2116300429, guid: 8e17e4341f5f44e44b892a9c0cacc5ba, type: 3}
|
||||
|
|
@ -233,6 +264,58 @@ MonoBehaviour:
|
|||
- {fileID: -541436295, guid: 8e17e4341f5f44e44b892a9c0cacc5ba, type: 3}
|
||||
- {fileID: 1835824123, guid: 8e17e4341f5f44e44b892a9c0cacc5ba, type: 3}
|
||||
- {fileID: 1740038524, guid: 8e17e4341f5f44e44b892a9c0cacc5ba, type: 3}
|
||||
--- !u!114 &5105326711578084775
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7090769993121559202}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 7e7d1e893c935d84b9b2f07e9cd6abfb, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_rotationLeft: 22
|
||||
_rotationRight: -22
|
||||
_ease: 4
|
||||
_pivotLeft: {fileID: 3806889583028043832}
|
||||
_pivotRight: {fileID: 1793761810317541304}
|
||||
_objectsToMove:
|
||||
- {fileID: 6021178669303329105}
|
||||
- {fileID: 4937915693495104335}
|
||||
- {fileID: 6881175763873126838}
|
||||
--- !u!1 &7113265822959522695
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1793761810317541304}
|
||||
m_Layer: 0
|
||||
m_Name: RightPivot
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1793761810317541304
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7113265822959522695}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0.6174075, y: -0.3955281, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1592825473973314041}
|
||||
m_RootOrder: 4
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &9210976111911403815
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
|||
|
|
@ -168,6 +168,37 @@ SpriteRenderer:
|
|||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!1 &2033430125026598246
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 3145076079615732040}
|
||||
m_Layer: 0
|
||||
m_Name: LeftPivot
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &3145076079615732040
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2033430125026598246}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: -0.98, y: 0.32, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 7609283403775189878}
|
||||
m_RootOrder: 4
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &5920352441626343011
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -262,6 +293,7 @@ GameObject:
|
|||
m_Component:
|
||||
- component: {fileID: 7609283403775189878}
|
||||
- component: {fileID: -5173722026323445984}
|
||||
- component: {fileID: -490977370071357320}
|
||||
m_Layer: 0
|
||||
m_Name: SmallObject
|
||||
m_TagString: Untagged
|
||||
|
|
@ -285,6 +317,8 @@ Transform:
|
|||
- {fileID: 2854676978937244060}
|
||||
- {fileID: 2941363410568922942}
|
||||
- {fileID: 4398076241187744673}
|
||||
- {fileID: 3145076079615732040}
|
||||
- {fileID: 5921619119855021811}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
|
|
@ -300,13 +334,32 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: a375355ce9643dd40a371b496e3fc9ee, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_rotationStart: -22
|
||||
_rotationEnd: 22
|
||||
_ease: 4
|
||||
_log: {fileID: 7082049777098498031}
|
||||
_can: {fileID: 719662512238027404}
|
||||
_bat: {fileID: 954934415611220420}
|
||||
_broom: {fileID: 5920352441626343011}
|
||||
--- !u!114 &-490977370071357320
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6310831636379568479}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 7e7d1e893c935d84b9b2f07e9cd6abfb, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_rotationLeft: 22
|
||||
_rotationRight: -22
|
||||
_ease: 4
|
||||
_pivotLeft: {fileID: 3145076079615732040}
|
||||
_pivotRight: {fileID: 5921619119855021811}
|
||||
_objectsToMove:
|
||||
- {fileID: 1948694922747606563}
|
||||
- {fileID: 2854676978937244060}
|
||||
- {fileID: 2941363410568922942}
|
||||
- {fileID: 4398076241187744673}
|
||||
--- !u!1 &7082049777098498031
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -391,3 +444,34 @@ SpriteRenderer:
|
|||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!1 &7705970468933103949
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5921619119855021811}
|
||||
m_Layer: 0
|
||||
m_Name: RightPivot
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &5921619119855021811
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7705970468933103949}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0.69, y: -0.17, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 7609283403775189878}
|
||||
m_RootOrder: 5
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
|
|
|
|||
|
|
@ -7,16 +7,12 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack
|
|||
{
|
||||
public class LBJBigObject : MonoBehaviour
|
||||
{
|
||||
[Header("Parameters")]
|
||||
[SerializeField] private float _rotationStart = -22f;
|
||||
[SerializeField] private float _rotationEnd = 22f;
|
||||
[SerializeField] private EasingFunction.Ease _ease = EasingFunction.Ease.EaseInOutQuad;
|
||||
|
||||
[Header("Components")]
|
||||
[SerializeField] private SpriteRenderer _logSR;
|
||||
[SerializeField] private Sprite _logCutSprite;
|
||||
|
||||
private LBJBear _bear;
|
||||
private LBJObjectRotate _rotateObject;
|
||||
private LumBEARjack.BigType _type;
|
||||
private bool _right = true;
|
||||
|
||||
|
|
@ -25,6 +21,11 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack
|
|||
private double _rotationBeat;
|
||||
private double _rotationLength;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_rotateObject = GetComponent<LBJObjectRotate>();
|
||||
}
|
||||
|
||||
public void Init(LBJBear bear, double beat, double length, LumBEARjack.BigType type, bool right, double startUpBeat = -1)
|
||||
{
|
||||
_bear = bear;
|
||||
|
|
@ -45,12 +46,7 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack
|
|||
|
||||
private void Update()
|
||||
{
|
||||
float normalized = Conductor.instance.GetPositionFromBeat(_rotationBeat - _rotationLength, _rotationLength * 2);
|
||||
|
||||
var func = EasingFunction.GetEasingFunction(_ease);
|
||||
|
||||
float newRotation = func(_rotationStart, _rotationEnd, normalized);
|
||||
transform.localEulerAngles = new Vector3(0, 0, newRotation * (_right ? 1 : -1));
|
||||
_rotateObject.Move(_rotationBeat, _rotationLength, _right);
|
||||
}
|
||||
|
||||
private void JustHit(PlayerActionEvent caller, float state)
|
||||
|
|
|
|||
|
|
@ -8,11 +8,6 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack
|
|||
{
|
||||
public class LBJHugeObject : MonoBehaviour
|
||||
{
|
||||
[Header("Parameters")]
|
||||
[SerializeField] private float _rotationStart = -22f;
|
||||
[SerializeField] private float _rotationEnd = 22f;
|
||||
[SerializeField] private EasingFunction.Ease _ease = EasingFunction.Ease.EaseInOutQuad;
|
||||
|
||||
[Header("Components")]
|
||||
[SerializeField] private SpriteRenderer _logSR;
|
||||
[SerializeField] private Sprite[] _logCutSprites = new Sprite[3];
|
||||
|
|
@ -22,6 +17,7 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack
|
|||
[SerializeField] private Sprite[] _peachCutSprites = new Sprite[3];
|
||||
|
||||
private LBJBear _bear;
|
||||
private LBJObjectRotate _rotateObject;
|
||||
private LumBEARjack.HugeType _type;
|
||||
private bool _right = true;
|
||||
private bool _zoom = true;
|
||||
|
|
@ -37,6 +33,8 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack
|
|||
_logSR.gameObject.SetActive(false);
|
||||
_freezerSR.gameObject.SetActive(false);
|
||||
_peachSR.gameObject.SetActive(false);
|
||||
|
||||
_rotateObject = GetComponent<LBJObjectRotate>();
|
||||
}
|
||||
|
||||
public void Init(LBJBear bear, double beat, double length, LumBEARjack.HugeType type, bool right, bool zoom, bool baby, double startUpBeat = -1)
|
||||
|
|
@ -92,12 +90,7 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack
|
|||
|
||||
private void Update()
|
||||
{
|
||||
float normalized = Conductor.instance.GetPositionFromBeat(_rotationBeat - _rotationLength, _rotationLength * 2);
|
||||
|
||||
var func = EasingFunction.GetEasingFunction(_ease);
|
||||
|
||||
float newRotation = func(_rotationStart, _rotationEnd, normalized);
|
||||
transform.localEulerAngles = new Vector3(0, 0, newRotation * (_right ? 1 : -1));
|
||||
_rotateObject.Move(_rotationBeat, _rotationLength, _right);
|
||||
}
|
||||
|
||||
private void SetObjectCutSprite(int step)
|
||||
|
|
|
|||
48
Assets/Scripts/Games/LumBEARjack/LBJObjectRotate.cs
Normal file
48
Assets/Scripts/Games/LumBEARjack/LBJObjectRotate.cs
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using HeavenStudio.Util;
|
||||
|
||||
namespace HeavenStudio.Games.Scripts_LumBEARjack
|
||||
{
|
||||
public class LBJObjectRotate : MonoBehaviour
|
||||
{
|
||||
[Header("Parameters")]
|
||||
[SerializeField] private float _rotationLeft = 22f;
|
||||
[SerializeField] private float _rotationRight = -22f;
|
||||
[SerializeField] private EasingFunction.Ease _ease = EasingFunction.Ease.EaseInOutQuad;
|
||||
|
||||
[Header("References")]
|
||||
[SerializeField] private Transform _pivotLeft;
|
||||
[SerializeField] private Transform _pivotRight;
|
||||
[SerializeField] private Transform[] _objectsToMove;
|
||||
|
||||
|
||||
public void Move(double beat, double length, bool right)
|
||||
{
|
||||
float normalized = Conductor.instance.GetPositionFromBeat(beat - length, length * 2, false);
|
||||
if (!right) normalized = 1 - normalized;
|
||||
var func = EasingFunction.GetEasingFunction(_ease);
|
||||
|
||||
if (normalized <= 0.5f)
|
||||
{
|
||||
foreach (var o in _objectsToMove)
|
||||
{
|
||||
if (o.parent != _pivotRight) o.SetParent(_pivotRight, true);
|
||||
}
|
||||
float newRotation = Mathf.Min(func(_rotationRight, -_rotationRight, normalized), 0);
|
||||
_pivotRight.localEulerAngles = new Vector3(0, 0, newRotation);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var o in _objectsToMove)
|
||||
{
|
||||
if (o.parent != _pivotLeft) o.SetParent(_pivotLeft, true);
|
||||
}
|
||||
float newRotation = Mathf.Max(func(-_rotationLeft, _rotationLeft, normalized), 0);
|
||||
_pivotLeft.localEulerAngles = new Vector3(0, 0, newRotation);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
11
Assets/Scripts/Games/LumBEARjack/LBJObjectRotate.cs.meta
Normal file
11
Assets/Scripts/Games/LumBEARjack/LBJObjectRotate.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 7e7d1e893c935d84b9b2f07e9cd6abfb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -8,11 +8,6 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack
|
|||
{
|
||||
public class LBJSmallObject : MonoBehaviour
|
||||
{
|
||||
[Header("Parameters")]
|
||||
[SerializeField] private float _rotationStart = -22f;
|
||||
[SerializeField] private float _rotationEnd = 22f;
|
||||
[SerializeField] private EasingFunction.Ease _ease = EasingFunction.Ease.EaseInOutQuad;
|
||||
|
||||
[Header("Components")]
|
||||
[SerializeField] private GameObject _log;
|
||||
[SerializeField] private GameObject _can;
|
||||
|
|
@ -20,6 +15,7 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack
|
|||
[SerializeField] private GameObject _broom;
|
||||
|
||||
private LBJBear _bear;
|
||||
private LBJObjectRotate _rotateObject;
|
||||
private LumBEARjack.SmallType _type;
|
||||
private LumBEARjack.HuhChoice _huh;
|
||||
private bool _right = true;
|
||||
|
|
@ -33,6 +29,7 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack
|
|||
_can.SetActive(false);
|
||||
_bat.SetActive(false);
|
||||
_broom.SetActive(false);
|
||||
_rotateObject = GetComponent<LBJObjectRotate>();
|
||||
}
|
||||
|
||||
public void Init(LBJBear bear, double beat, double length, LumBEARjack.SmallType type, LumBEARjack.HuhChoice huh, bool right, double startUpBeat = -1)
|
||||
|
|
@ -68,12 +65,7 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack
|
|||
|
||||
private void Update()
|
||||
{
|
||||
float normalized = Conductor.instance.GetPositionFromBeat(_rotationBeat - _rotationLength, _rotationLength * 2);
|
||||
|
||||
var func = EasingFunction.GetEasingFunction(_ease);
|
||||
|
||||
float newRotation = func(_rotationStart, _rotationEnd, normalized);
|
||||
transform.localEulerAngles = new Vector3(0, 0, newRotation * (_right ? 1 : -1));
|
||||
_rotateObject.Move(_rotationBeat, _rotationLength, _right);
|
||||
}
|
||||
|
||||
private void Just(PlayerActionEvent caller, float state)
|
||||
|
|
|
|||
|
|
@ -296,5 +296,6 @@ MonoBehaviour:
|
|||
- Assets/Scripts/Util/ParticleSystemHelpers.cs
|
||||
- Assets/Scripts/Games/LumBEARjack/LBJBGCat.cs
|
||||
- Assets/Scripts/Games/LumBEARjack/LBJBaby.cs
|
||||
- Assets/Scripts/Games/LumBEARjack/LBJObjectRotate.cs
|
||||
PathsToSkipImportEvent: []
|
||||
PathsToIgnoreOverwriteSettingOnAttribute: []
|
||||
|
|
|
|||
Loading…
Reference in a new issue