forked from Sichii/Chaos-Server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ICompositeScript.cs
62 lines (56 loc) · 1.62 KB
/
ICompositeScript.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
namespace Chaos.Scripting.Abstractions;
/// <summary>
/// Defines a pattern for a script that is composed of multiple scripts
/// </summary>
public interface ICompositeScript
{
/// <summary>
/// Adds a script to this script
/// </summary>
/// <param name="script">
/// The script to add
/// </param>
void Add(object script);
/// <summary>
/// Gets a script of the specified type
/// </summary>
/// <typeparam name="T">
/// The type of the script to retreive
/// </typeparam>
T? GetScript<T>();
/// <summary>
/// Gets all scripts of the specified type
/// </summary>
/// <typeparam name="T">
/// The type of the script to retreive
/// </typeparam>
IEnumerable<T> GetScripts<T>();
/// <summary>
/// Removes a script from this script
/// </summary>
/// <param name="script">
/// The script to remove
/// </param>
void Remove(object script);
}
/// <inheritdoc cref="ICompositeScript" />
/// <typeparam name="TScript">
/// A type that inherits from <see cref="Chaos.Scripting.Abstractions.IScript" />
/// </typeparam>
public interface ICompositeScript<TScript> : ICompositeScript, IEnumerable<TScript> where TScript: IScript
{
/// <summary>
/// Adds a script to this script
/// </summary>
/// <param name="script">
/// The script to add
/// </param>
void Add(TScript script);
/// <summary>
/// Removes a script from this script
/// </summary>
/// <param name="script">
/// The script to remove
/// </param>
void Remove(TScript script);
}