added some stuff

This commit is contained in:
Wong Sui Bin 2023-01-24 21:51:46 +08:00
parent 9b69003715
commit 3dbf2f9010
520 changed files with 176780 additions and 2 deletions

View file

@ -0,0 +1,14 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Lemon.GenericLib.Utility {
public class DisableOnAwake : MonoBehaviour
{
private void Awake()
{
gameObject.SetActive(false);
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5dfb25ba3ec4f3b4c9842d81ea238e56
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,30 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
//future upgrades:
//upgrade this to read specific input without needing to set a unity input
//handle multiple input
//ahndle muliple input variations like left right, get key up, etc.
namespace Lemon.GenericLib.Utility
{
public class InputBasedTestingScript : MonoBehaviour
{
[SerializeField] private string inputKeyName;
public UnityEvent functionsToTest;
// Update is called once per frame
void Update()
{
if (Input.GetButtonDown(inputKeyName))
{
functionsToTest?.Invoke();
}
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 69302d519e9f40c4fa9c50e9bb87f438
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,47 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
namespace Lemon.GenericLib.Utility {
public class KeyCodeInputController : MonoBehaviour
{
[Header("controlls list")]
[SerializeField] private KeyCodeControll[] keyCodeControlls;
private void Update()
{
if (Input.anyKeyDown)
{
//CheckInit();
foreach (var controlls in keyCodeControlls)
{
if (Input.GetKeyDown(controlls.KeyCode))
{
controlls.InvokeKeyCodeFunction();
}
}
}
}
[System.Serializable]
private class KeyCodeControll
{
[SerializeField] private KeyCode keyCode;
[SerializeField] private UnityEvent InputFunctions;
public KeyCode KeyCode { get => keyCode; set => keyCode = value; }
public void InvokeKeyCodeFunction()
{
InputFunctions?.Invoke();
}
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 85106e56a76d0094b8198233c973020e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,28 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
namespace Lemon.GenericLib.Utility
{
public class RestartAndQuit : MonoBehaviour
{
public bool pressToQuit = false;
public bool pressToRestart = false;
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.R) && pressToRestart)
{
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
}
if (Input.GetKeyDown(KeyCode.Escape) && pressToQuit)
{
Application.Quit();
}
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c58e5fe732daf0144af01eba42dfda38
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: