From 52418019000333917e7a773d669f94454945825a Mon Sep 17 00:00:00 2001 From: Gregory Campbell Date: Sat, 8 Feb 2020 20:37:57 -0500 Subject: [PATCH] Added warning the pops up when the waypoint moves in waypoint race --- Assets/Scenes/Waypoint Race.unity | 158 ++++++++++++++++++++++++++++++ Assets/Scripts/WaypointRace.cs | 12 +++ 2 files changed, 170 insertions(+) diff --git a/Assets/Scenes/Waypoint Race.unity b/Assets/Scenes/Waypoint Race.unity index 8bcf6eb..b5b6466 100644 --- a/Assets/Scenes/Waypoint Race.unity +++ b/Assets/Scenes/Waypoint Race.unity @@ -1164,6 +1164,7 @@ RectTransform: - {fileID: 1579256712} - {fileID: 428865312} - {fileID: 1037071378} + - {fileID: 1171580184} m_Father: {fileID: 0} m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -1705,6 +1706,162 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1108559104} m_CullTransparentMesh: 0 +--- !u!1 &1171580183 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1171580184} + - component: {fileID: 1171580186} + - component: {fileID: 1171580185} + m_Layer: 5 + m_Name: WarningText + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!224 &1171580184 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1171580183} + 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: 963355974} + m_RootOrder: 3 + 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: 245} + m_SizeDelta: {x: 634.3, y: 132.5} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1171580185 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1171580183} + 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_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: THE WAYPOINT HAS MOVED! + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 5302535af1044152a457ed104f1f4b91, type: 2} + m_sharedMaterial: {fileID: 2164040, guid: 5302535af1044152a457ed104f1f4b91, 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: 1 + 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: 11400000, guid: de18700ae6836544d88ed0e4f3576ea0, + type: 2} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_outlineColor: + serializedVersion: 2 + rgba: 4278190080 + m_fontSize: 64 + m_fontSizeBase: 64 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 1 + m_textAlignment: 514 + 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_firstOverflowCharacterIndex: 13 + m_linkedTextComponent: {fileID: 0} + m_isLinkedTextComponent: 0 + m_isTextTruncated: 0 + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_ignoreRectMaskCulling: 0 + m_ignoreCulling: 1 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_VertexBufferAutoSizeReduction: 1 + m_firstVisibleCharacter: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 1.6469727, y: 0, z: 0, w: 0} + m_textInfo: + textComponent: {fileID: 1171580185} + characterCount: 23 + spriteCount: 0 + spaceCount: 3 + wordCount: 4 + linkCount: 0 + lineCount: 2 + pageCount: 1 + materialCount: 1 + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_spriteAnimator: {fileID: 0} + m_hasFontAssetChanged: 0 + m_subTextObjects: + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!222 &1171580186 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1171580183} + m_CullTransparentMesh: 0 --- !u!1 &1228133910 GameObject: m_ObjectHideFlags: 0 @@ -1766,6 +1923,7 @@ MonoBehaviour: - {fileID: 1523146265254250313, guid: 4ffda9f561fdff5408763d8e8bdc4ed6, type: 3} boundaries: {fileID: 9181995847428758509, guid: cd8f80a3dcff4954598e8b72fd740734, type: 3} + WarningText: {fileID: 1171580183} --- !u!4 &1228133912 Transform: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/WaypointRace.cs b/Assets/Scripts/WaypointRace.cs index 5883617..f659d97 100644 --- a/Assets/Scripts/WaypointRace.cs +++ b/Assets/Scripts/WaypointRace.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; +using TMPro; [System.Serializable] @@ -20,11 +21,13 @@ public class WaypointRace : MonoBehaviour public Waypoint groundedScript; public GameObject[] obstacleList; public GameObject boundaries; + public GameObject WarningText; private int selection = 0; RaycastHit hit; Vector3 lastLocation; + float wanringCountdown; void Awake() { @@ -49,12 +52,18 @@ public class WaypointRace : MonoBehaviour waypointPlacement(); countdown = Time.time; completionTime = 60; + WarningText.SetActive(false); } void Update() { + if(wanringCountdown + 5.0f < Time.time) + { + WarningText.SetActive(false); + } + if(script.finished == true) { @@ -192,6 +201,9 @@ public class WaypointRace : MonoBehaviour script.lives = 3; + WarningText.SetActive(true); + wanringCountdown = Time.time; + groundedScript.transform.position = new Vector3( Random.Range(-100*size, 100*size), Random.Range(2, 10), Random.Range(-100*size, 100*size));