From 1ba9a3c1dce578ac6db7ad88f6c1a7ddb0fdc17e Mon Sep 17 00:00:00 2001 From: Carson Kompon Date: Mon, 28 Feb 2022 14:31:28 -0500 Subject: [PATCH] Rhythm Rally Camera Event Rotate the camera with different easing functions and the option to add/remove from current rotation. --- Assets/Resources/Games/rhythmRally.prefab | 58 ++++++++++++++----- .../Scripts/Games/RhythmRally/RhythmRally.cs | 7 ++- Assets/Scripts/Minigames.cs | 10 ++++ 3 files changed, 61 insertions(+), 14 deletions(-) diff --git a/Assets/Resources/Games/rhythmRally.prefab b/Assets/Resources/Games/rhythmRally.prefab index 9ebe45796..0b4d2f144 100644 --- a/Assets/Resources/Games/rhythmRally.prefab +++ b/Assets/Resources/Games/rhythmRally.prefab @@ -27,7 +27,7 @@ Transform: m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - - {fileID: 6509993024069972873} + - {fileID: 5472155158897914726} - {fileID: 3078425781313688086} - {fileID: 4228713593463920381} - {fileID: 4959957736091286558} @@ -231,6 +231,37 @@ TrailRenderer: m_MinVertexDistance: 0 m_Autodestruct: 0 m_Emitting: 1 +--- !u!1 &1501271021389222783 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5472155158897914726} + m_Layer: 10 + m_Name: CameraPivot + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &5472155158897914726 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1501271021389222783} + 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_Children: + - {fileID: 6509993024069972873} + m_Father: {fileID: 4631944531018638297} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1668061868608559892 GameObject: m_ObjectHideFlags: 0 @@ -831,9 +862,9 @@ MonoBehaviour: perfect: 0 late: 0 createBeat: 0 - isEligible: 0 eligibleHitsList: [] aceTimes: 0 + isEligible: 0 --- !u!1 &3340141389927785323 GameObject: m_ObjectHideFlags: 0 @@ -1008,7 +1039,7 @@ Transform: m_LocalPosition: {x: -1.86, y: 2.2, z: -3.9} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] - m_Father: {fileID: 4631944531018638297} + m_Father: {fileID: 5472155158897914726} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 20.97, y: 27.3, z: 0} --- !u!20 &6268063764140376526 @@ -1709,6 +1740,7 @@ MonoBehaviour: firstEnable: 0 renderQuadTrans: {fileID: 743597382397742394} cameraPos: {fileID: 6509993024069972873} + cameraPivot: {fileID: 5472155158897914726} ball: {fileID: 1668061868608559892} ballShadow: {fileID: 7207398029238753263} ballTrail: {fileID: 4238313091838702597} @@ -2048,16 +2080,16 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: cebeb8610d89fb34688750080a285ddb, type: 3} ---- !u!4 &397144130134918796 stripped -Transform: - m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: cebeb8610d89fb34688750080a285ddb, type: 3} - m_PrefabInstance: {fileID: 146447278275535207} - m_PrefabAsset: {fileID: 0} --- !u!1 &1065418898597387318 stripped GameObject: m_CorrespondingSourceObject: {fileID: 919132149155446097, guid: cebeb8610d89fb34688750080a285ddb, type: 3} m_PrefabInstance: {fileID: 146447278275535207} m_PrefabAsset: {fileID: 0} +--- !u!4 &397144130134918796 stripped +Transform: + m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: cebeb8610d89fb34688750080a285ddb, type: 3} + m_PrefabInstance: {fileID: 146447278275535207} + m_PrefabAsset: {fileID: 0} --- !u!95 &4559734961269837672 Animator: serializedVersion: 3 @@ -2702,16 +2734,16 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: cebeb8610d89fb34688750080a285ddb, type: 3} ---- !u!4 &7291063904195614871 stripped -Transform: - m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: cebeb8610d89fb34688750080a285ddb, type: 3} - m_PrefabInstance: {fileID: 7108288251017691004} - m_PrefabAsset: {fileID: 0} --- !u!4 &2075964892847120759 stripped Transform: m_CorrespondingSourceObject: {fileID: 9109367605909020171, guid: cebeb8610d89fb34688750080a285ddb, type: 3} m_PrefabInstance: {fileID: 7108288251017691004} m_PrefabAsset: {fileID: 0} +--- !u!4 &7291063904195614871 stripped +Transform: + m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: cebeb8610d89fb34688750080a285ddb, type: 3} + m_PrefabInstance: {fileID: 7108288251017691004} + m_PrefabAsset: {fileID: 0} --- !u!1 &7954728381481796141 stripped GameObject: m_CorrespondingSourceObject: {fileID: 919132149155446097, guid: cebeb8610d89fb34688750080a285ddb, type: 3} diff --git a/Assets/Scripts/Games/RhythmRally/RhythmRally.cs b/Assets/Scripts/Games/RhythmRally/RhythmRally.cs index 4fc3b3986..ad0a0fc5d 100644 --- a/Assets/Scripts/Games/RhythmRally/RhythmRally.cs +++ b/Assets/Scripts/Games/RhythmRally/RhythmRally.cs @@ -13,7 +13,7 @@ namespace RhythmHeavenMania.Games.RhythmRally [Header("Camera")] public Transform renderQuadTrans; - public Transform cameraPos; + public Transform cameraPivot; [Header("Ball and curve info")] @@ -341,6 +341,11 @@ namespace RhythmHeavenMania.Games.RhythmRally inPose = true; } + public void ChangeCameraAngle(Vector3 rotation, float length, Ease ease, RotateMode rotateMode) + { + cameraPivot.DORotate(rotation, length * Conductor.instance.secPerBeat, rotateMode).SetEase(ease); + } + public void PrepareFastRally(float beat, RallySpeed speedChange) { if (speedChange == RallySpeed.Fast) diff --git a/Assets/Scripts/Minigames.cs b/Assets/Scripts/Minigames.cs index b4ee2d617..d4eb53d76 100644 --- a/Assets/Scripts/Minigames.cs +++ b/Assets/Scripts/Minigames.cs @@ -1,6 +1,7 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; +using DG.Tweening; using RhythmHeavenMania.Util; @@ -326,6 +327,15 @@ namespace RhythmHeavenMania new GameAction("fast rally", delegate { RhythmRally.instance.PrepareFastRally(eventCaller.currentEntity.beat, RhythmRally.RallySpeed.Fast); }, 6f), new GameAction("superfast rally", delegate { RhythmRally.instance.PrepareFastRally(eventCaller.currentEntity.beat, RhythmRally.RallySpeed.SuperFast); }, 12f), new GameAction("pose", delegate { RhythmRally.instance.Pose(); }, 0.5f), + new GameAction("camera", delegate { + var e = eventCaller.currentEntity; + var rotation = new Vector3(0, e.valA, 0); + RhythmRally.instance.ChangeCameraAngle(rotation, e.length, (Ease)e.type, (RotateMode)e.type2); + }, 4, true, new List() { + new Param("valA", new EntityTypes.Integer(-360, 360, 0), "Angle"), + new Param("type", Ease.Linear, "Ease"), + new Param("type2", RotateMode.Fast, "Rotation Mode") + } ), }), new Minigame("builtToScaleDS", "Built To Scale (DS) \n[WIP don't use]", "00BB00", true, false, new List() {