working on multiplayer
This commit is contained in:
33
Runtime/Engine/Code/Simulation/Interactors/IInteractor.cs
Normal file
33
Runtime/Engine/Code/Simulation/Interactors/IInteractor.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using Cysharp.Threading.Tasks;
|
||||
|
||||
namespace RebootKit.Engine.Services.Simulation.Interactors {
|
||||
public interface IInteractorAsync<in TInteractable> {
|
||||
UniTask Interact(TInteractable target, CancellationToken cancellationToken);
|
||||
}
|
||||
|
||||
public interface IInteractor<in TInteractable> {
|
||||
void Interact(TInteractable target);
|
||||
}
|
||||
|
||||
public class GroupInteractor<TInteractable> : IInteractor<TInteractable> {
|
||||
readonly List<IInteractor<TInteractable>> m_Interactors = new List<IInteractor<TInteractable>>();
|
||||
|
||||
public void Interact(TInteractable target) {
|
||||
foreach (IInteractor<TInteractable> interactor in m_Interactors) interactor.Interact(target);
|
||||
}
|
||||
|
||||
public void Add(IInteractor<TInteractable> interactor) {
|
||||
m_Interactors.Add(interactor);
|
||||
}
|
||||
|
||||
public void Remove(IInteractor<TInteractable> interactor) {
|
||||
m_Interactors.Remove(interactor);
|
||||
}
|
||||
|
||||
public void RemoveAll() {
|
||||
m_Interactors.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bbb4d95dfc6a479caeeaa9078c45f5b8
|
||||
timeCreated: 1740881665
|
||||
Reference in New Issue
Block a user