aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorCameron Katri <me@cameronkatri.com>2021-06-12 21:26:06 -0400
committerCameron Katri <me@cameronkatri.com>2021-06-12 21:26:06 -0400
commitfc19cb9c30967431f959a1c9360f5ef847bcd31c (patch)
tree6bc630ce98464af4ecfe90072760e548c7da1075
parent08c4ba7f5aa07db27341cbd056d6482376191d2a (diff)
parentee765e26621f0a7530ad63d7ce698dc80166e358 (diff)
downloadgmtk-gamejam-fc19cb9c30967431f959a1c9360f5ef847bcd31c.tar.gz
gmtk-gamejam-fc19cb9c30967431f959a1c9360f5ef847bcd31c.tar.zst
gmtk-gamejam-fc19cb9c30967431f959a1c9360f5ef847bcd31c.zip
Merge branch 'master' of git.cameronkatri.com:gmtk-gamejam
-rw-r--r--Assets/Scenes/Main.unity96
-rw-r--r--Assets/Scripts/Controllers/GameController.cs14
2 files changed, 21 insertions, 89 deletions
diff --git a/Assets/Scenes/Main.unity b/Assets/Scenes/Main.unity
index 11cf4c6..a742f20 100644
--- a/Assets/Scenes/Main.unity
+++ b/Assets/Scenes/Main.unity
@@ -767,85 +767,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 71c18c0662ec4384bf64aae1dc016093, type: 3}
m_Name:
m_EditorClassIdentifier:
---- !u!1 &709646537
-GameObject:
- m_ObjectHideFlags: 0
- m_CorrespondingSourceObject: {fileID: 0}
- m_PrefabInstance: {fileID: 0}
- m_PrefabAsset: {fileID: 0}
- serializedVersion: 6
- m_Component:
- - component: {fileID: 709646538}
- - component: {fileID: 709646540}
- - component: {fileID: 709646539}
- m_Layer: 5
- m_Name: Quarter
- m_TagString: Untagged
- m_Icon: {fileID: 0}
- m_NavMeshLayer: 0
- m_StaticEditorFlags: 0
- m_IsActive: 1
---- !u!224 &709646538
-RectTransform:
- m_ObjectHideFlags: 0
- m_CorrespondingSourceObject: {fileID: 0}
- m_PrefabInstance: {fileID: 0}
- m_PrefabAsset: {fileID: 0}
- m_GameObject: {fileID: 709646537}
- 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: 1302386145}
- m_RootOrder: 0
- m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
- m_AnchorMin: {x: 0, y: 0.5}
- m_AnchorMax: {x: 0, y: 0.5}
- m_AnchoredPosition: {x: 0, y: 0}
- m_SizeDelta: {x: 49.552, y: 30}
- m_Pivot: {x: 0, y: 0.5}
---- !u!114 &709646539
-MonoBehaviour:
- m_ObjectHideFlags: 0
- m_CorrespondingSourceObject: {fileID: 0}
- m_PrefabInstance: {fileID: 0}
- m_PrefabAsset: {fileID: 0}
- m_GameObject: {fileID: 709646537}
- m_Enabled: 1
- m_EditorHideFlags: 0
- m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, 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_FontData:
- m_Font: {fileID: 12800000, guid: b6747d7b13b2c4b9cb022acf49f3277b, type: 3}
- m_FontSize: 12
- m_FontStyle: 1
- m_BestFit: 0
- m_MinSize: 0
- m_MaxSize: 40
- m_Alignment: 4
- m_AlignByGeometry: 0
- m_RichText: 1
- m_HorizontalOverflow: 0
- m_VerticalOverflow: 0
- m_LineSpacing: 1
- m_Text: 4th
---- !u!222 &709646540
-CanvasRenderer:
- m_ObjectHideFlags: 0
- m_CorrespondingSourceObject: {fileID: 0}
- m_PrefabInstance: {fileID: 0}
- m_PrefabAsset: {fileID: 0}
- m_GameObject: {fileID: 709646537}
- m_CullTransparentMesh: 1
--- !u!1 &795506871
GameObject:
m_ObjectHideFlags: 0
@@ -1357,12 +1278,14 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 6639705c6da14aab845bd87d3d8fbf38, type: 3}
m_Name:
m_EditorClassIdentifier:
+ timeLimit: 60
ball: {fileID: 707826158}
PlayerHoop: {fileID: 614591307}
EnemyHoop: {fileID: 1354192742}
dribbleSound: {fileID: 1174357921}
playerScoreText: {fileID: 140689492}
enemyScoreText: {fileID: 447684163}
+ timerText: {fileID: 1402491148}
--- !u!82 &1174357921
AudioSource:
m_ObjectHideFlags: 0
@@ -1572,7 +1495,6 @@ RectTransform:
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- - {fileID: 709646538}
- {fileID: 1402491147}
m_Father: {fileID: 897316900}
m_RootOrder: 1
@@ -1861,13 +1783,13 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1302386145}
- m_RootOrder: 1
+ m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
- m_AnchorMin: {x: 0, y: 0.5}
- m_AnchorMax: {x: 0, y: 0.5}
- m_AnchoredPosition: {x: 35.4763, y: 0}
- m_SizeDelta: {x: 64.5238, y: 30}
- m_Pivot: {x: 0, y: 0.5}
+ m_AnchorMin: {x: 0.5, y: 0.5}
+ m_AnchorMax: {x: 0.5, y: 0.5}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: 70, y: 30}
+ m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1402491148
MonoBehaviour:
m_ObjectHideFlags: 0
@@ -1890,7 +1812,7 @@ MonoBehaviour:
m_Calls: []
m_FontData:
m_Font: {fileID: 12800000, guid: b6747d7b13b2c4b9cb022acf49f3277b, type: 3}
- m_FontSize: 12
+ m_FontSize: 14
m_FontStyle: 1
m_BestFit: 0
m_MinSize: 0
diff --git a/Assets/Scripts/Controllers/GameController.cs b/Assets/Scripts/Controllers/GameController.cs
index 775875a..e27a562 100644
--- a/Assets/Scripts/Controllers/GameController.cs
+++ b/Assets/Scripts/Controllers/GameController.cs
@@ -14,6 +14,9 @@ namespace Controllers
public Player player;
public Player enemy;
+
+ private float startTime;
+ [SerializeField] private float timeLimit;
/// <summary>
/// The single ball for the game.
@@ -30,6 +33,7 @@ namespace Controllers
[Header("UI")]
[SerializeField] private Text playerScoreText;
[SerializeField] private Text enemyScoreText;
+ [SerializeField] private Text timerText;
private void Awake()
{
@@ -43,6 +47,11 @@ namespace Controllers
private void Start()
{
+ startTime = Time.time;
+ }
+
+ private void Update()
+ {
UpdateUI();
}
@@ -50,6 +59,9 @@ namespace Controllers
{
playerScoreText.text = $"{player.score}";
enemyScoreText.text = $"{enemy.score}";
+
+ var remaining = TimeSpan.FromSeconds(timeLimit - (Time.time - startTime));
+ timerText.text = string.Format("{0:00}:{1:00}", remaining.Minutes, remaining.Seconds);
}
public struct Player
@@ -77,8 +89,6 @@ namespace Controllers
{
score += 2;
}
-
- controller.UpdateUI();
}
private State dribble => isEnemy ? State.EnemyDribble : State.PlayerDribble;