- Добавил систему диалогов - Создал классы Sequencer.cs и SequenceAction.cs для воссоздания последовательности действий - Добавил иеханику последовательности действий в Message.cs и MessageController.cs
37 lines
974 B
C#
37 lines
974 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using UnityEngine;
|
|
|
|
namespace RR.Common.Behaviour
|
|
{
|
|
public class Sequencer : MonoBehaviour
|
|
{
|
|
[Header("Последовательность действий")]
|
|
[SerializeReference] public List<SequenceAction> actions = new();
|
|
|
|
protected bool IsExecuting;
|
|
|
|
public void InitializeSequence()
|
|
{
|
|
StartCoroutine(ExecuteSequence(gameObject));
|
|
}
|
|
|
|
public void InitializeSequence(GameObject target)
|
|
{
|
|
StartCoroutine(ExecuteSequence(target));
|
|
}
|
|
|
|
protected virtual IEnumerator ExecuteSequence(GameObject target)
|
|
{
|
|
IsExecuting = true;
|
|
|
|
foreach (SequenceAction action in actions.Where(action => action != null))
|
|
{
|
|
yield return StartCoroutine(action.Execute(this, target));
|
|
}
|
|
|
|
IsExecuting = false;
|
|
}
|
|
}
|
|
} |