Interface ICommand<T>
Interface for creating object-based method callbacks with a single argument
Namespace: Atlas
Assembly: Atlas.Runtime.dll
Syntax
public interface ICommand<T>
Type Parameters
Name | Description |
---|---|
T |
Examples
namespace Atlas.Examples
{
public sealed class Example_Command
{
// command declaration
public struct ExampleCommand : ICommand<float>
{
public void Execute( float value )
{
UnityEngine.Debug.LogFormat( "Command executed with value of {0}", value );
}
}
public void OnInjectDependencies( Signal<float> exampleSignal )
{
// instantiate a command object
ExampleCommand command = new ExampleCommand();
// register a command as a listener of the signal
exampleSignal.AddCommand( command );
// ...
// further calls to exampleSignal.Dispatch( float value ) will also
// invoke command.Execute( float value )
}
}
}
Methods
| Improve this Doc View SourceExecute(T)
Executes the object. When registered with a Signal<T>, this will get called upon Dispatch(T)
Declaration
void Execute(T arg)
Parameters
Type | Name | Description |
---|---|---|
T | arg |
See Also
Signal<T>