Collected coin amount is displayed
This commit is contained in:
parent
c6ce11ec82
commit
123ba04025
@ -30,6 +30,7 @@ RectTransform:
|
||||
m_LocalScale: {x: 0, y: 0, z: 0}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 3756227406995876155}
|
||||
- {fileID: 2391504647050640505}
|
||||
m_Father: {fileID: 4515361964050757684}
|
||||
m_RootOrder: 0
|
||||
@ -56,7 +57,7 @@ Canvas:
|
||||
m_OverrideSorting: 0
|
||||
m_OverridePixelPerfect: 0
|
||||
m_SortingBucketNormalizedSize: 0
|
||||
m_AdditionalShaderChannelsFlag: 0
|
||||
m_AdditionalShaderChannelsFlag: 25
|
||||
m_SortingLayerID: 0
|
||||
m_SortingOrder: 100
|
||||
m_TargetDisplay: 0
|
||||
@ -72,7 +73,7 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_UiScaleMode: 0
|
||||
m_UiScaleMode: 1
|
||||
m_ReferencePixelsPerUnit: 100
|
||||
m_ScaleFactor: 1
|
||||
m_ReferenceResolution: {x: 800, y: 600}
|
||||
@ -133,6 +134,7 @@ MonoBehaviour:
|
||||
endScene: ThanksScene
|
||||
fadeSpeed: 2.5
|
||||
fadeImg: {fileID: 3902665078773332606}
|
||||
coinText: {fileID: 3994057406749197163}
|
||||
--- !u!1 &5180033606312474289
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -164,7 +166,7 @@ RectTransform:
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1679323109552408359}
|
||||
m_RootOrder: 0
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
@ -209,3 +211,140 @@ MonoBehaviour:
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1 &6425620667288338338
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 3756227406995876155}
|
||||
- component: {fileID: 6600796015951369727}
|
||||
- component: {fileID: 3994057406749197163}
|
||||
m_Layer: 5
|
||||
m_Name: Text (TMP)
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &3756227406995876155
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6425620667288338338}
|
||||
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: []
|
||||
m_Father: {fileID: 1679323109552408359}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 10, y: -10}
|
||||
m_SizeDelta: {x: 30, y: 30}
|
||||
m_Pivot: {x: 0, y: 1}
|
||||
--- !u!222 &6600796015951369727
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6425620667288338338}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &3994057406749197163
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6425620667288338338}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_text: '0
|
||||
|
||||
'
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
|
||||
m_sharedMaterial: {fileID: 2100000, guid: e73a58f6e2794ae7b1b7e50b7fb811b0, type: 2}
|
||||
m_fontSharedMaterials: []
|
||||
m_fontMaterial: {fileID: 0}
|
||||
m_fontMaterials: []
|
||||
m_fontColor32:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_enableVertexGradient: 0
|
||||
m_colorMode: 3
|
||||
m_fontColorGradient:
|
||||
topLeft: {r: 1, g: 1, b: 1, a: 1}
|
||||
topRight: {r: 1, g: 1, b: 1, a: 1}
|
||||
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
|
||||
bottomRight: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_fontColorGradientPreset: {fileID: 0}
|
||||
m_spriteAsset: {fileID: 0}
|
||||
m_tintAllSprites: 0
|
||||
m_StyleSheet: {fileID: 0}
|
||||
m_TextStyleHashCode: -1183493901
|
||||
m_overrideHtmlColors: 0
|
||||
m_faceColor:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontSize: 26.85
|
||||
m_fontSizeBase: 36
|
||||
m_fontWeight: 400
|
||||
m_enableAutoSizing: 1
|
||||
m_fontSizeMin: 18
|
||||
m_fontSizeMax: 72
|
||||
m_fontStyle: 0
|
||||
m_HorizontalAlignment: 2
|
||||
m_VerticalAlignment: 512
|
||||
m_textAlignment: 65535
|
||||
m_characterSpacing: 0
|
||||
m_wordSpacing: 0
|
||||
m_lineSpacing: 0
|
||||
m_lineSpacingMax: 0
|
||||
m_paragraphSpacing: 0
|
||||
m_charWidthMaxAdj: 0
|
||||
m_enableWordWrapping: 1
|
||||
m_wordWrappingRatios: 0.4
|
||||
m_overflowMode: 0
|
||||
m_linkedTextComponent: {fileID: 0}
|
||||
parentLinkedComponent: {fileID: 0}
|
||||
m_enableKerning: 1
|
||||
m_enableExtraPadding: 0
|
||||
checkPaddingRequired: 0
|
||||
m_isRichText: 1
|
||||
m_parseCtrlCharacters: 1
|
||||
m_isOrthographic: 1
|
||||
m_isCullingEnabled: 0
|
||||
m_horizontalMapping: 0
|
||||
m_verticalMapping: 0
|
||||
m_uvLineOffset: 0
|
||||
m_geometrySortingOrder: 0
|
||||
m_IsTextObjectScaleStatic: 0
|
||||
m_VertexBufferAutoSizeReduction: 0
|
||||
m_useMaxVisibleDescender: 1
|
||||
m_pageToDisplay: 1
|
||||
m_margin: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_isUsingLegacyAnimationComponent: 0
|
||||
m_isVolumetricText: 0
|
||||
m_hasFontAssetChanged: 0
|
||||
m_baseMaterial: {fileID: 0}
|
||||
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
|
||||
|
||||
@ -568,6 +568,80 @@ Transform:
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 166936815}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1001 &167904865
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 4515361964050757684, guid: 875ca0f8a7a39ce459999ecf74b0fb3b,
|
||||
type: 3}
|
||||
propertyPath: m_RootOrder
|
||||
value: 24
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4515361964050757684, guid: 875ca0f8a7a39ce459999ecf74b0fb3b,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: -6.887238
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4515361964050757684, guid: 875ca0f8a7a39ce459999ecf74b0fb3b,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: -1.6704996
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4515361964050757684, guid: 875ca0f8a7a39ce459999ecf74b0fb3b,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: -7.8771486
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4515361964050757684, guid: 875ca0f8a7a39ce459999ecf74b0fb3b,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4515361964050757684, guid: 875ca0f8a7a39ce459999ecf74b0fb3b,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4515361964050757684, guid: 875ca0f8a7a39ce459999ecf74b0fb3b,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4515361964050757684, guid: 875ca0f8a7a39ce459999ecf74b0fb3b,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4515361964050757684, guid: 875ca0f8a7a39ce459999ecf74b0fb3b,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4515361964050757684, guid: 875ca0f8a7a39ce459999ecf74b0fb3b,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4515361964050757684, guid: 875ca0f8a7a39ce459999ecf74b0fb3b,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4515361964050757686, guid: 875ca0f8a7a39ce459999ecf74b0fb3b,
|
||||
type: 3}
|
||||
propertyPath: m_Name
|
||||
value: GameController
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6425620667288338338, guid: 875ca0f8a7a39ce459999ecf74b0fb3b,
|
||||
type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 875ca0f8a7a39ce459999ecf74b0fb3b, type: 3}
|
||||
--- !u!1 &248300950
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
|
||||
public class GameController : MonoBehaviour
|
||||
{
|
||||
@ -13,6 +14,8 @@ public class GameController : MonoBehaviour
|
||||
private float fadeSpeed;
|
||||
[SerializeField]
|
||||
private Image fadeImg;
|
||||
[SerializeField]
|
||||
private TMP_Text coinText;
|
||||
private Coroutine fadeCoroutine;
|
||||
private int coinAmount = 0;
|
||||
public int CoinAmount{get=>coinAmount;}
|
||||
@ -28,6 +31,13 @@ public class GameController : MonoBehaviour
|
||||
instance = this;
|
||||
DontDestroyOnLoad(this.gameObject);
|
||||
SceneManager.activeSceneChanged += ChangedScene;
|
||||
coinText.text = "0";
|
||||
Debug.Log("Awake");
|
||||
if(!SceneManager.GetActiveScene().name.Equals(mainScene)){
|
||||
coinText.gameObject.SetActive(false);
|
||||
}else{
|
||||
coinText.gameObject.SetActive(true);
|
||||
}
|
||||
}else{
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
@ -37,6 +47,7 @@ public class GameController : MonoBehaviour
|
||||
public void AddCoins(int amount){
|
||||
//This should not be like this. Collectible should call the player that hit it and add to their amount
|
||||
coinAmount += amount;
|
||||
coinText.text = coinAmount.ToString();
|
||||
}
|
||||
|
||||
|
||||
@ -65,6 +76,11 @@ public class GameController : MonoBehaviour
|
||||
|
||||
private void ChangedScene(Scene curr, Scene next){
|
||||
fadeCoroutine = StartCoroutine(FadeToBlack(string.Empty, false, fadeSpeed));
|
||||
if(!next.name.Equals(mainScene)){
|
||||
coinText.gameObject.SetActive(false);
|
||||
}else{
|
||||
coinText.gameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerator FadeToBlack(string sceneToLoad,bool fadeToBlack = true, float fadeSpeed = 2.5f){
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user