Partiially working Timeslot-change and Heat Reciever on Targets

This commit is contained in:
Thorbjoern
2025-07-19 13:02:31 +02:00
parent 13cd053279
commit 9fd840a8f8
43 changed files with 2571 additions and 263 deletions
@@ -24,12 +24,11 @@ public class EyeTrackingCollisionPoints : MonoBehaviour
if ( hitPoint != null && Physics.Raycast(transform.position, rayCastDirection, out hit, rayDistance, layersToInclude))
{
hitPoint.transform.position = new Vector3(hit.point.x, hit.point.y, hit.point.z);
GameObject hitObject = hit.collider.gameObject;
if (hit.collider.GetType() == typeof(MeshCollider))
if ( hitObject.GetComponent<RecieveHeat>() != null)
{
hitObject.GetComponent<QuadScript>().addHitPoint(hit.textureCoord.x, hit.textureCoord.y);
hitObject.GetComponent<RecieveHeat>().AddHeat(0.02f);
}
}
}
@@ -61,7 +61,7 @@ namespace GhostSystem
supabaseReady = true;
}
private void HandleSceneIdReady(string id, List<GameObject> doors)
private void HandleSceneIdReady(string id, List<GameObject> doors, List<RecieveHeat> targets)
{
SceneId = id;
sceneIdReady = true;
@@ -50,6 +50,7 @@ namespace GhostSystem
private bool sceneIdReady = false;
private string loadedSceneId;
private int doorCount;
private List<RecieveHeat> heatTargets;
private DateTime latestLoadedTimestamp;
@@ -78,7 +79,7 @@ namespace GhostSystem
TryInitializeReplay();
}
private void HandleSceneIdReady(string id, List<GameObject> doors)
private void HandleSceneIdReady(string id, List<GameObject> doors, List<RecieveHeat> targets)
{
sceneIdReady = true;
loadedSceneId = id;
@@ -90,6 +91,7 @@ namespace GhostSystem
TrackedObjects.Add(trackedObjectBinding);
doorCount++;
}
heatTargets = targets;
TryInitializeReplay();
}
@@ -243,7 +245,13 @@ namespace GhostSystem
if (playbackTime > totalDuration)
{
if (Loop)
{
playbackTime = 0f;
foreach (RecieveHeat target in heatTargets)
{
target.SetHeat(0);
}
}
else
isPlaying = false;
}
@@ -18,8 +18,9 @@ public class FillDopdownWithScenes : MonoBehaviour
dropdown.ClearOptions();
List<string> sceneNames = new List<string>();
//sceneNames.Add("none");
for (int i = 0; i < SceneManager.sceneCountInBuildSettings; i++)
for (int i = 1; i < SceneManager.sceneCountInBuildSettings; i++)
{
string path = SceneUtility.GetScenePathByBuildIndex(i);
string name = System.IO.Path.GetFileNameWithoutExtension(path);
+1 -1
View File
@@ -66,7 +66,7 @@ public class FlushAndLoad : MonoBehaviour
}
}
private void HandleSceneIdReady(string id, List<GameObject> doors)
private void HandleSceneIdReady(string id, List<GameObject> doors, List<RecieveHeat> targets)
{
sceneId = id;
if (id == "Room1")
+24
View File
@@ -0,0 +1,24 @@
using UnityEngine;
public class RecieveHeat : MonoBehaviour
{
private float heatLevel;
private Material myMat;
private void Start()
{
myMat = GetComponent<Renderer>().material;
}
public void SetHeat(float heat)
{
if (heat > 255) return;
heatLevel = heat;
myMat.color = new Color(heatLevel,0,0);
}
public void AddHeat(float heat)
{
heatLevel += heat;
myMat.color = new Color(heatLevel, 0, 0);
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 60276d638c326f64e8ef8d871e7bb6fa
@@ -10,10 +10,12 @@ public class ReplaySceneLoader : MonoBehaviour
private int currentScene;
public void LoadSceneAdditive(int sceneIndex)
{
sceneIndex += 1;
if(SceneManager.loadedSceneCount > 1)
{
SceneManager.UnloadSceneAsync(currentScene);
}
//if (sceneIndex == 0) return;
SceneManager.LoadSceneAsync(sceneIndex, LoadSceneMode.Additive);
currentScene = sceneIndex;
+3 -2
View File
@@ -14,8 +14,9 @@ public class RoomManager : MonoBehaviour
public List<GameObject> furnitures;
public List<GameObject> portals;
public List<GameObject> enemies;
public List<RecieveHeat> targets;
public static event Action<string, List<GameObject>> OnSceneIdReady; // um das Replay erst auszulösen, wenn die SceneId da ist, die nun über die RoomPrefs festgelegt wird.
public static event Action<string, List<GameObject>, List<RecieveHeat>> OnSceneIdReady; // um das Replay erst auszulösen, wenn die SceneId da ist, die nun über die RoomPrefs festgelegt wird.
GhostRecorderBatch ghostRecorder;
public void Awake()
@@ -48,7 +49,7 @@ public class RoomManager : MonoBehaviour
foreach (GameObject enemy in enemies) enemy.SetActive(true);
}
sceneId = myRoom.sceneId;
OnSceneIdReady?.Invoke(sceneId, doors);
OnSceneIdReady?.Invoke(sceneId, doors, targets);
}
}