Skip to content
Snippets Groups Projects
Commit 5e473c3e authored by Zeus-s's avatar Zeus-s
Browse files

feat: add cheat script

parent 74fe5c73
No related merge requests found
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class CheatMenu : MonoBehaviour
{
public GameObject cheatMenu;
public Button btn;
public InputField inputText;
public static bool isCheatOpened;
public static bool nodamage = false;
public static bool hitkill = false;
public static bool speed2x = false;
public static bool fullhppet = false;
public static bool motherlode = false;
public static bool killpet = false;
// Start is called before the first frame update
void Start()
{
btn.onClick.AddListener(GetInputOnClickHandler);
cheatMenu.SetActive(false);
isCheatOpened = false;
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.L)) {
if (isCheatOpened) {
ResumeGame();
} else {
OpenCheatMenu();
}
}
}
public void GetInputOnClickHandler() {
string cheatInput = inputText.text;
if (cheatInput == "1hitkill") {
hitkill = true;
} else if (cheatInput == "immortal") {
nodamage = true;
} else if (cheatInput == "kecepatanusainbolt") {
speed2x = true;
} else if (cheatInput == "fullhppet") {
fullhppet = true;
} else if (cheatInput == "motherlode") {
motherlode = true;
} else if (cheatInput == "killpet") {
killpet = true;
}
}
public void OpenCheatMenu() {
cheatMenu.SetActive(true);
Time.timeScale = 0f;
isCheatOpened = true;
}
public void ResumeGame() {
cheatMenu.SetActive(false);
Time.timeScale = 1f;
isCheatOpened = false;
}
}
fileFormatVersion: 2
guid: ffb016fd68072834bae3e00097d49897
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
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