2023-05-09 19:09:37 +02:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
// Kann sein das das nur für statische Objekte funktioniert
|
|
|
|
public class DimShift : MonoBehaviour
|
|
|
|
{
|
|
|
|
// 0 = inactive in Dimension 1
|
|
|
|
// 1 = active in Dimension 1
|
2023-06-18 17:38:50 +02:00
|
|
|
[SerializeField] private bool inFirstDim;
|
|
|
|
[SerializeField] private bool ShiftingEnabled;
|
|
|
|
|
2023-06-17 13:48:59 +02:00
|
|
|
|
|
|
|
AudioSource Audio1;
|
|
|
|
AudioReverbFilter Rev1;
|
|
|
|
AudioLowPassFilter lpf;
|
2023-05-11 15:55:30 +02:00
|
|
|
GameObject Dim1;
|
|
|
|
GameObject Dim2;
|
2023-06-18 13:37:19 +02:00
|
|
|
//remove if unwanted
|
|
|
|
private Animator animator;
|
2023-05-11 15:55:30 +02:00
|
|
|
|
2023-05-09 19:09:37 +02:00
|
|
|
void Start()
|
|
|
|
{
|
2023-05-11 15:55:30 +02:00
|
|
|
Dim1 = GameObject.Find("Dim1");
|
|
|
|
Dim2 = GameObject.Find("Dim2");
|
2023-06-17 13:48:59 +02:00
|
|
|
Audio1 = GameObject.Find("AudioController").GetComponent<AudioSource>();
|
|
|
|
Rev1 = GameObject.Find("AudioController").GetComponent<AudioReverbFilter>();
|
|
|
|
lpf = GameObject.Find("AudioController").GetComponent<AudioLowPassFilter>();
|
2023-06-18 13:37:19 +02:00
|
|
|
//remove if unwanted
|
|
|
|
animator = GetComponent<Animator>();
|
2023-05-09 19:09:37 +02:00
|
|
|
|
|
|
|
if (inFirstDim)
|
|
|
|
{
|
2023-05-11 15:55:30 +02:00
|
|
|
Dim1.SetActive(true);
|
|
|
|
Dim2.SetActive(false);
|
2023-06-17 13:48:59 +02:00
|
|
|
MusicDim1();
|
2023-05-09 19:09:37 +02:00
|
|
|
} else
|
|
|
|
{
|
2023-06-17 13:48:59 +02:00
|
|
|
Dim1.SetActive(false);
|
2023-05-11 15:55:30 +02:00
|
|
|
Dim2.SetActive(true);
|
2023-06-17 13:48:59 +02:00
|
|
|
MusicDim2();
|
2023-05-09 19:09:37 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Update()
|
|
|
|
{
|
2023-06-18 17:38:50 +02:00
|
|
|
if (Input.GetKeyDown(KeyCode.LeftShift)&&inFirstDim&&ShiftingEnabled)
|
2023-05-09 19:09:37 +02:00
|
|
|
{
|
2023-05-11 15:55:30 +02:00
|
|
|
Dim2.SetActive(true);
|
|
|
|
Dim1.SetActive(false);
|
2023-06-17 13:48:59 +02:00
|
|
|
MusicDim2();
|
2023-05-09 19:09:37 +02:00
|
|
|
inFirstDim = !inFirstDim;
|
2023-06-18 13:37:19 +02:00
|
|
|
//remove if unwanted
|
|
|
|
animator.SetTrigger("ShiftsDim");
|
2023-05-09 19:09:37 +02:00
|
|
|
} else
|
|
|
|
{
|
2023-06-18 17:38:50 +02:00
|
|
|
if (Input.GetKeyDown(KeyCode.LeftShift)&&!inFirstDim&&ShiftingEnabled)
|
2023-05-09 19:09:37 +02:00
|
|
|
{
|
2023-05-11 15:55:30 +02:00
|
|
|
Dim1.SetActive(true);
|
|
|
|
Dim2.SetActive(false);
|
2023-06-17 13:48:59 +02:00
|
|
|
MusicDim1();
|
2023-05-09 19:09:37 +02:00
|
|
|
inFirstDim = !inFirstDim;
|
2023-06-18 13:37:19 +02:00
|
|
|
//remove if unwanted
|
|
|
|
animator.SetTrigger("ShiftsDim");
|
2023-05-09 19:09:37 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-06-17 13:48:59 +02:00
|
|
|
|
|
|
|
void MusicDim1()
|
|
|
|
{
|
|
|
|
Rev1.enabled = false;
|
|
|
|
lpf.enabled = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void MusicDim2()
|
|
|
|
{
|
|
|
|
Rev1.enabled = true;
|
|
|
|
lpf.enabled = true;
|
|
|
|
}
|
2023-05-09 19:09:37 +02:00
|
|
|
}
|