47 lines
1.2 KiB
C#
47 lines
1.2 KiB
C#
using System;
|
|
using System.Collections;
|
|
using UnityEngine;
|
|
|
|
/// <summary>
|
|
/// Satellite minigame — auto-completes after 1 second.
|
|
/// Students can replace this with real gameplay via a PR.
|
|
/// </summary>
|
|
public class SatelitTask : MonoBehaviour, ITask
|
|
{
|
|
public string TaskID { get; set; }
|
|
public TaskType TaskType { get; set; }
|
|
public string TaskName { get; set; }
|
|
public (double, double) TaskLocation { get; set; }
|
|
public bool IsCompleted { get; private set; }
|
|
|
|
private Action<ITask> _onCompleted;
|
|
private Action<ITask> _onExit;
|
|
|
|
public void Initialize(Action<ITask> onCompleted)
|
|
{
|
|
IsCompleted = false;
|
|
_onCompleted = onCompleted;
|
|
StartCoroutine(AutoComplete());
|
|
}
|
|
|
|
public void Complete()
|
|
{
|
|
if (IsCompleted) return;
|
|
IsCompleted = true;
|
|
_onCompleted?.Invoke(this);
|
|
ExitTask(_onExit);
|
|
}
|
|
|
|
public void ExitTask(Action<ITask> onExit)
|
|
{
|
|
onExit?.Invoke(this);
|
|
}
|
|
|
|
private IEnumerator AutoComplete()
|
|
{
|
|
Debug.Log("[SatelitTask] Satellite task started — auto-completing in 1s.");
|
|
yield return new WaitForSeconds(1f);
|
|
Complete();
|
|
}
|
|
}
|