new input actions, basic onmove function that logs input values

This commit is contained in:
2026-02-16 15:02:20 +01:00
parent 5a4f14ebe0
commit 227f8bde40
3810 changed files with 314088 additions and 7620 deletions

View File

@@ -0,0 +1,13 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ExitGame : MonoBehaviour
{
private void Update() {
if (Input.GetKey("escape")) {
Debug.Log("Application is quitting!!");
Application.Quit();
}
}
}

View File

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

View File

@@ -0,0 +1,26 @@
using UnityEngine;
using TMPro;
public class FpsCounter : MonoBehaviour
{
public TextMeshProUGUI fpsText;
private float pollingTime = 0.5f;
private float time;
private int frameCount;
void Update()
{
time += Time.deltaTime;
frameCount++;
if(time >= pollingTime) {
float frameRate = frameCount / time;
frameRate = Mathf.Round(frameRate * 100) / 100;
fpsText.text = frameRate.ToString() + " Fps";
time -= pollingTime;
frameCount = 0;
}
}
}

View File

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

View File

@@ -0,0 +1,9 @@
using UnityEngine;
using UnityEngine.SceneManagement;
public class MainMenu : MonoBehaviour
{
public void PlayGame() {
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
}
}

View File

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

View File

@@ -0,0 +1,11 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MainMenuQuit : MonoBehaviour
{
public void QuitGame() {
Debug.Log("Application is quitting!!");
Application.Quit();
}
}

View File

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

View File

@@ -0,0 +1,62 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.UI;
public class OptionMenu : MonoBehaviour
{
//Resolution
Resolution[] resolutions;
public Dropdown resolutionDropdown;
private void Start() {
resolutions = Screen.resolutions;
resolutionDropdown.ClearOptions();
List<string> options = new List<string>();
int currentResIndex = 0;
for (int i = 0; i < resolutions.Length; i++) {
string option = resolutions[i].width + " x " + resolutions[i].height;
options.Add(option);
if(resolutions[i].width == Screen.currentResolution.width && resolutions[i].height == Screen.currentResolution.height) {
currentResIndex = i;
}
}
resolutionDropdown.AddOptions(options);
resolutionDropdown.value = currentResIndex;
resolutionDropdown.RefreshShownValue();
}
public void setResolution(int resolutionIndex) {
Resolution resolution = resolutions[resolutionIndex];
Screen.SetResolution(resolution.width, resolution.height, Screen.fullScreen);
}
//Audio
public AudioMixer mixer;
public void SetMainVolume(float mainVolume) {
mixer.SetFloat("mainVolume", mainVolume);
}
public void SetMusicVolume(float musicVolume) {
mixer.SetFloat("musicVolume", musicVolume);
}
public void SetSfxVolume(float sfxVolume) {
mixer.SetFloat("sfxVolume", sfxVolume);
}
//Quality
public void setQuality(int qualityIndex) {
QualitySettings.SetQualityLevel(qualityIndex);
}
//Fullscreen
public void setFullscreen(bool isFullscreen) {
Screen.fullScreen = isFullscreen;
}
}

View File

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

View File

@@ -0,0 +1,24 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
public class PlayerMovement : MonoBehaviour
{
[SerializeField] private CharacterController controller;
[SerializeField] private float speed;
private Vector2 _moveDirection;
private void Awake()
{
controller = GetComponent<CharacterController>();
}
public void OnMove(InputAction.CallbackContext context)
{
_moveDirection = context.ReadValue<Vector2>();
Debug.Log("direction: " + _moveDirection);
}
}

View File

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