Skip to content
Snippets Groups Projects
Commit 4e232c92 authored by Nat10k's avatar Nat10k
Browse files

Merge branch 'main' into feat/menu

parents 94b58fba b9d36e93
Branches
Tags
No related merge requests found
...@@ -23,6 +23,7 @@ public class CheatManager : MonoBehaviour ...@@ -23,6 +23,7 @@ public class CheatManager : MonoBehaviour
PlayerHealth playerHealth; PlayerHealth playerHealth;
PlayerMovement playerMovement; PlayerMovement playerMovement;
PlayerShooting playerShooting; PlayerShooting playerShooting;
LevelManager levelManager;
// Orbs // Orbs
public GameObject increaseDamageOrbPrefab; // Increase Damage Orb public GameObject increaseDamageOrbPrefab; // Increase Damage Orb
...@@ -40,6 +41,7 @@ public class CheatManager : MonoBehaviour ...@@ -40,6 +41,7 @@ public class CheatManager : MonoBehaviour
playerHealth = GameObject.Find("Player").GetComponent<PlayerHealth>(); playerHealth = GameObject.Find("Player").GetComponent<PlayerHealth>();
playerMovement = GameObject.Find("Player").GetComponent<PlayerMovement>(); playerMovement = GameObject.Find("Player").GetComponent<PlayerMovement>();
playerShooting = GameObject.Find("Player").GetComponentInChildren<PlayerShooting>(); playerShooting = GameObject.Find("Player").GetComponentInChildren<PlayerShooting>();
levelManager = FindObjectOfType<LevelManager>();
} }
private void Update() private void Update()
...@@ -65,57 +67,52 @@ public class CheatManager : MonoBehaviour ...@@ -65,57 +67,52 @@ public class CheatManager : MonoBehaviour
// Activate cheats based on text input // Activate cheats based on text input
if (textInput == "NODAMAGE") if (textInput == "NODAMAGE")
{ {
ResetInputField();
ActivateNoDamage(); ActivateNoDamage();
// Reset the input field text
inputField.text = "";
// Close the input field
hud.CloseInput();
return; return;
} }
if (textInput == "ONEHITKILL") if (textInput == "ONEHITKILL")
{ {
ResetInputField();
ActivateOneHitKill(); ActivateOneHitKill();
// Reset the input field text
inputField.text = "";
// Close the input field
hud.CloseInput();
return; return;
} }
if (textInput == "XTWOSPEED") if (textInput == "XTWOSPEED")
{ {
ResetInputField();
ActivateXTwoSpeed(); ActivateXTwoSpeed();
// Reset the input field text
inputField.text = "";
// Close the input field
hud.CloseInput();
return; return;
} }
if (textInput == "GETORB") if (textInput == "GETORB")
{ {
ResetInputField();
ActivateGetRandomOrb(); ActivateGetRandomOrb();
// Reset the input field text return;
inputField.text = ""; }
if (textInput == "SKIPLEVEL")
// Close the input field {
hud.CloseInput(); ResetInputField();
ActivateSkipLevel();
return; return;
} }
if (textInput == "RESETCHEATS") if (textInput == "RESETCHEATS")
{ {
ResetInputField();
ActivateReset(); ActivateReset();
// Reset the input field text
inputField.text = "";
// Close the input field
hud.CloseInput();
return; return;
} }
return; return;
} }
private void ResetInputField()
{
// Reset the input field text
inputField.text = "";
// Close the input field
hud.CloseInput();
}
private void ActivateNoDamage() private void ActivateNoDamage()
{ {
playerHealth.SetCheatNoDamage(true); playerHealth.SetCheatNoDamage(true);
...@@ -168,6 +165,14 @@ public class CheatManager : MonoBehaviour ...@@ -168,6 +165,14 @@ public class CheatManager : MonoBehaviour
} }
hud.OpenPanel("Get Random Orb Cheat Activated!"); hud.OpenPanel("Get Random Orb Cheat Activated!");
cheats[(int)CheatsType.GETORB] = true;
}
private void ActivateSkipLevel()
{
levelManager.AdvanceLevel();
hud.OpenPanel("Skip Level Cheat Activated!");
cheats[(int)CheatsType.SKIPLEVEL] = true;
} }
private void ActivateReset() private void ActivateReset()
......
...@@ -35,9 +35,9 @@ public class IncreaseSpeedOrbs : Orbs ...@@ -35,9 +35,9 @@ public class IncreaseSpeedOrbs : Orbs
public override void ApplyOrbEffect() public override void ApplyOrbEffect()
{ {
Debug.Log("APPLY");
isEffectActive = true; isEffectActive = true;
playerMovement.speed = originalSpeed + originalSpeed * speedMultiplier; playerMovement.speed = originalSpeed + originalSpeed * speedMultiplier;
playerMovement.prevSpeed = playerMovement.speed;
// Disable the child objects of the orb // Disable the child objects of the orb
foreach (Transform child in transform) foreach (Transform child in transform)
...@@ -71,8 +71,8 @@ public class IncreaseSpeedOrbs : Orbs ...@@ -71,8 +71,8 @@ public class IncreaseSpeedOrbs : Orbs
// If the current time is past the end time and the game object is not being destroyed, reset the speed // If the current time is past the end time and the game object is not being destroyed, reset the speed
if (Time.time >= endTime && !isDestroying) if (Time.time >= endTime && !isDestroying)
{ {
Debug.Log("RESET AND DESTROY");
playerMovement.speed = originalSpeed; playerMovement.speed = originalSpeed;
playerMovement.prevSpeed = originalSpeed;
isEffectActive = false; // Set isEffectActive to false when the speed is reset isEffectActive = false; // Set isEffectActive to false when the speed is reset
isDestroying = true; isDestroying = true;
Destroy(gameObject); Destroy(gameObject);
......
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