Camera System halb fertig, wurde in letzter Unterrichtsstunde gemacht.

This commit is contained in:
Zinziel
2026-02-16 14:18:01 +01:00
parent 8daf2f25ec
commit 05d0638ebe
24 changed files with 2030 additions and 1453 deletions

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 10a0d1b128cd3b246ab50fa65a2019d4
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,73 @@
using Unity.VisualScripting;
using UnityEngine;
public class CameraSystem : MonoBehaviour
{
[SerializeField] private GameObject[] cams;
[SerializeField] private GameObject mainCam;
[SerializeField] private int currentCam;
[SerializeField] private KeyCode openCam;
[SerializeField] private bool camIsOpen;
[SerializeField] private float cdTimer;
[SerializeField] private float cdTime = 0.5f;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
for (int i = 0; i < cams.Length; i++) {
cams[i].SetActive(false);
}
mainCam.SetActive(true);
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(openCam)) {
camIsOpen = !camIsOpen;
ShowCam();
}
if (cdTimer <= 0) {
if (Input.GetAxis("Horizontal") > 0) {
cams[currentCam].SetActive(false);
currentCam = currentCam + 1;
if (currentCam >= cams.Length) {
currentCam = 0;
}
Go2Cam(currentCam);
cdTimer = cdTime;
}
else if (Input.GetAxis("Horizontal") < 0) {
cams[currentCam].SetActive(false);
currentCam = currentCam - 1;
if (currentCam < 0) {
currentCam = cams.Length - 1;
}
Go2Cam(currentCam);
cdTimer = cdTime;
}
}
else {
cdTimer -= Time.deltaTime;
}
}
private void ShowCam() {
if (camIsOpen) {
cams[currentCam].SetActive(true);
mainCam.SetActive(false);
}
else {
cams[currentCam].SetActive(false);
mainCam.SetActive(true);
}
}
private void Go2Cam(int progression) {
cams[currentCam].SetActive(false);
currentCam = progression;
ShowCam();
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: bc016bf314b3fa446a75c1810d0e5df6

View File

@@ -1,29 +0,0 @@
using UnityEngine;
public class DoorSystem : MonoBehaviour
{
[SerializeField] private GameObject[] doors;
[SerializeField] private GameObject[] doorSwitchers;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
}
// Update is called once per frame
void Update()
{
}
public bool DoorOpen() {
// Tür ist zu, dann zieh Energie ab, Gegner können nicht angereifen, man kann Schalter drücken um zu öffnen
// Tür ist offen, Angriff auf Spieler ist möglich, man kann auf Schalter drücken und zu machen
return true;
}
// Plan
// Script an Tür, damit es auf und zu geht, also hoch und runter, dabei wird es in Y Achse skaliert + Y Achse neu positioniert
// Wenn man auf Schalter neben der Tür tippt, dann betätigt man die Tür, aber es zieht Strom ab
}

View File

@@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: fe9a94abb4818624cbe981af6c2f18cd