Höhlen-Level und Änderungen an Skripten

This commit is contained in:
Maximilian Wagner
2023-06-21 16:13:04 +02:00
parent be62ab1315
commit 2fb5a4191d
39 changed files with 223008 additions and 9113 deletions

View File

@@ -1,6 +1,3 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

View File

@@ -0,0 +1,26 @@
using UnityEngine;
using UnityEngine.SceneManagement;
public class ChangeToNextScene : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
private void OnTriggerEnter2D(Collider2D other)
{
if (other.gameObject.CompareTag("Player"))
{
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex+1);
}
}
}

View File

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

View File

@@ -8,6 +8,13 @@ public class DimShiftBlockable : MonoBehaviour
private GameObject dim2;
private LinkedList<GameObject> collisions = new LinkedList<GameObject>();
AudioReverbFilter Rev1;
AudioLowPassFilter lpf;
GameObject Dim1;
GameObject Dim2;
private Animator animator;
void Start()
{
@@ -16,13 +23,23 @@ public class DimShiftBlockable : MonoBehaviour
dim1.SetActive(true);
dim2.SetActive(false);
Rev1 = GameObject.Find("AudioController").GetComponent<AudioReverbFilter>();
lpf = GameObject.Find("AudioController").GetComponent<AudioLowPassFilter>();
Rev1.enabled = false;
lpf.enabled = false;
animator = GetComponent<Animator>();
}
void Update()
{
if (Input.GetKeyDown(KeyCode.LeftShift) && CanSwitchDims())
{ // CanSwitchDims ist rel. "teuer", wird aber nur ausgeführt wenn die erste condition true ergibt
animator.SetTrigger("ShiftsDim");
ChangeDim();
MusicSwitch();
}
}
@@ -46,6 +63,12 @@ public class DimShiftBlockable : MonoBehaviour
dim1.SetActive(!dim1.activeSelf);
dim2.SetActive(!dim2.activeSelf);
}
void MusicSwitch()
{
Rev1.enabled = !Rev1.enabled;
lpf.enabled = !lpf.enabled;
}
private void OnTriggerEnter2D(Collider2D other)
{

View File

@@ -2,34 +2,33 @@ using UnityEngine;
public class FallingDetection : MonoBehaviour
{
public GameObject _LevelManager1;
private CharController script1;
bool grounded;
private Rigidbody2D playerRigidbody;
public bool isFalling;
private Animator animator;
public int counter = 0;
private CharController charController;
private Rigidbody2D playerRigidbody;
private bool isFalling;
private Animator animator;
private int counter = 0;
private void Start()
{
animator = GetComponent<Animator>();
playerRigidbody = GetComponent<Rigidbody2D>();
}
{
animator = GetComponent<Animator>();
playerRigidbody = GetComponent<Rigidbody2D>();
charController = gameObject.GetComponent<CharController>();
}
private void Update()
{
script1 = _LevelManager1.GetComponent<CharController>();
grounded= script1.grounded;
Vector3 velocity = playerRigidbody.velocity;
if (!grounded && velocity.y < -0.1f){
if(counter++>90||isFalling){
isFalling = true;
animator.SetBool("IsFalling", true);
counter = 0;}
} else {
isFalling = false;
counter = 0;
animator.SetBool("IsFalling", false);}
}
Vector3 velocity = playerRigidbody.velocity;
if (!charController.grounded && velocity.y < -0.1f) {
if (isFalling || counter++>90) {
isFalling = true;
animator.SetBool("IsFalling", true);
counter = 0;
}
} else {
isFalling = false;
counter = 0;
animator.SetBool("IsFalling", false);
}
}
}