1 using System.Collections.Generic;
7 namespace droid.Runtime.InternalReactions {
16 bool _auto_reset =
true;
18 List<ActuatorMotion> _motions =
new List<ActuatorMotion>();
32 this._Manager = FindObjectOfType<AbstractNeodroidManager>();
33 if (Application.isPlaying) {
35 this._states = this._Manager.ReactAndCollectStates(
new Reaction(reset_reaction,
"all"));
40 if (Application.isPlaying) {
41 if (this._states == null) {
43 this._states = this._Manager.ReactAndCollectStates(
new Reaction(reset_reaction_parameters,
"all"));
47 if (this._player_motions != null) {
48 this._motions.Clear();
49 if (this._player_motions._Motions != null) {
50 foreach (var player_motion
in this._player_motions._Motions) {
51 if (Input.GetKey(player_motion._Key)) {
54 Debug.Log($
"{player_motion._Actor} {player_motion._Actuator} {player_motion._Strength}");
58 if (player_motion._Actuator ==
"Reset") {
64 player_motion._Actuator,
65 player_motion._Strength);
66 this._motions.Add(motion);
74 this._Manager.ReactAndCollectStates(
new Reaction(reset_reaction_parameters,
"all"));
76 var step = this._motions.Count > 0;
78 foreach (var state
in this._states) {
79 if (this._auto_reset && state.Terminated) {
81 this._Manager.ReactAndCollectStates(
new Reaction(reset_reaction, state.EnvironmentName));
85 var parameters =
new ReactionParameters(
true,
true, episode_count :
true) {IsExternal =
false};
86 var reaction =
new Reaction(parameters, this._motions.ToArray(), null, null, null,
"");
87 this._states = this._Manager.ReactAndCollectStates(reaction);
93 Debug.Log(
"No PlayerMotions ScriptableObject assigned");
Has a possible direction given by the sign of the float in strength