|
|
|
|
using UnityEngine;
|
|
|
|
|
using System.Collections;
|
|
|
|
|
|
|
|
|
|
public class SceneOutcomeManager : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
public static SceneOutcomeManager Instance;
|
|
|
|
|
|
|
|
|
|
[Header("UI Images")]
|
|
|
|
|
public GameObject notSuspiciousImage;
|
|
|
|
|
public GameObject alwaysReportImage;
|
|
|
|
|
public GameObject understandPhishingImage;
|
|
|
|
|
|
|
|
|
|
[Header("Camera Movement")]
|
|
|
|
|
public Transform cameraTarget;
|
|
|
|
|
public float cameraMoveSpeed = 1.5f;
|
|
|
|
|
public Camera mainCamera;
|
|
|
|
|
|
|
|
|
|
private void Awake()
|
|
|
|
|
{
|
|
|
|
|
Instance = this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Reported(EmailData data)
|
|
|
|
|
{
|
|
|
|
|
if (data.isPhishing)
|
|
|
|
|
{
|
|
|
|
|
understandPhishingImage.SetActive(true);
|
|
|
|
|
StartCoroutine(MoveCameraToDebrief());
|
|
|
|
|
WorldTimelineManager.Instance.SnapshotCurrentSequence();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
notSuspiciousImage.SetActive(true);
|
|
|
|
|
// ✅ No camera or timeline
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Clicked(EmailData data)
|
|
|
|
|
{
|
|
|
|
|
if (data.isPhishing)
|
|
|
|
|
{
|
|
|
|
|
Debug.Log("❌ SIMULATION FAILED – CREDENTIALS STOLEN");
|
|
|
|
|
understandPhishingImage.SetActive(true);
|
|
|
|
|
StartCoroutine(MoveCameraToDebrief());
|
|
|
|
|
WorldTimelineManager.Instance.SnapshotCurrentSequence();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Debug.Log("Clicked safe link.");
|
|
|
|
|
// Optional: You can add a "well done" feedback here if desired
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Ignored(EmailData data)
|
|
|
|
|
{
|
|
|
|
|
if (data.isPhishing)
|
|
|
|
|
{
|
|
|
|
|
alwaysReportImage.SetActive(true);
|
|
|
|
|
StartCoroutine(MoveCameraToDebrief());
|
|
|
|
|
WorldTimelineManager.Instance.SnapshotCurrentSequence();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// ✅ Not phishing + Ignored → Do nothing
|
|
|
|
|
Debug.Log("Ignored a safe email. No feedback triggered.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private IEnumerator MoveCameraToDebrief()
|
|
|
|
|
{
|
|
|
|
|
if (mainCamera == null || cameraTarget == null)
|
|
|
|
|
yield break;
|
|
|
|
|
|
|
|
|
|
Vector3 startPos = mainCamera.transform.position;
|
|
|
|
|
Quaternion startRot = mainCamera.transform.rotation;
|
|
|
|
|
|
|
|
|
|
float t = 0;
|
|
|
|
|
while (t < 1)
|
|
|
|
|
{
|
|
|
|
|
t += Time.deltaTime * cameraMoveSpeed;
|
|
|
|
|
mainCamera.transform.position = Vector3.Lerp(startPos, cameraTarget.position, t);
|
|
|
|
|
mainCamera.transform.rotation = Quaternion.Slerp(startRot, cameraTarget.rotation, t);
|
|
|
|
|
yield return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|