Polished credits and main menu

This commit is contained in:
louishorlaville 2022-10-30 01:34:25 -04:00
parent 400c5a1183
commit acc9a1ad2b
7 changed files with 1420 additions and 34 deletions

View File

@ -282,6 +282,195 @@
"isPartOfComposite": true "isPartOfComposite": true
} }
] ]
},
{
"name": "UI",
"id": "6f134e62-674f-4370-94ea-dd8e473463e1",
"actions": [
{
"name": "Escape",
"type": "Button",
"id": "46112f3b-9ac3-4e18-a7ad-1b01a7174b41",
"expectedControlType": "Button",
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "FastForward",
"type": "Button",
"id": "f6c252cc-6a82-4629-bd41-884bbc40f8e5",
"expectedControlType": "Button",
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "AnyKeyPressed",
"type": "Button",
"id": "d5b5b3b7-c75b-479b-a4e0-7ab365318863",
"expectedControlType": "Button",
"processors": "",
"interactions": "",
"initialStateCheck": false
}
],
"bindings": [
{
"name": "",
"id": "045e422e-4fb9-40e2-9184-948030cf19a0",
"path": "<Keyboard>/escape",
"interactions": "",
"processors": "",
"groups": "",
"action": "Escape",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "af6ba96c-2b45-4720-ad85-6091f3eebc02",
"path": "<Gamepad>/buttonEast",
"interactions": "",
"processors": "",
"groups": "",
"action": "Escape",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "3f1e2917-4cd7-4a38-b9f4-6ee0452223bf",
"path": "<Keyboard>/space",
"interactions": "",
"processors": "",
"groups": "",
"action": "FastForward",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "75af4be2-6009-4ff6-861b-5739eef8decf",
"path": "<Keyboard>/escape",
"interactions": "",
"processors": "",
"groups": "",
"action": "FastForward",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "2be25d35-d4e4-4d47-ae37-1bab2efc8b77",
"path": "<Gamepad>/start",
"interactions": "",
"processors": "",
"groups": "",
"action": "FastForward",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "7fde1a64-e822-4f4b-8723-585ca9323a63",
"path": "<Gamepad>/buttonSouth",
"interactions": "",
"processors": "",
"groups": "",
"action": "FastForward",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "c6290f8a-1ca9-41d3-84b5-7afb4184212f",
"path": "<Gamepad>/buttonEast",
"interactions": "",
"processors": "",
"groups": "",
"action": "FastForward",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "b8dff556-873e-4c98-bf05-8c4f2b03f664",
"path": "<Mouse>/leftButton",
"interactions": "",
"processors": "",
"groups": "",
"action": "FastForward",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "f743856b-a552-4d76-865f-7d96a8e03f6f",
"path": "<Keyboard>/anyKey",
"interactions": "",
"processors": "",
"groups": "",
"action": "AnyKeyPressed",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "460ef968-d47d-4b34-b0c8-13df5d28be50",
"path": "<Gamepad>/buttonEast",
"interactions": "",
"processors": "",
"groups": "",
"action": "AnyKeyPressed",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "d4df63d3-de60-47dd-aae7-78d8407b0280",
"path": "<Gamepad>/buttonNorth",
"interactions": "",
"processors": "",
"groups": "",
"action": "AnyKeyPressed",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "95ef83b3-a6c8-4c8a-b7bb-c96d855343c7",
"path": "<Gamepad>/buttonSouth",
"interactions": "",
"processors": "",
"groups": "",
"action": "AnyKeyPressed",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "af7be75c-72ef-44bd-af66-6fcc4f144ec6",
"path": "<Gamepad>/buttonWest",
"interactions": "",
"processors": "",
"groups": "",
"action": "AnyKeyPressed",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "da5d7e38-ee17-41f3-88fa-61448b91d8e6",
"path": "<Gamepad>/start",
"interactions": "",
"processors": "",
"groups": "",
"action": "AnyKeyPressed",
"isComposite": false,
"isPartOfComposite": false
}
]
} }
], ],
"controlSchemes": [ "controlSchemes": [

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,11 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MusicController : MonoBehaviour
{
void Awake()
{
DontDestroyOnLoad(this.gameObject);
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 421f931d3e036474ab2a8a255ab3038d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,24 +1,81 @@
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using TMPro;
using UnityEngine; using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.UI; using UnityEngine.UI;
public class MainMenu : MonoBehaviour public class MainMenu : MonoBehaviour
{ {
[SerializeField] GameObject mainMenu; [SerializeField] GameObject mainMenu;
[SerializeField] float fadeSpeed; [SerializeField] GameObject skipCreditsText;
[SerializeField] GameObject skipCreditsIcon;
[SerializeField] GameObject credits;
[SerializeField] Button creditsButton;
[SerializeField] float menuFadeSpeed;
[SerializeField] float creditsScrollSpeed;
[SerializeField] float textAlphaFadeSpeed;
RectMask2D mainMenuMask; RectMask2D mainMenuMask;
private bool isCreditScrolling = false;
private bool skipCuePopped = false;
private void Start() private void Start()
{ {
mainMenuMask = mainMenu.GetComponent<RectMask2D>(); mainMenuMask = mainMenu.GetComponent<RectMask2D>();
} }
public void AnyKeyPressed(InputAction.CallbackContext context)
{
if (context.performed)
{
if (isCreditScrolling)
{
StartCoroutine("RevealSkipCue", 0f);
}
}
}
public void StopCredits(InputAction.CallbackContext context)
{
if (!isCreditScrolling) return;
else
{
if (context.performed && skipCuePopped)
{
isCreditScrolling = false;
ResetMenu();
}
}
}
private void Update()
{
Debug.Log(Input.GetKeyDown(KeyCode.Escape));
if (isCreditScrolling && Input.GetKeyDown(KeyCode.Escape))
{
isCreditScrolling = false;
}
}
public void CreditButtonPress() public void CreditButtonPress()
{ {
StartCoroutine("MainMenuFadeOut", 0f); creditsButton.interactable = false;
StartCoroutine("PlayCredits", 0f);
} }
public IEnumerator PlayCredits()
{
isCreditScrolling = true;
yield return MainMenuFadeOut();
yield return new WaitForSeconds(1.5f);
yield return CreditsScrollUp();
yield return new WaitForSeconds(.5f);
yield return MainMenuFadeIn();
}
public IEnumerator MainMenuFadeOut() public IEnumerator MainMenuFadeOut()
{ {
float paddingAmount; float paddingAmount;
@ -26,12 +83,87 @@ public class MainMenu : MonoBehaviour
while (mainMenuMask.padding.y <= 20) while (mainMenuMask.padding.y <= 20)
{ {
Debug.Log(mainMenuMask.padding.y); paddingAmount = mainMenuMask.padding.y + (menuFadeSpeed * Time.deltaTime);
paddingAmount = mainMenuMask.padding.y + (fadeSpeed * Time.deltaTime);
padding = new Vector4(mainMenuMask.padding.x, paddingAmount, mainMenuMask.padding.z, mainMenuMask.padding.w); padding = new Vector4(mainMenuMask.padding.x, paddingAmount, mainMenuMask.padding.z, mainMenuMask.padding.w);
mainMenuMask.padding = padding; mainMenuMask.padding = padding;
yield return null; yield return null;
} }
} }
public IEnumerator MainMenuFadeIn()
{
float paddingAmount;
Vector4 padding;
while (mainMenuMask.padding.y >= -110)
{
paddingAmount = mainMenuMask.padding.y - (menuFadeSpeed * Time.deltaTime);
padding = new Vector4(mainMenuMask.padding.x, paddingAmount, mainMenuMask.padding.z, mainMenuMask.padding.w);
mainMenuMask.padding = padding;
yield return null;
}
ResetMenu();
}
public IEnumerator CreditsScrollUp()
{
float startingScrollPos = credits.transform.position.y;
isCreditScrolling = true;
float scrollAmount;
Vector3 pos;
while (credits.transform.position.y < 375 && isCreditScrolling)
{
scrollAmount = credits.transform.position.y + (creditsScrollSpeed * Time.deltaTime);
pos = new Vector3(credits.transform.position.x, scrollAmount, credits.transform.position.z);
credits.transform.position = pos;
yield return null;
}
credits.transform.position = new Vector3(credits.transform.position.x, startingScrollPos, credits.transform.position.z);
}
public IEnumerator RevealSkipCue()
{
skipCreditsText.SetActive(true);
skipCreditsIcon.SetActive(true);
Color textColor = skipCreditsText.GetComponent<TMP_Text>().color;
Color iconColor = skipCreditsIcon.GetComponent<SpriteRenderer>().color;
float fadeAmount;
while (skipCreditsText.GetComponent<TMP_Text>().color.a<=1 || skipCreditsIcon.GetComponent<SpriteRenderer>().color.a<=1)
{
fadeAmount = textColor.a + (textAlphaFadeSpeed * Time.deltaTime);
textColor = new Color(textColor.r, textColor.g, textColor.b, fadeAmount);
iconColor = new Color(iconColor.r, iconColor.g, iconColor.b, fadeAmount);
skipCreditsText.GetComponent<TMP_Text>().color = textColor;
skipCreditsIcon.GetComponent<SpriteRenderer>().color = iconColor;
yield return null;
}
skipCuePopped = true;
}
void ResetMenu()
{
skipCuePopped = false;
creditsButton.interactable = true;
//Reset Skip Credits Cue
Color textColor = skipCreditsText.GetComponent<TMP_Text>().color;
Color iconColor = skipCreditsIcon.GetComponent<SpriteRenderer>().color;
textColor = new Color(textColor.r, textColor.g, textColor.b, 0);
iconColor = new Color(iconColor.r, iconColor.g, iconColor.b, 0);
skipCreditsText.GetComponent<TMP_Text>().color = textColor;
skipCreditsIcon.GetComponent<SpriteRenderer>().color = iconColor;
skipCreditsText.SetActive(false);
skipCreditsIcon.SetActive(false);
}
} }

BIN
Assets/Sprites/arrow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 536 B

View File

@ -0,0 +1,159 @@
fileFormatVersion: 2
guid: 386ee8da7560f8243aa6f350bde0278b
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant: