size 43062 |
@ -0,0 +1,7 @@ | |||||
fileFormatVersion: 2 | |||||
guid: a85bd4296d5a1684fa42dc31c88b08d4 | |||||
DefaultImporter: | |||||
externalObjects: {} | |||||
userData: | |||||
assetBundleName: | |||||
assetBundleVariant: |
size 40672 |
@ -0,0 +1,8 @@ | |||||
fileFormatVersion: 2 | |||||
guid: f0d43d896ffeafd41a94c6952b8193e6 | |||||
folderAsset: yes | |||||
DefaultImporter: | |||||
externalObjects: {} | |||||
userData: | |||||
assetBundleName: | |||||
assetBundleVariant: |
@ -0,0 +1,133 @@ | |||||
using System.Collections; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using UnityEngine; | |||||
public class CreditUIController : MonoBehaviour | |||||
{ | |||||
[SerializeField] | |||||
private PlayerList m_allPlayers; | |||||
[SerializeField] | |||||
private GameObject m_playerPrefab; | |||||
[SerializeField] | |||||
private RectTransform winnerPos; | |||||
[SerializeField] | |||||
private RectTransform losePos; | |||||
[SerializeField] | |||||
private float waitTime = 1; | |||||
[SerializeField] | |||||
private float creditDisplayTime = 1; | |||||
[SerializeField] | |||||
public List<CreditReferences> m_CreditReferences; | |||||
[SerializeField] | |||||
public List<CreditData> m_Credits; | |||||
private int Count; | |||||
private void Start() | |||||
{ | |||||
StartCoroutine(DisplaySlow(waitTime)); | |||||
StartCoroutine(DisplayCredits(creditDisplayTime)); | |||||
} | |||||
[ContextMenu("display All players")] | |||||
private void DisplayAllPlayers() | |||||
{ | |||||
int max = m_allPlayers.AllPlayers.Select(p => p.Score).Max(); | |||||
int min = m_allPlayers.AllPlayers.Select(p => p.Score).Min(); | |||||
foreach (var data in m_allPlayers.AllPlayers) | |||||
{ | |||||
DisplayScore(data, max, min); | |||||
} | |||||
} | |||||
private IEnumerator DisplaySlow(float timebetween = 1) | |||||
{ | |||||
int max = m_allPlayers.AllPlayers.Select(p => p.Score).Max(); | |||||
int min = m_allPlayers.AllPlayers.Select(p => p.Score).Min(); | |||||
foreach (var data in m_allPlayers.AllPlayers.OrderBy(p => p.Score)) | |||||
{ | |||||
yield return new WaitForSeconds(timebetween); | |||||
DisplayScore(data, max, min); | |||||
} | |||||
} | |||||
private IEnumerator DisplayCredits(float displayTime) | |||||
{ | |||||
float totalTime = displayTime / m_CreditReferences.Count; | |||||
while (true) | |||||
{ | |||||
CreditReferences reference = m_CreditReferences[Count%m_CreditReferences.Count]; | |||||
CreditData data = m_Credits[Count % m_Credits.Count]; | |||||
Count++; | |||||
reference.Title.text = data.Title; | |||||
reference.Credit.text = data.Credit; | |||||
yield return new WaitForSeconds(totalTime); | |||||
} | |||||
} | |||||
private void DisplayScore(PlayerData player, int maxScore, int minScore) | |||||
{ | |||||
player.Input.SwitchCurrentActionMap("JoinMenu"); | |||||
float ratio = 0.5f; | |||||
if (maxScore != minScore) | |||||
ratio = (float)(player.Score - minScore) / (maxScore - minScore); | |||||
Vector3 pos = Vector3.Lerp(losePos.position, winnerPos.position, ratio); | |||||
pos.x = Random.Range((Screen.width / 4f), Screen.width); | |||||
GameObject newPlayer = Instantiate(m_playerPrefab); | |||||
newPlayer.transform.parent = (m_playerPrefab.transform.parent); | |||||
newPlayer.transform.position = pos; | |||||
newPlayer.transform.Rotate(Vector3.forward, Random.Range(-20.0f, 20.0f)); | |||||
if (Random.Range(0, 2) > 0) | |||||
{ | |||||
newPlayer.transform.localScale.Scale(new Vector3(-1, 1, 1)); | |||||
newPlayer.GetComponentInChildren<TMPro.TextMeshProUGUI>().transform.localScale.Scale(new Vector3(-1, 1, 1)); | |||||
} | |||||
newPlayer.GetComponent<PlayerJoinIcon>().Initialise(player); | |||||
newPlayer.GetComponentInChildren<TMPro.TextMeshProUGUI>().text = player.Score.ToString(); | |||||
newPlayer.SetActive(true); | |||||
} | |||||
[System.Serializable] | |||||
public struct CreditReferences | |||||
{ | |||||
public TMPro.TextMeshProUGUI Title; | |||||
public TMPro.TextMeshProUGUI Credit; | |||||
} | |||||
[System.Serializable] | |||||
public struct CreditData | |||||
{ | |||||
public string Title; | |||||
public string Credit; | |||||
} | |||||
} |
@ -0,0 +1,11 @@ | |||||
fileFormatVersion: 2 | |||||
guid: bc723bcaa734e8646a99f2415e540ff0 | |||||
MonoImporter: | |||||
externalObjects: {} | |||||
serializedVersion: 2 | |||||
defaultReferences: [] | |||||
executionOrder: 0 | |||||
icon: {instanceID: 0} | |||||
userData: | |||||
assetBundleName: | |||||
assetBundleVariant: |
@ -0,0 +1,125 @@ | |||||
%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: Score_Text | |||||
m_Shader: {fileID: 4800000, guid: fe393ace9b354375a9cb14cdbbc28be4, type: 3} | |||||
m_ShaderKeywords: | |||||
m_LightmapFlags: 4 | |||||
m_EnableInstancingVariants: 0 | |||||
m_DoubleSidedGI: 0 | |||||
m_CustomRenderQueue: -1 | |||||
stringTagMap: {} | |||||
disabledShaderPasses: [] | |||||
m_SavedProperties: | |||||
serializedVersion: 3 | |||||
m_TexEnvs: | |||||
- _BaseMap: | |||||
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} | |||||
- _EmissionMap: | |||||
m_Texture: {fileID: 0} | |||||
m_Scale: {x: 1, y: 1} | |||||
m_Offset: {x: 0, y: 0} | |||||
- _MainTex: | |||||
m_Texture: {fileID: 0} | |||||
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} | |||||
- _SpecGlossMap: | |||||
m_Texture: {fileID: 0} | |||||
m_Scale: {x: 1, y: 1} | |||||
m_Offset: {x: 0, y: 0} | |||||
m_Floats: | |||||
- _AlphaClip: 0 | |||||
- _Blend: 0 | |||||
- _BumpScale: 1 | |||||
- _ColorMask: 15 | |||||
- _Cull: 2 | |||||
- _CullMode: 0 | |||||
- _Cutoff: 0.5 | |||||
- _DstBlend: 0 | |||||
- _EnvironmentReflections: 1 | |||||
- _FaceDilate: 0 | |||||
- _GlossMapScale: 0 | |||||
- _Glossiness: 0 | |||||
- _GlossyReflections: 0 | |||||
- _GradientScale: 5 | |||||
- _MaskSoftnessX: 0 | |||||
- _MaskSoftnessY: 0 | |||||
- _Metallic: 0 | |||||
- _OcclusionStrength: 1 | |||||
- _OutlineSoftness: 0 | |||||
- _OutlineWidth: 0 | |||||
- _PerspectiveFilter: 0.875 | |||||
- _QueueOffset: 0 | |||||
- _ReceiveShadows: 1 | |||||
- _ScaleRatioA: 1 | |||||
- _ScaleRatioB: 1 | |||||
- _ScaleRatioC: 1 | |||||
- _ScaleX: 1 | |||||
- _ScaleY: 1 | |||||
- _ShaderFlags: 0 | |||||
- _Sharpness: 0 | |||||
- _Smoothness: 0.5 | |||||
- _SmoothnessTextureChannel: 0 | |||||
- _SpecularHighlights: 1 | |||||
- _SrcBlend: 1 | |||||
- _Stencil: 0 | |||||
- _StencilComp: 8 | |||||
- _StencilOp: 0 | |||||
- _StencilReadMask: 255 | |||||
- _StencilWriteMask: 255 | |||||
- _Surface: 0 | |||||
- _TextureHeight: 512 | |||||
- _TextureWidth: 512 | |||||
- _UnderlayDilate: 0 | |||||
- _UnderlayOffsetX: 0 | |||||
- _UnderlayOffsetY: 0 | |||||
- _UnderlaySoftness: 0 | |||||
- _VertexOffsetX: 0 | |||||
- _VertexOffsetY: 0 | |||||
- _WeightBold: 0.5 | |||||
- _WeightNormal: 0 | |||||
- _WorkflowMode: 1 | |||||
- _ZWrite: 1 | |||||
m_Colors: | |||||
- _BaseColor: {r: 1, g: 1, b: 1, a: 1} | |||||
- _ClipRect: {r: -32767, g: -32767, b: 32767, a: 32767} | |||||
- _Color: {r: 1, g: 1, b: 1, a: 1} | |||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1} | |||||
- _FaceColor: {r: 1, g: 1, b: 1, a: 1} | |||||
- _OutlineColor: {r: 0, g: 0, b: 0, a: 1} | |||||
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} | |||||
- _UnderlayColor: {r: 0, g: 0, b: 0, a: 0.5} | |||||
m_BuildTextureStacks: [] | |||||
--- !u!114 &3715928537810302973 | |||||
MonoBehaviour: | |||||
m_ObjectHideFlags: 11 | |||||
m_CorrespondingSourceObject: {fileID: 0} | |||||
m_PrefabInstance: {fileID: 0} | |||||
m_PrefabAsset: {fileID: 0} | |||||
m_GameObject: {fileID: 0} | |||||
m_Enabled: 1 | |||||
m_EditorHideFlags: 0 | |||||
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} | |||||
m_Name: | |||||
m_EditorClassIdentifier: | |||||
version: 2 |
@ -0,0 +1,8 @@ | |||||
fileFormatVersion: 2 | |||||
guid: 0a67ea2466379b44f913e57a770b8d35 | |||||
NativeFormatImporter: | |||||
externalObjects: {} | |||||
mainObjectFileID: 0 | |||||
userData: | |||||
assetBundleName: | |||||
assetBundleVariant: |
size 670 |