-
Notifications
You must be signed in to change notification settings - Fork 4.3k
/
Copy pathIRLActionInputAdaptor.cs
40 lines (37 loc) · 2.16 KB
/
IRLActionInputAdaptor.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
#if MLA_INPUT_SYSTEM
using Unity.MLAgents.Actuators;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.LowLevel;
namespace Unity.MLAgents.Extensions.Input
{
/// <summary>
/// Implement this interface in order to customize how information is translated <see cref="InputControl"/>s
/// and <see cref="ActionBuffers"/>.
/// </summary>
public interface IRLActionInputAdaptor
{
/// <summary>
/// Generate an <see cref="ActionSpec"/> for a given action which determines how data is translated between
/// the <see cref="InputSystem"/> and ML-Agents.
/// </summary>
/// <param name="action">The <see cref="InputAction"/> to based the <see cref="ActionSpec"/> from.</param>
/// <returns>An <see cref="ActionSpec"/> instance based off the information in the <see cref="InputAction"/>.</returns>
ActionSpec GetActionSpecForInputAction(InputAction action);
/// <summary>
/// Translates data from the <see cref="ActionBuffers"/> object to the <see cref="InputSystem"/>.
/// </summary>
/// <param name="eventPtr">The Event pointer to write to.</param>
/// <param name="action">The action associated with this adaptor.</param>
/// <param name="control">The control which will write the event to the <see cref="InputSystem"/>.</param>
/// <param name="actionSpec">The <see cref="ActionSpec"/> associated with this action and adaptor pair.</param>
/// <param name="actionBuffers">The <see cref="ActionBuffers"/> object to read from.</param>
void WriteToInputEventForAction(InputEventPtr eventPtr, InputAction action, InputControl control, ActionSpec actionSpec, in ActionBuffers actionBuffers);
/// <summary>
/// Writes data from the <paramref name="action"/> to the <paramref name="actionBuffers"/>.
/// </summary>
/// <param name="action">The <paramref name="action"/> to read data from.</param>
/// <param name="actionBuffers">The <paramref name="actionBuffers"/> object to write data to.</param>
void WriteToHeuristic(InputAction action, in ActionBuffers actionBuffers);
}
}
#endif // MLA_INPUT_SYSTEM