Skip to content
Snippets Groups Projects

Skip Level Cheat

Merged Bill Clinton requested to merge feat/cheats-and-orbs into main
Compare and
1 file
+ 30
25
Preferences
Compare changes
@@ -23,6 +23,7 @@ public class CheatManager : MonoBehaviour
PlayerHealth playerHealth;
PlayerMovement playerMovement;
PlayerShooting playerShooting;
LevelManager levelManager;
// Orbs
public GameObject increaseDamageOrbPrefab; // Increase Damage Orb
@@ -40,6 +41,7 @@ public class CheatManager : MonoBehaviour
playerHealth = GameObject.Find("Player").GetComponent<PlayerHealth>();
playerMovement = GameObject.Find("Player").GetComponent<PlayerMovement>();
playerShooting = GameObject.Find("Player").GetComponentInChildren<PlayerShooting>();
levelManager = FindObjectOfType<LevelManager>();
}
private void Update()
@@ -65,57 +67,52 @@ public class CheatManager : MonoBehaviour
// Activate cheats based on text input
if (textInput == "NODAMAGE")
{
ResetInputField();
ActivateNoDamage();
// Reset the input field text
inputField.text = "";
// Close the input field
hud.CloseInput();
return;
}
if (textInput == "ONEHITKILL")
{
ResetInputField();
ActivateOneHitKill();
// Reset the input field text
inputField.text = "";
// Close the input field
hud.CloseInput();
return;
}
if (textInput == "XTWOSPEED")
{
ResetInputField();
ActivateXTwoSpeed();
// Reset the input field text
inputField.text = "";
// Close the input field
hud.CloseInput();
return;
}
if (textInput == "GETORB")
{
ResetInputField();
ActivateGetRandomOrb();
// Reset the input field text
inputField.text = "";
// Close the input field
hud.CloseInput();
return;
}
if (textInput == "SKIPLEVEL")
{
ResetInputField();
ActivateSkipLevel();
return;
}
if (textInput == "RESETCHEATS")
{
ResetInputField();
ActivateReset();
// Reset the input field text
inputField.text = "";
// Close the input field
hud.CloseInput();
return;
}
return;
}
private void ResetInputField()
{
// Reset the input field text
inputField.text = "";
// Close the input field
hud.CloseInput();
}
private void ActivateNoDamage()
{
playerHealth.SetCheatNoDamage(true);
@@ -168,6 +165,14 @@ public class CheatManager : MonoBehaviour
}
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()