Zabiju je
This commit is contained in:
46
Assets/Scripts/satelity/SatelitTask.cs
Normal file
46
Assets/Scripts/satelity/SatelitTask.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user