Skip to content

Commit

Permalink
All screen transitions done!
Browse files Browse the repository at this point in the history
  • Loading branch information
payalnk committed Mar 18, 2023
1 parent 867bae1 commit 39acba3
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
Binary file modified .DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class FieldOfView : MonoBehaviour
{
Expand Down Expand Up @@ -43,6 +44,7 @@ private void LateUpdate()
vertex = raycastHit2D.point;
if(raycastHit2D.collider.tag == "Player") {
Debug.Log("Player Detected. Game Over!");
changeToGameOverScreen();
}
}

Expand Down Expand Up @@ -85,4 +87,8 @@ public static Vector3 GetVectorFromAngle(float angle)
float angleRad = angle * (Mathf.PI/180f);
return new Vector3(Mathf.Cos(angleRad), Mathf.Sin(angleRad));
}

public void changeToGameOverScreen(){
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
}
}
6 changes: 6 additions & 0 deletions Assets/ExitGame.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class ExitGame : MonoBehaviour
{
Expand All @@ -19,6 +20,11 @@ void Update()
void OnTriggerEnter2D(Collider2D other){
if(other.CompareTag("Player")){
Debug.Log("Player finished game!");
changeToFinalScreen();
}
}

public void changeToFinalScreen(){
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 2);
}
}
8 changes: 4 additions & 4 deletions UserSettings/EditorUserSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ EditorUserSettings:
value: 5a09005053500f080c5c0a2142745c441215482e292d77342b7d4f6bb2b86d6a
flags: 0
RecentlyUsedSceneGuid-1:
value: 515250075c0c595e5f5a5e71122159444e4e4a2f7a7d7f602f284d66b4b76661
value: 520301025c535d095d5d5b7041770e441216487d287a7e322c7d4b36bbb3606c
flags: 0
RecentlyUsedSceneGuid-2:
value: 520301025c535d095d5d5b7041770e441216487d287a7e322c7d4b36bbb3606c
value: 5b52560352005f03555b547a4577084214161a7f7a7071617d7a186bb2e3673a
flags: 0
RecentlyUsedSceneGuid-3:
value: 500406545d02085d5c5a087711770a14424f4c2c287b25342c7a1f31b7b7676a
value: 515250075c0c595e5f5a5e71122159444e4e4a2f7a7d7f602f284d66b4b76661
flags: 0
RecentlyUsedSceneGuid-4:
value: 5b52560352005f03555b547a4577084214161a7f7a7071617d7a186bb2e3673a
value: 500406545d02085d5c5a087711770a14424f4c2c287b25342c7a1f31b7b7676a
flags: 0
vcSharedLogLevel:
value: 0d5e400f0650
Expand Down

0 comments on commit 39acba3

Please sign in to comment.