The fucking 3rd time i had to upload this project to git
This commit is contained in:
60
Assets/DebugConsole/Scripts/Commands/PlayerCommands.cs
Normal file
60
Assets/DebugConsole/Scripts/Commands/PlayerCommands.cs
Normal file
@ -0,0 +1,60 @@
|
||||
// using Player.Interactions;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Scripting;
|
||||
using Player.Information;
|
||||
using Player.Movement;
|
||||
|
||||
namespace IngameDebugConsole.Commands
|
||||
{
|
||||
public class PlayerCommands
|
||||
{
|
||||
[ConsoleMethod("player.jetpack", "Sets Jetpack Active State")]
|
||||
[Preserve]
|
||||
public static void PlayerJetpack(bool boolValue)
|
||||
{
|
||||
var player = GameObject.Find("Player");
|
||||
if (player != null)
|
||||
{
|
||||
// set jetpack component active
|
||||
player.GetComponent<PlayerStats>().jetpackEnabled = boolValue;
|
||||
Debug.Log("Jetpack set to " + boolValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("Player not found");
|
||||
}
|
||||
}
|
||||
|
||||
[ConsoleMethod("player.grapple", "Sets Grapple Active State")]
|
||||
[Preserve]
|
||||
public static void PlayerGrapple(bool boolValue)
|
||||
{
|
||||
var player = GameObject.Find("Player");
|
||||
if (player != null)
|
||||
{
|
||||
player.GetComponent<PlayerStats>().grappleEnabled = boolValue;
|
||||
Debug.Log("Grapple set to " + boolValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("Player not found");
|
||||
}
|
||||
}
|
||||
[ConsoleMethod("player.sensitivity", "Sets Mouse Sensitivity")]
|
||||
[Preserve]
|
||||
public static void PlayerSensitivity(float sensitivity)
|
||||
{
|
||||
var player = GameObject.Find("Player");
|
||||
if (player != null)
|
||||
{
|
||||
Camera.main.GetComponent<MouseLook>().mouseSensitivity = sensitivity;
|
||||
PlayerPrefs.SetFloat("Sensitivity", sensitivity);
|
||||
Debug.Log("Mouse Sensitivity set to " + sensitivity);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("Player not found");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ed03242f9d95d614b8dbb178cc9ce59b
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
65
Assets/DebugConsole/Scripts/Commands/SceneCommands.cs
Normal file
65
Assets/DebugConsole/Scripts/Commands/SceneCommands.cs
Normal file
@ -0,0 +1,65 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.Scripting;
|
||||
|
||||
namespace IngameDebugConsole.Commands
|
||||
{
|
||||
public class SceneCommands
|
||||
{
|
||||
[ConsoleMethod("scene.load", "Loads a scene")]
|
||||
[Preserve]
|
||||
public static void LoadScene(string sceneName)
|
||||
{
|
||||
LoadSceneInternal(sceneName, false, LoadSceneMode.Single);
|
||||
}
|
||||
|
||||
[ConsoleMethod("scene.load", "Loads a scene")]
|
||||
[Preserve]
|
||||
public static void LoadScene(string sceneName, LoadSceneMode mode)
|
||||
{
|
||||
LoadSceneInternal(sceneName, false, mode);
|
||||
}
|
||||
|
||||
[ConsoleMethod("scene.loadasync", "Loads a scene asynchronously")]
|
||||
[Preserve]
|
||||
public static void LoadSceneAsync(string sceneName)
|
||||
{
|
||||
LoadSceneInternal(sceneName, true, LoadSceneMode.Single);
|
||||
}
|
||||
|
||||
[ConsoleMethod("scene.loadasync", "Loads a scene asynchronously")]
|
||||
[Preserve]
|
||||
public static void LoadSceneAsync(string sceneName, LoadSceneMode mode)
|
||||
{
|
||||
LoadSceneInternal(sceneName, true, mode);
|
||||
}
|
||||
|
||||
private static void LoadSceneInternal(string sceneName, bool isAsync, LoadSceneMode mode)
|
||||
{
|
||||
if (SceneManager.GetSceneByName(sceneName).IsValid())
|
||||
{
|
||||
Debug.Log("Scene " + sceneName + " is already loaded");
|
||||
return;
|
||||
}
|
||||
|
||||
if (isAsync)
|
||||
SceneManager.LoadSceneAsync(sceneName, mode);
|
||||
else
|
||||
SceneManager.LoadScene(sceneName, mode);
|
||||
}
|
||||
|
||||
[ConsoleMethod("scene.unload", "Unloads a scene")]
|
||||
[Preserve]
|
||||
public static void UnloadScene(string sceneName)
|
||||
{
|
||||
SceneManager.UnloadSceneAsync(sceneName);
|
||||
}
|
||||
|
||||
[ConsoleMethod("scene.restart", "Restarts the active scene")]
|
||||
[Preserve]
|
||||
public static void RestartScene()
|
||||
{
|
||||
SceneManager.LoadScene(SceneManager.GetActiveScene().name, LoadSceneMode.Single);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 73f6112b4a7e5624583195aa8af9e548
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
22
Assets/DebugConsole/Scripts/Commands/TimeCommands.cs
Normal file
22
Assets/DebugConsole/Scripts/Commands/TimeCommands.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Scripting;
|
||||
|
||||
namespace IngameDebugConsole.Commands
|
||||
{
|
||||
public class TimeCommands
|
||||
{
|
||||
[ConsoleMethod("time.scale", "Sets the Time.timeScale value")]
|
||||
[Preserve]
|
||||
public static void SetTimeScale(float value)
|
||||
{
|
||||
Time.timeScale = Mathf.Max(value, 0f);
|
||||
}
|
||||
|
||||
[ConsoleMethod("time.scale", "Returns the current Time.timeScale value")]
|
||||
[Preserve]
|
||||
public static float GetTimeScale()
|
||||
{
|
||||
return Time.timeScale;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c5061e3b82c469c4d9ee288d4ec03d5e
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user