diff --git a/Assets/Resources/Games/monkeyWatch.prefab b/Assets/Resources/Games/monkeyWatch.prefab index 805afb285..2f28092ec 100644 --- a/Assets/Resources/Games/monkeyWatch.prefab +++ b/Assets/Resources/Games/monkeyWatch.prefab @@ -17101,6 +17101,37 @@ SpriteRenderer: m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 0 +--- !u!1 &3882104420321969491 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4339140097867587715} + m_Layer: 0 + m_Name: Target + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4339140097867587715 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3882104420321969491} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 12.13, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 5973755251599500745} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &3887384218765440978 GameObject: m_ObjectHideFlags: 0 @@ -17609,6 +17640,56 @@ SpriteRenderer: m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 0 +--- !u!1 &4177405334696085735 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5973755251599500745} + - component: {fileID: 4712471487160862613} + m_Layer: 0 + m_Name: BalloonAnchor + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &5973755251599500745 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4177405334696085735} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 4339140097867587715} + m_Father: {fileID: 7676047881968251921} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &4712471487160862613 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4177405334696085735} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d4201255ef0e619469e1ef4af5aebcb8, type: 3} + m_Name: + m_EditorClassIdentifier: + anchor: {fileID: 5973755251599500745} + target: {fileID: 4339140097867587715} + balloonTrans: {fileID: 5836723102826521910} + xOffset: -2.962 + yOffset: -14.204 --- !u!1 &4183335457383268975 GameObject: m_ObjectHideFlags: 0 @@ -21570,6 +21651,7 @@ MonoBehaviour: monkeyClockArrow: {fileID: 8220690735241008560} monkeyHandler: {fileID: 8572779002997729184} backgroundHandler: {fileID: 2778587498033096836} + balloonHandler: {fileID: 4712471487160862613} middleMonkey: {fileID: 5520703815918216618} fullZoomOut: 80 --- !u!1 &6181011653585253546 @@ -29678,6 +29760,7 @@ Transform: - {fileID: 6857749598573628903} - {fileID: 3735448262030941676} - {fileID: 5836723102826521910} + - {fileID: 5973755251599500745} m_Father: {fileID: 1686621416582726728} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Scripts/Games/MonkeyWatch/BalloonHandler.cs b/Assets/Scripts/Games/MonkeyWatch/BalloonHandler.cs new file mode 100644 index 000000000..f22d9d224 --- /dev/null +++ b/Assets/Scripts/Games/MonkeyWatch/BalloonHandler.cs @@ -0,0 +1,31 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace HeavenStudio.Games.Scripts_MonkeyWatch +{ + public class BalloonHandler : MonoBehaviour + { + [Header("Components")] + [SerializeField] private Transform anchor; + [SerializeField] private Transform target; + [SerializeField] private Transform balloonTrans; + [Header("Properties")] + [SerializeField] private float xOffset; + [SerializeField] private float yOffset; + + private float additionalXOffset; + private float additionalYOffset; + + public void Init(double beat) + { + Update(); + } + + private void Update() + { + balloonTrans.position = new Vector3(target.position.x + xOffset + additionalXOffset, target.position.y + yOffset + additionalYOffset, target.position.z); + } + } +} + diff --git a/Assets/Scripts/Games/MonkeyWatch/BalloonHandler.cs.meta b/Assets/Scripts/Games/MonkeyWatch/BalloonHandler.cs.meta new file mode 100644 index 000000000..67329e3bd --- /dev/null +++ b/Assets/Scripts/Games/MonkeyWatch/BalloonHandler.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d4201255ef0e619469e1ef4af5aebcb8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/MonkeyWatch/MonkeyClockArrow.cs b/Assets/Scripts/Games/MonkeyWatch/MonkeyClockArrow.cs index affb013bb..7bf5b8b35 100644 --- a/Assets/Scripts/Games/MonkeyWatch/MonkeyClockArrow.cs +++ b/Assets/Scripts/Games/MonkeyWatch/MonkeyClockArrow.cs @@ -18,6 +18,7 @@ namespace HeavenStudio.Games.Scripts_MonkeyWatch [SerializeField] private Transform shadowTrans; [Header("Properties")] [SerializeField] private float shadowXRange = 2f; + [SerializeField] private float shadowYRange = 1f; private MonkeyWatch game; @@ -47,21 +48,21 @@ namespace HeavenStudio.Games.Scripts_MonkeyWatch realAngle *= -1; float x; + float y; if (realAngle <= 180) { float normalizedAngle = Mathp.Normalize(realAngle, 0, 180); - Debug.Log("normalizedAngle: " + normalizedAngle); x = Mathf.Lerp(0, shadowXRange, normalizedAngle); + y = Mathf.Lerp(0, shadowYRange, normalizedAngle); } else { float normalizedAngle = Mathp.Normalize(realAngle, 180, 360); - Debug.Log("normalizedAngle: " + normalizedAngle); x = Mathf.Lerp(shadowXRange, 0, normalizedAngle); + y = Mathf.Lerp(shadowYRange, 0, normalizedAngle); } - Debug.Log("X: " + x); - shadowTrans.localPosition = new Vector3(x, 0); + shadowTrans.localPosition = new Vector3(x, y); } public void MoveToAngle(float angle) diff --git a/Assets/Scripts/Games/MonkeyWatch/MonkeyWatch.cs b/Assets/Scripts/Games/MonkeyWatch/MonkeyWatch.cs index 62905e2bc..79ea4a6fb 100644 --- a/Assets/Scripts/Games/MonkeyWatch/MonkeyWatch.cs +++ b/Assets/Scripts/Games/MonkeyWatch/MonkeyWatch.cs @@ -103,6 +103,20 @@ namespace HeavenStudio.Games.Loaders new Param("hour", new EntityTypes.Integer(0, 12, 3), "Hour"), new Param("minute", new EntityTypes.Integer(0, 59, 0), "Minute") } + }, + new GameAction("balloon", "Balloon Movement") + { + resizable = true, + defaultLength = 4f, + parameters = new List() + { + new Param("angleStart", new EntityTypes.Float(0, 360, 0), "Start Angle"), + new Param("angleEnd", new EntityTypes.Float(0, 360, 0), "End Angle"), + new Param("yStart", new EntityTypes.Float(0, 200, 15), "Y Start"), + new Param("yEnd", new EntityTypes.Float(0, 200, 15), "Y End"), + new Param("xStart", new EntityTypes.Float(0, 200, 15), "X Start"), + new Param("xEnd", new EntityTypes.Float(0, 200, 15), "X End"), + } } }); } @@ -132,6 +146,7 @@ namespace HeavenStudio.Games public MonkeyClockArrow monkeyClockArrow; [SerializeField] private WatchMonkeyHandler monkeyHandler; [SerializeField] private WatchBackgroundHandler backgroundHandler; + [SerializeField] private BalloonHandler balloonHandler; public Animator middleMonkey; [Header("Properties")] @@ -149,7 +164,8 @@ namespace HeavenStudio.Games private void Awake() { instance = this; - funcInOut = Util.EasingFunction.GetEasingFunction(Util.EasingFunction.Ease.EaseOutQuad); + funcOut = Util.EasingFunction.GetEasingFunction(Util.EasingFunction.Ease.EaseOutQuad); + funcIn = Util.EasingFunction.GetEasingFunction(Util.EasingFunction.Ease.EaseOutQuart); pinkMonkeys = EventCaller.GetAllInGameManagerList("monkeyWatch", new string[] { "off", "offStretch" }); pinkMonkeysCustom = EventCaller.GetAllInGameManagerList("monkeyWatch", new string[] { "offInterval" }); CameraUpdate(); @@ -179,9 +195,9 @@ namespace HeavenStudio.Games backgroundHandler.SetFade(beat, 0.25f, true, (TimeMode)timeMode, hours, minutes); BeatAction.New(instance.gameObject, new List() { - new BeatAction.Action(beat + length - 0.5, delegate + new BeatAction.Action(beat + length - 2, delegate { - backgroundHandler.SetFade(beat + length - 0.5, 0.25f, false, (TimeMode)timeMode, hours, minutes); + backgroundHandler.SetFade(beat + length - 2, 0.25f, false, (TimeMode)timeMode, hours, minutes); }) }); CameraUpdate(); @@ -202,6 +218,7 @@ namespace HeavenStudio.Games public override void OnGameSwitch(double beat) { + balloonHandler.Init(beat); persistBeat = beat; GetCameraMovements(beat, false); monkeyClockArrow.MoveToAngle(lastAngle); @@ -221,6 +238,7 @@ namespace HeavenStudio.Games public override void OnPlay(double beat) { + balloonHandler.Init(beat); persistBeat = beat; GetCameraMovements(beat, true); monkeyClockArrow.MoveToAngle(lastAngle); @@ -564,7 +582,8 @@ namespace HeavenStudio.Games private double zoomOutStartBeat = double.MinValue; private float zoomOutLength = 4; - private Util.EasingFunction.Function funcInOut; + private Util.EasingFunction.Function funcOut; + private Util.EasingFunction.Function funcIn; private void CameraUpdate() { @@ -605,15 +624,15 @@ namespace HeavenStudio.Games if (normalizedZoomFirst > 1) { - newX = funcInOut(0, cameraTransform.position.x, Mathf.Clamp01(normalizedZoomLast)); - newY = funcInOut(0, cameraTransform.position.y, Mathf.Clamp01(normalizedZoomLast)); - newZ = funcInOut(fullZoomOut, 0, Mathf.Clamp01(normalizedZoomLast)); + newX = funcIn(0, cameraTransform.position.x, Mathf.Clamp01(normalizedZoomLast)); + newY = funcIn(0, cameraTransform.position.y, Mathf.Clamp01(normalizedZoomLast)); + newZ = funcIn(fullZoomOut, 0, Mathf.Clamp01(normalizedZoomLast)); } else { - newX = funcInOut(cameraTransform.position.x, 0, Mathf.Clamp01(normalizedZoomFirst)); - newY = funcInOut(cameraTransform.position.y, 0, Mathf.Clamp01(normalizedZoomFirst)); - newZ = funcInOut(0, fullZoomOut, Mathf.Clamp01(normalizedZoomFirst)); + newX = funcOut(cameraTransform.position.x, 0, Mathf.Clamp01(normalizedZoomFirst)); + newY = funcOut(cameraTransform.position.y, 0, Mathf.Clamp01(normalizedZoomFirst)); + newZ = funcOut(0, fullZoomOut, Mathf.Clamp01(normalizedZoomFirst)); } cameraMoveable.position = new Vector3(newX, -newY, newZ);