Skip to content
This repository has been archived by the owner on Aug 9, 2024. It is now read-only.

Commit

Permalink
Added Key amount tracking on the UI
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonymendez committed Jul 6, 2017
1 parent d170b63 commit 8fa922f
Show file tree
Hide file tree
Showing 7 changed files with 144 additions and 11 deletions.
4 changes: 4 additions & 0 deletions Assets/Scripts/Key.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ void OnCollisionEnter2D(Collision2D collision) {
Variables.score += 50;
Variables.keysObtained++;
keyPool.AddGameObject(gameObject);

if(Variables.keysObtained == 8) {

}
}
}
}
18 changes: 18 additions & 0 deletions Assets/Scripts/KeysUI.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class KeysUI : MonoBehaviour {

Text text;

void Start () {
text = GetComponent<Text>();
}

// Update is called once per frame
void Update () {
text.text = string.Format("{0}/8 Keys", Variables.keysObtained);
}
}
12 changes: 12 additions & 0 deletions Assets/Scripts/KeysUI.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Assets/Scripts/LaserUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ void Start () {

// Update is called once per frame
void Update () {
text.text = string.Format("Laser: {0}",player.shotsAvailable);
text.text = string.Format("Lasers {0}",player.shotsAvailable);
}
}
2 changes: 1 addition & 1 deletion Assets/Scripts/ScoreUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ void Start () {

// Update is called once per frame
void Update () {
text.text = string.Format("Score: {0}",Variables.score);
text.text = string.Format("Score {0}",Variables.score);
}
}
2 changes: 1 addition & 1 deletion Assets/Scripts/TimeUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ void Start () {
void Update () {
if (!mainCamera.isDead()) {
timeInSeconds += Time.deltaTime;
text.text = string.Format("{0:0.00} :Time", timeInSeconds);
text.text = string.Format("{0:0.00} Time", timeInSeconds);
}
}
}
115 changes: 107 additions & 8 deletions Assets/mainQuickLevel.unity
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ RectTransform:
- {fileID: 1589474904}
- {fileID: 734640559}
m_Father: {fileID: 347363267}
m_RootOrder: 3
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
Expand Down Expand Up @@ -1367,6 +1367,7 @@ RectTransform:
- {fileID: 2109769018}
- {fileID: 200864841}
- {fileID: 447347521}
- {fileID: 379649670}
- {fileID: 94088388}
- {fileID: 1349632244}
- {fileID: 1603773695}
Expand Down Expand Up @@ -1404,6 +1405,92 @@ Transform:
m_PrefabParentObject: {fileID: 4022241446019246, guid: 7af5e911be6503e4ca34be50dfe3bf2d,
type: 2}
m_PrefabInternal: {fileID: 1944486109}
--- !u!1 &379649669
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 379649670}
- component: {fileID: 379649673}
- component: {fileID: 379649672}
- component: {fileID: 379649674}
m_Layer: 5
m_Name: KeysObtained
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &379649670
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 379649669}
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: []
m_Father: {fileID: 347363267}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: -10, y: 10}
m_SizeDelta: {x: 312, y: 47}
m_Pivot: {x: 1, y: 0}
--- !u!114 &379649672
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 379649669}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 0.9724138, b: 0, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 40
m_FontStyle: 1
m_BestFit: 0
m_MinSize: 2
m_MaxSize: 40
m_Alignment: 2
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: 0/8 :Keys
--- !u!222 &379649673
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 379649669}
--- !u!114 &379649674
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 379649669}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 11b56a26a2b96894caa8f9e0aef3b545, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1001 &401312782
Prefab:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -1725,8 +1812,9 @@ GameObject:
- component: {fileID: 447347521}
- component: {fileID: 447347523}
- component: {fileID: 447347522}
- component: {fileID: 447347524}
m_Layer: 5
m_Name: Text
m_Name: Lasers
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
Expand Down Expand Up @@ -1789,6 +1877,17 @@ CanvasRenderer:
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 447347520}
--- !u!114 &447347524
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 447347520}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c54980742eb30ca41b2c4e6c7cc0adc2, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &460280417
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -5235,7 +5334,7 @@ RectTransform:
- {fileID: 907639751}
- {fileID: 729594402}
m_Father: {fileID: 347363267}
m_RootOrder: 4
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
Expand Down Expand Up @@ -8210,7 +8309,7 @@ Prefab:
- target: {fileID: 224967390133031730, guid: 890d081776bf82d4dad315b104492485,
type: 2}
propertyPath: m_RootOrder
value: 5
value: 6
objectReference: {fileID: 0}
- target: {fileID: 224967390133031730, guid: 890d081776bf82d4dad315b104492485,
type: 2}
Expand Down Expand Up @@ -8330,7 +8429,7 @@ Prefab:
- target: {fileID: 224937702368924114, guid: 890d081776bf82d4dad315b104492485,
type: 2}
propertyPath: m_AnchoredPosition.y
value: -64
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224117047670294528, guid: 890d081776bf82d4dad315b104492485,
type: 2}
Expand All @@ -8350,7 +8449,7 @@ Prefab:
- target: {fileID: 224117047670294528, guid: 890d081776bf82d4dad315b104492485,
type: 2}
propertyPath: m_AnchoredPosition.y
value: -64
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224318797648277398, guid: 890d081776bf82d4dad315b104492485,
type: 2}
Expand All @@ -8370,7 +8469,7 @@ Prefab:
- target: {fileID: 224318797648277398, guid: 890d081776bf82d4dad315b104492485,
type: 2}
propertyPath: m_AnchoredPosition.y
value: -65.5
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224026260602666650, guid: 890d081776bf82d4dad315b104492485,
type: 2}
Expand All @@ -8390,7 +8489,7 @@ Prefab:
- target: {fileID: 224026260602666650, guid: 890d081776bf82d4dad315b104492485,
type: 2}
propertyPath: m_AnchoredPosition.y
value: -65.5
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224351528444506154, guid: 890d081776bf82d4dad315b104492485,
type: 2}
Expand Down

0 comments on commit 8fa922f

Please sign in to comment.