diff --git a/Assets/Scenes/RC1 Levels/Jason's Level.unity b/Assets/Scenes/RC1 Levels/Jason's Level.unity index b5c8cb7..b6dd621 100644 --- a/Assets/Scenes/RC1 Levels/Jason's Level.unity +++ b/Assets/Scenes/RC1 Levels/Jason's Level.unity @@ -8744,7 +8744,7 @@ BoxCollider2D: m_IsTrigger: 1 m_UsedByEffector: 0 m_UsedByComposite: 0 - m_Offset: {x: 0.016304016, y: -0.040762305} + m_Offset: {x: -0.0043821335, y: -0.026972413} m_SpriteTilingProperty: border: {x: 0, y: 0, z: 0, w: 0} pivot: {x: 0.5, y: 0.5} @@ -8755,7 +8755,7 @@ BoxCollider2D: adaptiveTiling: 0 m_AutoTiling: 0 serializedVersion: 2 - m_Size: {x: 1.2771835, y: 1.1467445} + m_Size: {x: 1.5667706, y: 1.4914901} m_EdgeRadius: 0 --- !u!212 &1056180411 SpriteRenderer: @@ -37359,7 +37359,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!95 &1426395666 Animator: serializedVersion: 5 @@ -68655,7 +68655,7 @@ BoxCollider2D: m_IsTrigger: 1 m_UsedByEffector: 0 m_UsedByComposite: 0 - m_Offset: {x: 0, y: 0} + m_Offset: {x: -0.0034475327, y: -0.027579784} m_SpriteTilingProperty: border: {x: 0, y: 0, z: 0, w: 0} pivot: {x: 0.5, y: 0.5} @@ -68666,7 +68666,7 @@ BoxCollider2D: adaptiveTiling: 0 m_AutoTiling: 0 serializedVersion: 2 - m_Size: {x: 1, y: 1} + m_Size: {x: 1.5860691, y: 1.4964337} m_EdgeRadius: 0 --- !u!114 &2114044730 MonoBehaviour: diff --git a/Assets/Scenes/RC1 Levels/JasonLevel2.unity b/Assets/Scenes/RC1 Levels/JasonLevel2.unity index 0da3cc4..bd04cc8 100644 --- a/Assets/Scenes/RC1 Levels/JasonLevel2.unity +++ b/Assets/Scenes/RC1 Levels/JasonLevel2.unity @@ -753,7 +753,7 @@ BoxCollider2D: m_IsTrigger: 1 m_UsedByEffector: 0 m_UsedByComposite: 0 - m_Offset: {x: 0.016304016, y: -0.040762305} + m_Offset: {x: -0.014526367, y: -0.021143436} m_SpriteTilingProperty: border: {x: 0, y: 0, z: 0, w: 0} pivot: {x: 0.5, y: 0.5} @@ -764,7 +764,7 @@ BoxCollider2D: adaptiveTiling: 0 m_AutoTiling: 0 serializedVersion: 2 - m_Size: {x: 1.2771835, y: 1.1467445} + m_Size: {x: 1.6975899, y: 1.4998856} m_EdgeRadius: 0 --- !u!212 &77452158 SpriteRenderer: @@ -58137,7 +58137,7 @@ BoxCollider2D: m_IsTrigger: 1 m_UsedByEffector: 0 m_UsedByComposite: 0 - m_Offset: {x: 0, y: 0} + m_Offset: {x: -0.042040348, y: -0.0028026104} m_SpriteTilingProperty: border: {x: 0, y: 0, z: 0, w: 0} pivot: {x: 0.5, y: 0.5} @@ -58148,7 +58148,7 @@ BoxCollider2D: adaptiveTiling: 0 m_AutoTiling: 0 serializedVersion: 2 - m_Size: {x: 1, y: 1} + m_Size: {x: 1.622201, y: 1.4428277} m_EdgeRadius: 0 --- !u!212 &889575791 SpriteRenderer: diff --git a/Assets/Scripts/BossEnemyStageOne.cs b/Assets/Scripts/BossEnemyStageOne.cs index b3445fb..c9171af 100644 --- a/Assets/Scripts/BossEnemyStageOne.cs +++ b/Assets/Scripts/BossEnemyStageOne.cs @@ -4,6 +4,7 @@ public class BossEnemyStageOne : MonoBehaviour { + // Variable Declarations private float directionX; public float moveSpeed; private Rigidbody2D myRigidBody; @@ -13,6 +14,10 @@ public class BossEnemyStageOne : MonoBehaviour public BossHealthStageOne bossHealth; // Start is called before the first frame update + // Gets access to player's health script + // Gets access to the boss' health script + // Sets the boss' direction when starting level + // Gets the boss' rigidbody void Start() { localScale = transform.localScale; @@ -22,6 +27,9 @@ void Start() bossHealth = GameObject.FindGameObjectWithTag("Enemy").GetComponent(); } + // Allows the boss to take damage from metal crates + // Hurts the player if the boss and the player touch + // Changes the boss' direction when they touch a wall private void OnTriggerEnter2D(Collider2D collision) { if (collision.transform.CompareTag("Wall")) @@ -38,11 +46,13 @@ private void OnTriggerEnter2D(Collider2D collision) } } + // actually moves the boss private void FixedUpdate() { myRigidBody.velocity = new Vector2(directionX * moveSpeed, myRigidBody.velocity.y); } + // Flips the boss sprite when they switch directions void LateUpdate() { if (directionX > 0) @@ -63,6 +73,8 @@ void LateUpdate() FlipY(); } + + // Flips the enemy sprite when gravity is changed public void FlipY() { Vector3 scale = transform.localScale; diff --git a/Assets/Scripts/BossEnemyStageThree.cs b/Assets/Scripts/BossEnemyStageThree.cs index 16c52ef..a4feb29 100644 --- a/Assets/Scripts/BossEnemyStageThree.cs +++ b/Assets/Scripts/BossEnemyStageThree.cs @@ -4,6 +4,7 @@ public class BossEnemyStageThree : MonoBehaviour { + // Variable Declarations private float directionX; public float moveSpeed; private Rigidbody2D myRigidBody; @@ -13,6 +14,10 @@ public class BossEnemyStageThree : MonoBehaviour public BossHealthStageThree bossHealth; // Start is called before the first frame update + // Gets access to player's health script + // Gets access to the boss' health script + // Sets the boss' direction when starting level + // Gets the boss' rigidbody void Start() { localScale = transform.localScale; @@ -22,6 +27,9 @@ void Start() bossHealth = GameObject.FindGameObjectWithTag("Enemy").GetComponent(); } + // Allows the boss to take damage from metal crates + // Hurts the player if the boss and the player touch + // Changes the boss' direction when they touch a wall private void OnTriggerEnter2D(Collider2D collision) { if (collision.transform.CompareTag("Wall")) @@ -38,11 +46,13 @@ private void OnTriggerEnter2D(Collider2D collision) } } + // actually moves the boss private void FixedUpdate() { myRigidBody.velocity = new Vector2(directionX * moveSpeed, myRigidBody.velocity.y); } + // Flips the boss sprite when they switch directions void LateUpdate() { if (directionX > 0) @@ -63,6 +73,8 @@ void LateUpdate() FlipY(); } + + // Flips the enemy sprite when gravity is changed public void FlipY() { Vector3 scale = transform.localScale; diff --git a/Assets/Scripts/BossEnemyStageTwo.cs b/Assets/Scripts/BossEnemyStageTwo.cs index 72a4f29..7cb451f 100644 --- a/Assets/Scripts/BossEnemyStageTwo.cs +++ b/Assets/Scripts/BossEnemyStageTwo.cs @@ -4,6 +4,7 @@ public class BossEnemyStageTwo : MonoBehaviour { + // Variable Declarations private float directionX; public float moveSpeed; private Rigidbody2D myRigidBody; @@ -13,6 +14,10 @@ public class BossEnemyStageTwo : MonoBehaviour public BossHealthStageTwo bossHealth; // Start is called before the first frame update + // Gets access to player's health script + // Gets access to the boss' health script + // Sets the boss' direction when starting level + // Gets the boss' rigidbody void Start() { localScale = transform.localScale; @@ -22,6 +27,9 @@ void Start() bossHealth = GameObject.FindGameObjectWithTag("Enemy").GetComponent(); } + // Allows the boss to take damage from metal crates + // Hurts the player if the boss and the player touch + // Changes the boss' direction when they touch a wall private void OnTriggerEnter2D(Collider2D collision) { if (collision.transform.CompareTag("Wall")) @@ -38,11 +46,13 @@ private void OnTriggerEnter2D(Collider2D collision) } } + // actually moves the boss private void FixedUpdate() { myRigidBody.velocity = new Vector2(directionX * moveSpeed, myRigidBody.velocity.y); } + // Flips the boss sprite when they switch directions void LateUpdate() { if (directionX > 0) @@ -63,6 +73,8 @@ void LateUpdate() FlipY(); } + + // Flips the enemy sprite when gravity is changed public void FlipY() { Vector3 scale = transform.localScale; diff --git a/Assets/Scripts/BossHealthStageOne.cs b/Assets/Scripts/BossHealthStageOne.cs index f21d23f..ae2c313 100644 --- a/Assets/Scripts/BossHealthStageOne.cs +++ b/Assets/Scripts/BossHealthStageOne.cs @@ -5,8 +5,10 @@ public class BossHealthStageOne : MonoBehaviour { + // Variable Declarations public int maxHealth = 15; public int currentHealth; + // Array of boss health public Image[] Health; public Sprite fullHeart; public Sprite emptyHeart; @@ -16,6 +18,8 @@ public class BossHealthStageOne : MonoBehaviour // Start is called before the first frame update + // Sets current health to max health + // Gets access to exit level script void Start() { exitLevel = GameObject.FindGameObjectWithTag("Exit").GetComponent(); @@ -23,6 +27,7 @@ void Start() } // Update is called once per frame + // Keeps track of boss health void Update() { for (int index = 0; index < Health.Length; index++) @@ -47,6 +52,10 @@ void Update() } } + // Makes the boss take damage + // plays the hurt sound effect + // plays boss hurt animation + // Goes to the next level if boss reaches certain health public void TakeDamage(int amount) { currentHealth -= amount; @@ -60,6 +69,7 @@ public void TakeDamage(int amount) } } + // plays boss animations after a certain time public IEnumerator GoBackToNormalAnimation() { yield return new WaitForSeconds(1); diff --git a/Assets/Scripts/BossHealthStageThree.cs b/Assets/Scripts/BossHealthStageThree.cs index 58a61c4..f9518e3 100644 --- a/Assets/Scripts/BossHealthStageThree.cs +++ b/Assets/Scripts/BossHealthStageThree.cs @@ -5,8 +5,10 @@ public class BossHealthStageThree : MonoBehaviour { + // Variable Declarations public int maxHealth = 15; public int currentHealth; + // Array of boss health public Image[] Health; public Sprite fullHeart; public Sprite emptyHeart; @@ -16,6 +18,9 @@ public class BossHealthStageThree : MonoBehaviour // Start is called before the first frame update + // Start is called before the first frame update + // Sets current health to max health + // Gets access to exit level script void Start() { exitLevel = GameObject.FindGameObjectWithTag("Exit").GetComponent(); @@ -23,6 +28,7 @@ void Start() } // Update is called once per frame + // Keeps track of boss health void Update() { for (int index = 0; index < Health.Length; index++) @@ -47,6 +53,10 @@ void Update() } } + // Makes the boss take damage + // plays the hurt sound effect + // plays boss hurt animation + // Goes to the next level if boss reaches certain health public void TakeDamage(int amount) { currentHealth -= amount; @@ -60,6 +70,7 @@ public void TakeDamage(int amount) } } + // plays boss animations after a certain time public IEnumerator GoBackToNormalAnimation() { yield return new WaitForSeconds(1); diff --git a/Assets/Scripts/BossHealthStageTwo.cs b/Assets/Scripts/BossHealthStageTwo.cs index 282aa86..beff587 100644 --- a/Assets/Scripts/BossHealthStageTwo.cs +++ b/Assets/Scripts/BossHealthStageTwo.cs @@ -5,8 +5,10 @@ public class BossHealthStageTwo : MonoBehaviour { + // Variable Declarations public int maxHealth = 15; public int currentHealth; + // Array of boss health public Image[] Health; public Sprite fullHeart; public Sprite emptyHeart; @@ -16,6 +18,10 @@ public class BossHealthStageTwo : MonoBehaviour // Start is called before the first frame update + // Start is called before the first frame update + // Start is called before the first frame update + // Sets current health to max health + // Gets access to exit level script void Start() { exitLevel = GameObject.FindGameObjectWithTag("Exit").GetComponent(); @@ -23,6 +29,7 @@ void Start() } // Update is called once per frame + // Keeps track of boss health void Update() { for (int index = 0; index < Health.Length; index++) @@ -47,6 +54,10 @@ void Update() } } + // Makes the boss take damage + // plays the hurt sound effect + // plays boss hurt animation + // Goes to the next level if boss reaches certain health public void TakeDamage(int amount) { currentHealth -= amount; @@ -60,6 +71,7 @@ public void TakeDamage(int amount) } } + // plays boss animations after a certain time public IEnumerator GoBackToNormalAnimation() { yield return new WaitForSeconds(1); diff --git a/Assets/Scripts/FloorRobotEnemyScript.cs b/Assets/Scripts/FloorRobotEnemyScript.cs index 9646855..6c5ab06 100644 --- a/Assets/Scripts/FloorRobotEnemyScript.cs +++ b/Assets/Scripts/FloorRobotEnemyScript.cs @@ -4,6 +4,7 @@ public class FloorRobotEnemyScript : MonoBehaviour { + // Variable Declarations private float directionX; [SerializeField] public float moveSpeed = 1f; @@ -14,6 +15,9 @@ public class FloorRobotEnemyScript : MonoBehaviour private bool isOnGround; // Start is called before the first frame update + // Gets access to player health script + // Gets access to player's rigidbody + // sets enemy direction when starting level void Start() { localScale = transform.localScale; @@ -24,11 +28,13 @@ void Start() isOnGround = true; } + // Actually makes the enemy moves private void FixedUpdate() { myRigidBody.velocity = new Vector2(directionX * moveSpeed, myRigidBody.velocity.y); } + // Flips the enemy sprite when they switch directions void LateUpdate() { if (directionX > 0) @@ -39,6 +45,7 @@ void LateUpdate() FlipY(); } + // Actually flips the enemy sprite public void FlipX(bool isFlipped) { Vector3 scale = transform.localScale; @@ -56,6 +63,8 @@ public void FlipY() transform.localScale = scale; } + // Makes the player take damage when it touches player + // Make the robot enemy switch directions when it touches a wall private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.CompareTag("Wall")) @@ -64,23 +73,27 @@ private void OnTriggerEnter2D(Collider2D collision) playerHealth.TakeNormalDamage(1); } + // Switches enemy's direction when its touches a wall private void OnTriggerStay2D(Collider2D collision) { if (collision.gameObject.CompareTag("Wall")) directionX *= -1f; } + // When the enemy touches the ground, assign isOnGround variable to true private void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.CompareTag("Ground")) isOnGround = true; } + // Gets the enemy's position public Vector2 GetPosition() { return myRigidBody.position; } + // Flips the enemy sprite when gravity is changed public void EnemyGravityButtonFlip() { if (isOnGround == true) diff --git a/Assets/Scripts/FlyingRobotEnemyScript.cs b/Assets/Scripts/FlyingRobotEnemyScript.cs index 427a1d4..c2aa122 100644 --- a/Assets/Scripts/FlyingRobotEnemyScript.cs +++ b/Assets/Scripts/FlyingRobotEnemyScript.cs @@ -4,6 +4,7 @@ public class FlyingRobotEnemyScript : MonoBehaviour { + // Variable Declarations private float directionX; public float moveSpeed; private Rigidbody2D myRigidBody; @@ -12,6 +13,9 @@ public class FlyingRobotEnemyScript : MonoBehaviour public PlayerHealth playerHealth; // Start is called before the first frame update + // Gets access to player health script + // Gets access to player's rigidbody + // sets enemy direction when starting level void Start() { localScale = transform.localScale; @@ -21,6 +25,8 @@ void Start() } + // Makes the player take damage when it touches player + // Make the robot enemy switch directions when it touches a wall private void OnTriggerEnter2D(Collider2D collision) { if (collision.transform.CompareTag("Wall")) @@ -33,11 +39,13 @@ private void OnTriggerEnter2D(Collider2D collision) } } + // Actually makes the enemy moves private void FixedUpdate() { myRigidBody.velocity = new Vector2(directionX * moveSpeed, myRigidBody.velocity.y); } + // Flips the enemy sprite when they switch directions void LateUpdate() { if (directionX > 0) @@ -59,6 +67,7 @@ void LateUpdate() FlipY(); } + // Flips the enemy sprite when gravity is switched public void FlipY() { Vector3 scale = transform.localScale; diff --git a/Assets/Scripts/GravityBoots.cs b/Assets/Scripts/GravityBoots.cs index f88519c..883f5f4 100644 --- a/Assets/Scripts/GravityBoots.cs +++ b/Assets/Scripts/GravityBoots.cs @@ -6,10 +6,13 @@ public class GravityBoots : MonoBehaviour { + // Variable Declarations public PlayerMovement playerMovement; private bool inTriggerZone = false; public TMP_Text text; + // Allows the player to pick up gravity boots + // and removes the boots from the ground public void Update() { if (inTriggerZone == true && Input.GetKeyDown(KeyCode.E)) @@ -21,6 +24,7 @@ public void Update() } + // Reminds player that they can pick up the gravity boots private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.CompareTag("Player")) @@ -30,6 +34,7 @@ private void OnTriggerEnter2D(Collider2D collision) } } + // Gets rid of the text message when they go away from the gravity boots private void OnTriggerExit2D(Collider2D collision) { inTriggerZone = false; diff --git a/Assets/Scripts/Jason/ExitLevelScriptV3.cs b/Assets/Scripts/Jason/ExitLevelScriptV3.cs index b8cbda2..b79dbce 100644 --- a/Assets/Scripts/Jason/ExitLevelScriptV3.cs +++ b/Assets/Scripts/Jason/ExitLevelScriptV3.cs @@ -21,6 +21,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)) @@ -33,6 +34,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")) @@ -43,12 +46,15 @@ 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 lets the player go on to the next level + // while the fade transition plays public IEnumerator PlayerExitToNextLevel() { SceneTransition.SetBool("isDead", true); diff --git a/Assets/Scripts/Jason/GravitySwitch.cs b/Assets/Scripts/Jason/GravitySwitch.cs index e89f638..ea74ca8 100644 --- a/Assets/Scripts/Jason/GravitySwitch.cs +++ b/Assets/Scripts/Jason/GravitySwitch.cs @@ -7,6 +7,7 @@ public class GravitySwitch : MonoBehaviour { + // Variable declarations private bool inTriggerZone = false; public TMP_Text text; public UnityEvent onSwitch; @@ -14,11 +15,10 @@ public class GravitySwitch : MonoBehaviour [SerializeField] private bool switched = false; + // Gets the animator object to play the switch animation void Start() { thisAnimator = transform.gameObject.GetComponent(); - - } // Update is called once per frame @@ -41,6 +41,7 @@ void Update() } + // Reminds the player that they can press e to switch the lever private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.CompareTag("Player")) @@ -50,6 +51,7 @@ private void OnTriggerEnter2D(Collider2D collision) } } + // Gets rid of the message when the player leaves the switch's trigger zone private void OnTriggerExit2D(Collider2D collision) { inTriggerZone = false; diff --git a/Assets/Scripts/Jason/Key.cs b/Assets/Scripts/Jason/Key.cs index d9ef470..61a08a4 100644 --- a/Assets/Scripts/Jason/Key.cs +++ b/Assets/Scripts/Jason/Key.cs @@ -5,11 +5,14 @@ public class Key : MonoBehaviour { + // Variable Declarations public bool playerHasKey = false; private bool inTriggerZone = false; public TMP_Text text; public GameObject dialogueBox; + // Allows the player to pick up the key with the e key + // and plays a dialogue box when doing so public void Update() { if (inTriggerZone == true && Input.GetKeyDown(KeyCode.E)) @@ -22,6 +25,7 @@ public void Update() } + // Reminds the player with a message that they can pick the key with the e key private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.CompareTag("Player")) @@ -31,6 +35,7 @@ private void OnTriggerEnter2D(Collider2D collision) } } + // Gets rid of the on screen text message private void OnTriggerExit2D(Collider2D collision) { inTriggerZone = false; diff --git a/Assets/Scripts/Jason/KeyLock.cs b/Assets/Scripts/Jason/KeyLock.cs index 9a9cef9..ca8e9ce 100644 --- a/Assets/Scripts/Jason/KeyLock.cs +++ b/Assets/Scripts/Jason/KeyLock.cs @@ -5,16 +5,17 @@ public class KeyLock : MonoBehaviour { + // Variable Declarations public Key key; public ExitLevelScript exit; public bool doorIsLocked = true; private bool inTriggerZone = false; public TMP_Text text; - //public GameObject dialogueBox; public GameObject dialogueBox2; public GameObject realKey; // Start is called before the first frame update + // Allows this script to access the Key and Exit scripts. void Start() { key = GameObject.FindGameObjectWithTag("Key").GetComponent(); @@ -22,6 +23,8 @@ void Start() } // Update is called once per frame + // Allows the player to unlock the exit's lock with the key + // and plays a dialogue box when doing so void Update() { if (inTriggerZone == true && Input.GetKeyDown(KeyCode.E) && key.playerHasKey == true) @@ -35,6 +38,8 @@ void Update() } } + // Reminds the player that they can use the key to unlock the lock + // when pressing the e key private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.CompareTag("Player")) @@ -44,6 +49,7 @@ private void OnTriggerEnter2D(Collider2D collision) } } + // Gets rid of the text message when player leaves the lock's trigger zone private void OnTriggerExit2D(Collider2D collision) { inTriggerZone = false; diff --git a/Assets/Scripts/Jason/MovePistonRight.cs b/Assets/Scripts/Jason/MovePistonRight.cs index 48d877e..7e892aa 100644 --- a/Assets/Scripts/Jason/MovePistonRight.cs +++ b/Assets/Scripts/Jason/MovePistonRight.cs @@ -4,6 +4,7 @@ public class MovePistonRight : MonoBehaviour { + // Variable Declarations public float pistonSpeed = 1; public Rigidbody2D myRigidBody; [SerializeField] public bool open = false; @@ -11,10 +12,11 @@ public class MovePistonRight : MonoBehaviour // Start is called before the first frame update void Start() { - - } + } + // Determines when the piston should move right + // or go back to its original position void Update() { if(open) @@ -27,16 +29,19 @@ void Update() } } + // Adds a force that moves the piston right public void MovePiston() { myRigidBody.AddForce(transform.right * pistonSpeed, ForceMode2D.Impulse); } + // Adds a force that moves the piston left public void MovePistonBack() { myRigidBody.AddForce(-transform.right * pistonSpeed, ForceMode2D.Impulse); } + // Tells the open variable that it is open public void SetOpen(bool isOpen) { open = isOpen; diff --git a/Assets/Scripts/Jason/PistonTriggerZone.cs b/Assets/Scripts/Jason/PistonTriggerZone.cs index 8fa6271..c8ee335 100644 --- a/Assets/Scripts/Jason/PistonTriggerZone.cs +++ b/Assets/Scripts/Jason/PistonTriggerZone.cs @@ -5,6 +5,8 @@ public class PistonTriggerZone : MonoBehaviour { + // Ignores collision with any crates but + // will collide with pistons private void Start() { GameObject crate = GameObject.FindGameObjectWithTag("Object"); diff --git a/Assets/Scripts/PlayerHealth.cs b/Assets/Scripts/PlayerHealth.cs index 964482e..6fa6a4c 100644 --- a/Assets/Scripts/PlayerHealth.cs +++ b/Assets/Scripts/PlayerHealth.cs @@ -6,6 +6,7 @@ public class PlayerHealth : MonoBehaviour { + // Variable Declarations public Animator animator; public Animator SceneTransition; public PlayerMovement pm; @@ -22,6 +23,9 @@ public class PlayerHealth : MonoBehaviour public Rigidbody2D rb; // Start is called before the first frame update + // Starts levels with the right gravity + // assigns the maxhealth to current health + // Gets the player's rigidbody void Start() { startGravity = Physics2D.gravity; @@ -35,6 +39,11 @@ void Update() } + // Allows Player to take damage from robot enemies + // Stops the player when they die + // Plays normal death animation + // Stops the player walk sound effect + // Plays death sound effect public void TakeNormalDamage(int amount) { if (invincibility == false) @@ -57,6 +66,11 @@ public void TakeNormalDamage(int amount) } } + // Allows Player to take damage from exposed electrical wires + // Stops the player when they die + // Plays electrical death animation + // Stops the player walk sound effect + // Plays death sound effect public void TakeElectricalDamage(int amount) { if (invincibility == false) @@ -80,6 +94,11 @@ public void TakeElectricalDamage(int amount) } } + // Allows Player to take damage from lasers + // Stops the player when they die + // Plays laser death animation + // Stops the player walk sound effect + // Plays death sound effect public void TakeLaserDamage(int amount) { if (invincibility == false) @@ -102,7 +121,9 @@ public void TakeLaserDamage(int amount) } - + // Plays the fade transition + // Reloads the level + // and Respawns the player public IEnumerator PlayerRespawn() { yield return new WaitForSeconds(1);