using System.Collections.Generic; using UnityEngine; using UnityEngine.InputSystem; public class ResumeManager : MonoBehaviour { [Header("Resume Prefab and Spawn")] public GameObject resumeTemplate; public Transform spawnPoint; private GameObject newResume; [Header("Input Actions")] public InputActionReference[] resumeAction; public bool isAI; public void SpawnNextResume(Person person) { // Remove old resume if one exists if (newResume != null) { Destroy(newResume); } // Spawn new resume newResume = Instantiate(resumeTemplate, spawnPoint.position, spawnPoint.rotation); // Notify the scanner that a resume has been spawned ResumeSpawned resumeSpawned = Events.ResumeSpawned; EventManager.Broadcast(resumeSpawned); // Pick a random background set int pickedIndex = -1; BackgroundSet chosenBackground = null; if (person.backgroundSets != null && person.backgroundSets.Count > 0) { pickedIndex = Random.Range(0, person.backgroundSets.Count); chosenBackground = person.backgroundSets[pickedIndex]; } // Determine if resume is fake (AI) or real isAI = true; if (pickedIndex == person.correctBackgroundIndex) { isAI = false; } Debug.Log(isAI); // Populate the resume with selected person and background ResumePopulator populator = newResume.GetComponent(); if (populator != null) { populator.PopulateResume(person, chosenBackground); } // Update all stamping scripts with this new resume's transform UpdateAllStampingScripts(newResume.transform); } private void UpdateAllStampingScripts(Transform newResumeTransform) { Stamping[] stampingScripts = FindObjectsOfType(); foreach (Stamping stamper in stampingScripts) { stamper.SetResumeTransform(newResumeTransform); } } public void ResetManager() { if (newResume != null) { Destroy(newResume); } } }