Skip to content

Commit

Permalink
small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonHoangTran committed Apr 22, 2024
1 parent 6503a02 commit 6d19a4f
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 58 deletions.
2 changes: 1 addition & 1 deletion Assets/Scenes/RC1 Levels/RobbieLevel1.unity
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ Canvas:
m_AdditionalShaderChannelsFlag: 25
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
m_SortingOrder: 10
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!1 &162310254
GameObject:
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scenes/RC1 Levels/RobbieLevel2.unity
Original file line number Diff line number Diff line change
Expand Up @@ -22700,7 +22700,7 @@ Canvas:
m_AdditionalShaderChannelsFlag: 0
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
m_SortingOrder: 10
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!4 &733805310 stripped
Transform:
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scenes/RC1 Levels/RobbieLevel3.unity
Original file line number Diff line number Diff line change
Expand Up @@ -6868,7 +6868,7 @@ Canvas:
m_AdditionalShaderChannelsFlag: 0
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
m_SortingOrder: 10
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!1 &439775676
GameObject:
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scenes/RC1 Levels/SpencerLevel1.unity
Original file line number Diff line number Diff line change
Expand Up @@ -29145,7 +29145,7 @@ Canvas:
m_AdditionalShaderChannelsFlag: 0
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
m_SortingOrder: 6
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!1 &1950988326
GameObject:
Expand Down
8 changes: 8 additions & 0 deletions Assets/Scripts/Jason/EnterLevelScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@

public class EnterLevelScript : MonoBehaviour
{
// Variable declarations
public GameObject player;
public PlayerMovement playerMovement;
// Start is called before the first frame update
private MovingPlatform[] movingPlatforms;
private float[] platformSpeeds;


// Assigns moving platforms their speed when entering a level
// Disables player movement during entrance animation and
// Enables it when it is done
void Start()
{
movingPlatforms = (MovingPlatform[]) FindObjectsOfType(typeof(MovingPlatform));
Expand All @@ -22,6 +28,7 @@ void Start()
StartCoroutine(SetPlayerActive());
}

// Allows the player to move after the enter animation is done
public IEnumerator SetPlayerActive()
{
yield return new WaitForSeconds(1);
Expand All @@ -30,6 +37,7 @@ public IEnumerator SetPlayerActive()
}

// Update is called once per frame
// Assigns moving platforms their speeds during level
void Update()
{
if (!player.GetComponent<SpriteRenderer>().enabled || !BannerDialogue.hasShown)
Expand Down
8 changes: 7 additions & 1 deletion Assets/Scripts/Jason/ExitLevelScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

public class ExitLevelScript : MonoBehaviour
{
// Variable declarations
public Animator animator;
private bool inTriggerZone = false;
public TMP_Text text;
Expand All @@ -16,12 +17,14 @@ public class ExitLevelScript : MonoBehaviour
public PlayerMovement playerMovement;
public GameObject dialogueBox2;

// ALlows this script access the keylock script to know if it is unlocked
private void Start()
{
keyLock = GameObject.FindGameObjectWithTag("KeyLock").GetComponent<KeyLock>();

}

// Allows the player to press the e key to leave and go on to the next level
// if the player is in the exit triggerzone and the keylock is unlocked
private void Update()
{
if (inTriggerZone == true && Input.GetKeyDown(KeyCode.E) && keyLock.doorIsLocked == false)
Expand All @@ -37,6 +40,7 @@ private void Update()
}
}

// Reminds the Player that they can interact with the exit with a message
private void OnTriggerEnter2D(Collider2D collision)
{
if (collision.gameObject.CompareTag("Player"))
Expand All @@ -46,12 +50,14 @@ private void OnTriggerEnter2D(Collider2D collision)
}
}

// Gets rid of the message when the player leaves the exit's trigger zone
private void OnTriggerExit2D(Collider2D collision)
{
inTriggerZone = false;
text.text = " ";
}

// Triggers the fade transition and loads the next level
public IEnumerator PlayerExitToNextLevel()
{
SceneTransition.SetBool("isDead", true);
Expand Down
10 changes: 10 additions & 0 deletions Assets/Scripts/Jason/ExitLevelScriptV2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

public class ExitLevelScriptV2 : MonoBehaviour
{
// Variable declarations
public Animator animator;
private bool inTriggerZone = false;
public TMP_Text text;
Expand All @@ -19,6 +20,7 @@ private void Start()

}

// Allows the player to press the e key to leave and go on to the next level
private void Update()
{
if (inTriggerZone == true && Input.GetKeyDown(KeyCode.E))
Expand All @@ -31,6 +33,8 @@ private void Update()
}
}

// Reminds the Player that they can interact with the exit with a message
// and plays the exit doors opening animation
private void OnTriggerEnter2D(Collider2D collision)
{
if (collision.gameObject.CompareTag("Player"))
Expand All @@ -41,17 +45,21 @@ private void OnTriggerEnter2D(Collider2D collision)
}
}

// Gets rid of the message when the player leaves the exit's trigger zone
private void OnTriggerExit2D(Collider2D collision)
{
inTriggerZone = false;
text.text = " ";
}

// Method that allows the player to go on to the next level
// without disable the player for the cheat code
public void GoToNextLevel()
{
StartCoroutine(PlayerExitToNextLevel());
}

// Method that disables the player so that the exit animation can play
public void ExitLevel()
{
GameObject playerObject = GameObject.Find("Player");
Expand All @@ -61,6 +69,8 @@ public void ExitLevel()
StartCoroutine(PlayerExitToNextLevel());
}

// Method that lets the player go on to the next level
// while the fade transition plays
public IEnumerator PlayerExitToNextLevel()
{
SceneTransition.SetBool("isDead", true);
Expand Down
1 change: 1 addition & 0 deletions Assets/Scripts/Jason/ExitLevelScriptV3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

public class ExitLevelScriptV3 : MonoBehaviour
{
// Variable declarations
public Animator animator;
private bool inTriggerZone = false;
public TMP_Text text;
Expand Down
42 changes: 0 additions & 42 deletions Assets/Scripts/Jason/MovePistonLeft.cs

This file was deleted.

11 changes: 0 additions & 11 deletions Assets/Scripts/Jason/MovePistonLeft.cs.meta

This file was deleted.

0 comments on commit 6d19a4f

Please sign in to comment.