Worked on new Controls, tried locals but got problems with assets - needfix

This commit is contained in:
Finnchen123
2024-09-02 20:47:25 +02:00
parent be0adf7eb6
commit 1a5cd50060
175 changed files with 17112 additions and 1284 deletions

View File

@@ -0,0 +1,89 @@
using System.Collections;
using System.Collections.Generic;
using Unity.Burst.Intrinsics;
using UnityEditor.Experimental.GraphView;
using UnityEngine;
using UnityEngine.Analytics;
using UnityEngine.Animations;
using UnityEngine.InputSystem;
public class Controls : MonoBehaviour
{
public float MOVEMENTSPEED = 10f;
public float SENSITIVITY = 10f;
public Vector2 movement;
public Vector2 rotation;
public bool isAirborne;
// Start is called before the first frame update
void Start()
{
movement = new Vector2();
rotation = new Vector2();
isAirborne = true;
}
// Update is called once per frame
void Update()
{
}
void FixedUpdate(){
applyInput();
if(Cursor.lockState == CursorLockMode.Locked){
GameObject.Find("Crosshair").transform.localScale = new Vector3(1,1,1);
}
else{
GameObject.Find("Crosshair").transform.localScale = new Vector3(0,0,0);
}
}
private void applyInput(){
//Do Cam manipulation according to input even if in air
Vector3 camManipulation = new Vector3(-rotation.y,0,0);
GameObject.Find("MainCamera").transform.Rotate(camManipulation * Time.deltaTime * SENSITIVITY);
//Directly rotate Player object so that movement works
Vector3 lookDirection = new Vector3(0, rotation.x, 0) * Time.deltaTime * SENSITIVITY;
gameObject.transform.Rotate(lookDirection);
if(isAirborne) return;
//Move Player object according to input and after rotation
Vector3 direction = new Vector3(movement.x, 0, movement.y) * Time.deltaTime * MOVEMENTSPEED;
gameObject.transform.Translate(direction);
}
void OnMove(InputValue direction){
movement = direction.Get<Vector2>();
}
void OnLook(InputValue direction){
rotation = direction.Get<Vector2>();
}
void OnFire(){
Debug.Log("Fired");
if(Cursor.lockState == CursorLockMode.Locked){
Cursor.lockState = CursorLockMode.None;
}
else{
Cursor.lockState = CursorLockMode.Locked;
}
}
void OnCollisionEnter(Collision col){
if(!isAirborne) return;
if(col.gameObject.name.ToLower().Contains("plattform")){
isAirborne = false;
}
}
void OnCollisionExit(Collision col){
if(isAirborne) return;
if(col.gameObject.name.ToLower().Contains("plattform")){
isAirborne = true;
}
}
}

View File

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

View File

@@ -0,0 +1,20 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DestroyableEntity : MonoBehaviour
{
protected int durability;
protected int maxDurability;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

View File

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

18
Assets/Scripts/Enemy.cs Normal file
View File

@@ -0,0 +1,18 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Enemy : InteractableEntity
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

View File

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

20
Assets/Scripts/Entity.cs Normal file
View File

@@ -0,0 +1,20 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Entity : MonoBehaviour
{
protected string displayName;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

View File

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

View File

@@ -0,0 +1,20 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class HarvestableEntity : DestroyableEntity
{
protected string harvestableItem;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

View File

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

View File

@@ -0,0 +1,18 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class InteractableEntity : Entity
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

View File

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

18
Assets/Scripts/NPC.cs Normal file
View File

@@ -0,0 +1,18 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NPC : InteractableEntity
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

View File

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

View File

@@ -0,0 +1,18 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ObjectGenerator : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

View File

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

18
Assets/Scripts/Player.cs Normal file
View File

@@ -0,0 +1,18 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Player : Entity
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

View File

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

18
Assets/Scripts/Stone.cs Normal file
View File

@@ -0,0 +1,18 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Stone : HarvestableEntity
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

View File

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

View File

@@ -0,0 +1,18 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class WorldGenerator : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

View File

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