From 417986c08ce39902f917e4c1dc504c5704beea12 Mon Sep 17 00:00:00 2001 From: Starpelly Date: Sat, 25 Dec 2021 20:04:23 -0500 Subject: [PATCH] Stars background + Camera zooming *UNFINISHED* --- .../Fork Lifter/Animations/Hand.controller | 2 +- .../Fork Lifter/Animations/Hand_Idle.anim | 68 +- .../Sprites/Games/Spaceball/star.mat | 105 + .../Sprites/Games/Spaceball/star.mat.meta | 8 + .../Sprites/Games/Spaceball/star.png | Bin 0 -> 333 bytes .../Sprites/Games/Spaceball/star.png.meta | 96 + Assets/Scenes/Game.unity | 4815 ++++++++++++++++- Assets/Scripts/Beatmap.cs | 1 + Assets/Scripts/CircleCursor.cs | 2 +- Assets/Scripts/EventCaller.cs | 18 +- Assets/Scripts/GameManager.cs | 35 +- Assets/Scripts/Games/ForkLifter/ForkLifter.cs | 1 + .../Games/ForkLifter/ForkLifterHand.cs | 2 +- Assets/Scripts/Games/Spaceball/Spaceball.cs | 43 +- .../Scripts/Games/Spaceball/SpaceballBall.cs | 7 +- Assets/Scripts/Util/Jukebox.cs | 3 +- Assets/spaceball.json | 64 +- 17 files changed, 5239 insertions(+), 31 deletions(-) create mode 100644 Assets/Resources/Sprites/Games/Spaceball/star.mat create mode 100644 Assets/Resources/Sprites/Games/Spaceball/star.mat.meta create mode 100644 Assets/Resources/Sprites/Games/Spaceball/star.png create mode 100644 Assets/Resources/Sprites/Games/Spaceball/star.png.meta diff --git a/Assets/Resources/Sprites/Games/Fork Lifter/Animations/Hand.controller b/Assets/Resources/Sprites/Games/Fork Lifter/Animations/Hand.controller index 1406c3e5..c26534bf 100644 --- a/Assets/Resources/Sprites/Games/Fork Lifter/Animations/Hand.controller +++ b/Assets/Resources/Sprites/Games/Fork Lifter/Animations/Hand.controller @@ -165,7 +165,7 @@ AnimatorStateMachine: m_Position: {x: 360, y: 120, z: 0} - serializedVersion: 1 m_State: {fileID: 4663746626472684145} - m_Position: {x: 470, y: 230, z: 0} + m_Position: {x: 440, y: -70, z: 0} m_ChildStateMachines: [] m_AnyStateTransitions: [] m_EntryTransitions: [] diff --git a/Assets/Resources/Sprites/Games/Fork Lifter/Animations/Hand_Idle.anim b/Assets/Resources/Sprites/Games/Fork Lifter/Animations/Hand_Idle.anim index 1252d4ac..1e4d149a 100644 --- a/Assets/Resources/Sprites/Games/Fork Lifter/Animations/Hand_Idle.anim +++ b/Assets/Resources/Sprites/Games/Fork Lifter/Animations/Hand_Idle.anim @@ -48,8 +48,34 @@ AnimationClip: m_RotationOrder: 4 path: HandVisual/hand_shadow1 m_ScaleCurves: [] - m_FloatCurves: [] - m_PPtrCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_IsActive + path: fast_1 + classID: 1 + script: {fileID: 0} + m_PPtrCurves: + - curve: + - time: 0 + value: {fileID: -3456084564025576355, guid: 52117e1d5cd298c42adfea952676c7d6, type: 3} + attribute: m_Sprite + path: HandVisual + classID: 212 + script: {fileID: 0} m_SampleRate: 60 m_WrapMode: 0 m_Bounds: @@ -57,6 +83,20 @@ AnimationClip: m_Extent: {x: 0, y: 0, z: 0} m_ClipBindingConstant: genericBindings: + - serializedVersion: 2 + path: 2377293126 + attribute: 2086281974 + script: {fileID: 0} + typeID: 1 + customType: 0 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 3267382320 + attribute: 0 + script: {fileID: 0} + typeID: 212 + customType: 23 + isPPtrCurve: 1 - serializedVersion: 2 path: 3267382320 attribute: 1 @@ -71,13 +111,14 @@ AnimationClip: typeID: 4 customType: 0 isPPtrCurve: 0 - pptrCurveMapping: [] + pptrCurveMapping: + - {fileID: -3456084564025576355, guid: 52117e1d5cd298c42adfea952676c7d6, type: 3} m_AnimationClipSettings: serializedVersion: 2 m_AdditiveReferencePoseClip: {fileID: 0} m_AdditiveReferencePoseTime: 0 m_StartTime: 0 - m_StopTime: 0 + m_StopTime: 0.016666668 m_OrientationOffsetY: 0 m_Level: 0 m_CycleOffset: 0 @@ -207,6 +248,25 @@ AnimationClip: path: HandVisual/hand_shadow1 classID: 4 script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_IsActive + path: fast_1 + classID: 1 + script: {fileID: 0} m_EulerEditorCurves: [] m_HasGenericRootTransform: 0 m_HasMotionFloatCurves: 0 diff --git a/Assets/Resources/Sprites/Games/Spaceball/star.mat b/Assets/Resources/Sprites/Games/Spaceball/star.mat new file mode 100644 index 00000000..5e426563 --- /dev/null +++ b/Assets/Resources/Sprites/Games/Spaceball/star.mat @@ -0,0 +1,105 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: star + m_Shader: {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: + m_LightmapFlags: 0 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _AlphaTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: 7282243b380b13546a2b9bf0701991d2, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - PixelSnap: 0 + - _BlendOp: 0 + - _BumpScale: 1 + - _CameraFadingEnabled: 0 + - _CameraFarFadeDistance: 2 + - _CameraNearFadeDistance: 1 + - _ColorMode: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DistortionBlend: 0.5 + - _DistortionEnabled: 0 + - _DistortionStrength: 1 + - _DistortionStrengthScaled: 0 + - _DstBlend: 0 + - _EmissionEnabled: 0 + - _EnableExternalAlpha: 0 + - _FlipbookMode: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _LightingEnabled: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SoftParticlesEnabled: 0 + - _SoftParticlesFarFadeDistance: 1 + - _SoftParticlesNearFadeDistance: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _CameraFadeParams: {r: 0, g: Infinity, b: 0, a: 0} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorAddSubDiff: {r: 0, g: 0, b: 0, a: 0} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _Flip: {r: 1, g: 1, b: 1, a: 1} + - _RendererColor: {r: 1, g: 1, b: 1, a: 1} + - _SoftParticleFadeParams: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] diff --git a/Assets/Resources/Sprites/Games/Spaceball/star.mat.meta b/Assets/Resources/Sprites/Games/Spaceball/star.mat.meta new file mode 100644 index 00000000..68a264f3 --- /dev/null +++ b/Assets/Resources/Sprites/Games/Spaceball/star.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ac0e1b6fa4ac4404ba36dd6e341fa024 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/Sprites/Games/Spaceball/star.png b/Assets/Resources/Sprites/Games/Spaceball/star.png new file mode 100644 index 0000000000000000000000000000000000000000..63bba084aa417a801df9ef056f6c8437afee2a69 GIT binary patch literal 333 zcmeAS@N?(olHy`uVBq!ia0vp^_CRdQ!3HFyrfEalY(fIb7q2FN#k(P%y z6NDFh7QNH1a4{(02b0K2#{~-R9O)ZbR9V9nL`_XzI(JT)z|-2CqR6W8VCPT!Oz!vV zzC4Tkc1s9oBn0f5x`_K%Za|j4@6<~xW@@UgzGmfn>ET=Nl6eN-7HrWM|8}ZZ{r2Iv z78`0yZj~OZPv)OL` actions = new List(); - public MiniGame(string name, List actions) + public MiniGame(string name, string color, List actions) { this.name = name; + this.color = color; this.actions = actions; } } @@ -58,12 +61,12 @@ namespace RhythmHeavenMania { minigames = new List() { - new MiniGame("gameManager", new List() + new MiniGame("gameManager", "", new List() { new GameAction("end", delegate { Debug.Log("end"); }), new GameAction("switchGame", delegate { GameManager.instance.SwitchGame(currentSwitchGame); }) }), - new MiniGame("forkLifter", new List() + new MiniGame("forkLifter", "FFFFFF", new List() { new GameAction("pea", delegate { ForkLifter.instance.Flick(currentBeat, 0); }, true ), new GameAction("topbun", delegate { ForkLifter.instance.Flick(currentBeat, 1); }, true ), @@ -73,7 +76,7 @@ namespace RhythmHeavenMania new GameAction("gulp", delegate { ForkLifterPlayer.instance.Eat(); }), new GameAction("sigh", delegate { Jukebox.PlayOneShot("sigh"); }) }), - new MiniGame("clappyTrio", new List() + new MiniGame("clappyTrio", "29E7FF", new List() { // Claps new GameAction("clap", delegate { ClappyTrio.instance.Clap(currentBeat, currentLength); }, true ), @@ -83,9 +86,11 @@ namespace RhythmHeavenMania new GameAction("prepare", delegate { ClappyTrio.instance.Prepare(0); } ), new GameAction("prepare_alt", delegate { ClappyTrio.instance.Prepare(3); } ), }), - new MiniGame("spaceball", new List() + new MiniGame("spaceball", "00A518", new List() { - new GameAction("shoot", delegate { Spaceball.instance.Shoot(currentBeat, currentType); }, true ) + new GameAction("shoot", delegate { Spaceball.instance.Shoot(currentBeat, false, currentType); }, true ), + new GameAction("shootHigh", delegate { Spaceball.instance.Shoot(currentBeat, true, currentType); }, true ), + new GameAction("cameraZoom", delegate { Spaceball.instance.CameraZoom(currentBeat, currentLength, currentValA); } ), }) }; @@ -126,6 +131,7 @@ namespace RhythmHeavenMania { currentLength = GameManager.instance.Beatmap.entities[GameManager.instance.currentEvent].length; currentType = GameManager.instance.Beatmap.entities[GameManager.instance.currentEvent].type; + currentValA = GameManager.instance.Beatmap.entities[GameManager.instance.currentEvent].valA; if (details.Length > 2) currentSwitchGame = details[2]; diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index 5db26266..453821d1 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -25,10 +25,11 @@ namespace RhythmHeavenMania public float startOffset; public Camera GameCamera, CursorCam; + public CircleCursor CircleCursor; [Header("Games")] Coroutine currentGameSwitchIE; - private string currentGame; + public string currentGame; private void Awake() @@ -53,7 +54,7 @@ namespace RhythmHeavenMania StartCoroutine(Begin()); - currentGame = eventCaller.GamesHolder.GetComponentsInChildren()[1].name; + SetCurrentGame(eventCaller.GamesHolder.transform.GetComponentsInChildren()[1].name); } private IEnumerator Begin() @@ -116,21 +117,37 @@ namespace RhythmHeavenMania { this.GetComponent().enabled = true; - eventCaller.minigames.Find(c => c.name == currentGame).holder.SetActive(false); - eventCaller.minigames.Find(c => c.name == game).holder.SetActive(true); + GetGame(currentGame).holder.GetComponent().OnGameSwitch(); + + GetGame(currentGame).holder.SetActive(false); + GetGame(game).holder.SetActive(true); + GameCamera.orthographic = true; - eventCaller.minigames.Find(c => c.name == game).holder.GetComponent().OnGameSwitch(); - currentGame = game; + + GetGame(game).holder.GetComponent().OnGameSwitch(); + + SetCurrentGame(game); yield return new WaitForSeconds(0.1666f); - this.GetComponent().enabled = false; } - private void OnGUI() + public EventCaller.MiniGame GetGame(string name) { - // GUI.Box(new Rect(0, 0, 300, 50), $"SongPosInBeats: {Conductor.instance.songPositionInBeats}"); + return eventCaller.minigames.Find(c => c.name == name); + } + + // never gonna use this + public EventCaller.MiniGame GetCurrentGame() + { + return eventCaller.minigames.Find(c => c.name == transform.GetComponentsInChildren()[1].name); + } + + public void SetCurrentGame(string game) + { + currentGame = game; + CircleCursor.InnerCircle.GetComponent().color = Colors.Hex2RGB(GetGame(currentGame).color); } } } \ No newline at end of file diff --git a/Assets/Scripts/Games/ForkLifter/ForkLifter.cs b/Assets/Scripts/Games/ForkLifter/ForkLifter.cs index 4b8e2b5c..c67a2adc 100644 --- a/Assets/Scripts/Games/ForkLifter/ForkLifter.cs +++ b/Assets/Scripts/Games/ForkLifter/ForkLifter.cs @@ -37,6 +37,7 @@ namespace RhythmHeavenMania.Games.ForkLifter { ForkLifterHand.CheckNextFlick(); ForkLifterPlayer.instance.RemoveObjFromFork(); + ForkLifterHand.GetComponent().Play("Hand_Idle", 0, 0); } private void Start() diff --git a/Assets/Scripts/Games/ForkLifter/ForkLifterHand.cs b/Assets/Scripts/Games/ForkLifter/ForkLifterHand.cs index 5baed83c..aedefcba 100644 --- a/Assets/Scripts/Games/ForkLifter/ForkLifterHand.cs +++ b/Assets/Scripts/Games/ForkLifter/ForkLifterHand.cs @@ -50,7 +50,7 @@ namespace RhythmHeavenMania.Games.ForkLifter public void Prepare() { Jukebox.PlayOneShotGame("forkLifter/flickPrepare"); - GetComponent().Play("Hand_Prepare"); + GetComponent().Play("Hand_Prepare", 0, 0); } } } \ No newline at end of file diff --git a/Assets/Scripts/Games/Spaceball/Spaceball.cs b/Assets/Scripts/Games/Spaceball/Spaceball.cs index 8f286309..2ac895d4 100644 --- a/Assets/Scripts/Games/Spaceball/Spaceball.cs +++ b/Assets/Scripts/Games/Spaceball/Spaceball.cs @@ -14,6 +14,14 @@ namespace RhythmHeavenMania.Games.Spaceball public GameObject Dispenser; public GameObject Dust; + private float lastCamDistance; + private bool zoomingCamera = false; + private float lastZoomCamBeat; + private float lastZoomCamLength; + private float lastZoomCamDistance; + + public Sprite[] Balls; + public static Spaceball instance { get; set; } public override void OnGameSwitch() @@ -21,6 +29,7 @@ namespace RhythmHeavenMania.Games.Spaceball for (int i = 1; i < BallsHolder.transform.childCount; i++) Destroy(BallsHolder.transform.GetChild(i).gameObject); GameManager.instance.GameCamera.orthographic = false; + SpaceballPlayer.instance.EligibleHits.RemoveRange(0, SpaceballPlayer.instance.EligibleHits.Count); } private void Awake() @@ -40,15 +49,40 @@ namespace RhythmHeavenMania.Games.Spaceball Dispenser.GetComponent().Play("DispenserPrepare", 0, 0); } } + + if (zoomingCamera) + { + float normalizedBeat = Conductor.instance.GetLoopPositionFromBeat(lastZoomCamBeat, lastZoomCamLength); + float newPosZ = Mathf.Lerp(lastCamDistance, lastZoomCamDistance, normalizedBeat); + GameManager.instance.GameCamera.transform.localPosition = new Vector3(0, 0, newPosZ); + } } - public void Shoot(float beat, string type) + + public void CameraZoom(float beat, float length, float distance) + { + lastZoomCamBeat = beat; + lastZoomCamLength = length; + + float dist = distance; + dist = dist * -1; + + if (dist > 0) + lastZoomCamDistance = 0; + else + lastZoomCamDistance = dist; + + zoomingCamera = true; + lastCamDistance = GameManager.instance.GameCamera.transform.localPosition.z; + } + + public void Shoot(float beat, bool high, string type) { GameObject ball = Instantiate(Ball); ball.transform.parent = Ball.transform.parent; ball.SetActive(true); ball.GetComponent().startBeat = beat; - if (type == "high") + if (high) { ball.GetComponent().high = true; Jukebox.PlayOneShotGame("spaceball/longShoot"); @@ -58,6 +92,11 @@ namespace RhythmHeavenMania.Games.Spaceball Jukebox.PlayOneShotGame("spaceball/shoot"); } + if (type == "riceball") + { + ball.GetComponent().Sprite.sprite = Balls[1]; + } + Dispenser.GetComponent().Play("DispenserShoot", 0, 0); } } diff --git a/Assets/Scripts/Games/Spaceball/SpaceballBall.cs b/Assets/Scripts/Games/Spaceball/SpaceballBall.cs index 604afb6d..44aa527f 100644 --- a/Assets/Scripts/Games/Spaceball/SpaceballBall.cs +++ b/Assets/Scripts/Games/Spaceball/SpaceballBall.cs @@ -18,6 +18,7 @@ namespace RhythmHeavenMania.Games.Spaceball private Minigame.Eligible e = new Minigame.Eligible(); public GameObject Holder; + public SpriteRenderer Sprite; private void Start() { @@ -31,7 +32,7 @@ namespace RhythmHeavenMania.Games.Spaceball float beatLength = 1f; if (high) beatLength = 2f; - float normalizedBeatAnim = Conductor.instance.GetLoopPositionFromBeat(startBeat, beatLength + 0.25f); + float normalizedBeatAnim = Conductor.instance.GetLoopPositionFromBeat(startBeat, beatLength + 0.2f); if (high) anim.Play("BallHigh", -1, normalizedBeatAnim); @@ -63,8 +64,8 @@ namespace RhythmHeavenMania.Games.Spaceball } // too lazy to make a proper fix for this - float endTime = 1.25f; - if (high) endTime = 1.15f; + float endTime = 1.2f; + if (high) endTime = 1.1f; if (normalizedBeat > endTime) { diff --git a/Assets/Scripts/Util/Jukebox.cs b/Assets/Scripts/Util/Jukebox.cs index 74e343fd..38e5c0dc 100644 --- a/Assets/Scripts/Util/Jukebox.cs +++ b/Assets/Scripts/Util/Jukebox.cs @@ -51,7 +51,8 @@ namespace RhythmHeavenMania.Util public static void PlayOneShotGame(string name) { - PlayOneShot($"games/{name}"); + if (GameManager.instance.currentGame == name.Split('/')[0]) + PlayOneShot($"games/{name}"); } } diff --git a/Assets/spaceball.json b/Assets/spaceball.json index 9dcfdb61..2faab007 100644 --- a/Assets/spaceball.json +++ b/Assets/spaceball.json @@ -3,8 +3,21 @@ "entities": [ { "beat": 4, + "type": "riceball", "datamodel": "spaceball/shoot" }, + { + "beat": 4, + "length": 42, + "valA": 30, + "datamodel": "spaceball/cameraZoom" + }, + { + "beat": 44, + "length": 2, + "valA": 170, + "datamodel": "spaceball/cameraZoom" + }, { "beat": 6, "datamodel": "spaceball/shoot" @@ -40,8 +53,57 @@ }, { "beat": 22, - "type": "high", + "type": "riceball", + "datamodel": "spaceball/shootHigh" + }, + { + "beat": 26, "datamodel": "spaceball/shoot" + }, + { + "beat": 28, + "type": "high", + "datamodel": "spaceball/shootHigh" + }, + { + "beat": 28, + "datamodel": "spaceball/shoot" + }, + { + "beat": 28, + "datamodel": "forkLifter/pea" + }, + { + "beat": 29.5, + "datamodel": "gameManager/switchGame/forkLifter" + }, + { + "beat": 32, + "datamodel": "gameManager/switchGame/spaceball" + }, + { + "beat": 34, + "datamodel": "spaceball/shoot" + }, + { + "beat": 36, + "datamodel": "spaceball/shoot" + }, + { + "beat": 38, + "datamodel": "spaceball/shoot" + }, + { + "beat": 40, + "datamodel": "spaceball/shoot" + }, + { + "beat": 42, + "datamodel": "spaceball/shoot" + }, + { + "beat": 44, + "datamodel": "spaceball/shootHigh" } ] } \ No newline at end of file