Added all the other GhostSystem Scripts

This commit is contained in:
Thorbjoern
2025-05-26 01:23:52 +02:00
parent e5bca03433
commit 3ec28d4bc5
30 changed files with 1638 additions and 149 deletions
+44
View File
@@ -0,0 +1,44 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DateSelector : MonoBehaviour
{
public int selectedYear;
public int selectedMonth;
public int selectedDay;
public int selectedHour;
public int selectedMinute;
public void SetYear(int yearIndex)
{
selectedYear = yearIndex; // Achtung: ggf. +Offset je nach Dropdown-Inhalt
}
public void SetMonth(int monthIndex)
{
selectedMonth = monthIndex + 1; // Januar = 0 in Dropdown → Monat = 1
}
public void SetDay(int dayIndex)
{
selectedDay = dayIndex + 1; // 131
}
public void SetHour(int hourIndex)
{
selectedHour = hourIndex; // 023
}
public void SetMinute(int minuteIndex)
{
selectedMinute = minuteIndex; // 059
}
public DateTime selectedDateTime()
{
DateTime dateAndTime = new DateTime(selectedYear, selectedMonth, selectedDay, selectedHour, selectedMinute, 0, DateTimeKind.Utc);
return dateAndTime;
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 5912b0e3f147f7a47b85ed9c539c7ff9
+18 -5
View File
@@ -1,3 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@@ -5,29 +6,41 @@ using UnityEngine;
public class RoomManager : MonoBehaviour
{
public RoomPrefs myRoom;
public string sceneId;
public List<GameObject> doors;
public List<GameObject> furnitures;
public List<GameObject> portals;
public List<GameObject> enemies;
public static event Action<string> OnSceneIdReady; // um das Replay erst auszulösen, wenn die SceneId da ist, die nun über die RoomPrefs festgelegt wird.
public void Awake()
{
if (!myRoom.doors && myRoom.furniture && !myRoom.portals && !myRoom.enemies) return;
if (myRoom == null)
{
Debug.LogError("RoomPrefs is not assigned in RoomManager.");
return;
}
//if (!myRoom.doors && myRoom.furniture && !myRoom.portals && !myRoom.enemies) return;
if (myRoom.doors)
{
foreach (GameObject door in doors) door.SetActive(true);
}
if (!myRoom.furniture)
{
foreach(GameObject f in furnitures) f.SetActive(false);
foreach (GameObject f in furnitures) f.SetActive(false);
}
if (myRoom.portals)
{
foreach(GameObject portal in portals) portal.SetActive(true);
foreach (GameObject portal in portals) portal.SetActive(true);
}
if (myRoom.enemies)
{
foreach ( GameObject enemy in enemies) enemy.SetActive(true);
foreach (GameObject enemy in enemies) enemy.SetActive(true);
}
sceneId = myRoom.sceneId;
OnSceneIdReady?.Invoke(sceneId);
}
}
}