Commit bee443d7 authored by Mitchie Maluschnig's avatar Mitchie Maluschnig
Browse files

pie throwing now exits when GameOver variable is set

parent a33ba86d
......@@ -778,6 +778,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: da61e2cfda3fd4ded8570cfe5faa780b, type: 3}
m_Name:
m_EditorClassIdentifier:
exitText: {fileID: 755486145}
exitTimer: {fileID: 937751197}
--- !u!4 &510235120
Transform:
m_ObjectHideFlags: 0
......@@ -1077,6 +1079,82 @@ Transform:
m_CorrespondingSourceObject: {fileID: 4016853487692816, guid: b2f35ec24acb33f4eaa815ee25fe06ba,
type: 2}
m_PrefabInternal: {fileID: 727120530}
--- !u!1 &755486143
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 755486144}
- component: {fileID: 755486146}
- component: {fileID: 755486145}
m_Layer: 5
m_Name: ExitText
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &755486144
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 755486143}
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:
- {fileID: 937751196}
m_Father: {fileID: 1407271059}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
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: 300, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &755486145
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 755486143}
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: 0.19607843, g: 0.19607843, b: 0.19607843, 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: 30
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 43
m_Alignment: 1
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: Out of Pies, Exiting...
--- !u!222 &755486146
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 755486143}
m_CullTransparentMesh: 0
--- !u!1 &834739659
GameObject:
m_ObjectHideFlags: 0
......@@ -1312,6 +1390,81 @@ Transform:
m_Father: {fileID: 373884247}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &937751195
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 937751196}
- component: {fileID: 937751198}
- component: {fileID: 937751197}
m_Layer: 5
m_Name: Timer
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &937751196
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 937751195}
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: 755486144}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: -21}
m_SizeDelta: {x: 160, y: 30}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &937751197
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 937751195}
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: 0.19607843, g: 0.19607843, b: 0.19607843, 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: 25
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 7
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: 5
--- !u!222 &937751198
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 937751195}
m_CullTransparentMesh: 0
--- !u!1001 &981664264
Prefab:
m_ObjectHideFlags: 0
......@@ -2236,6 +2389,7 @@ RectTransform:
m_Children:
- {fileID: 2133793786}
- {fileID: 100312134}
- {fileID: 755486144}
m_Father: {fileID: 0}
m_RootOrder: 10
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class PieManager : MonoBehaviour {
......@@ -8,16 +10,35 @@ public class PieManager : MonoBehaviour {
public static bool pieInScene = false;
public static bool start = true;
public static int numTargets;
public Text exitText;
public Text exitTimer;
private bool gameOver;
private float exitTime;
private void Update()
{
if(pieCount == 0){
return;
if (!gameOver) {
gameOver = true;
exitTime = Time.time + 5;
exitText.gameObject.SetActive(true);
}
}
if (gameOver) {
if (Time.time > exitTime) {
SceneManager.LoadScene("Daytime");
} else {
exitTimer.text = ((int)(exitTime - Time.time + 0.98f)).ToString();
}
}
}
void Start()
{
exitText.gameObject.SetActive(false);
exitTime = Mathf.Infinity;
numTargets = Random.Range(1, 9);
pieCount = numTargets * 2;
PieTarget[] targets = FindObjectsOfType<PieTarget>();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment