Repository URL to install this package:
Version:
1.3.1 ▾
|
using Fluctio.FluctioSim.Common.Configuration;
using Fluctio.FluctioSim.Core.Components.MachineLearning.Triggers;
using UnityEngine;
namespace Fluctio.FluctioSim.Core.Components.MachineLearning.TriggerActions
{
[AddComponentMenu(Config.PrefixedName+"/Machine Learning/Trigger Actions/End Episode", Config.ComponentMenuOrder + 70)]
[DefaultExecutionOrder(50)] // to allow adding rewards before ending episode, using the same trigger
public class EpisodeEnder : AgentAction
{
private void OnValidate()
{
if (trigger is EnvironmentResetTrigger)
{
trigger = null;
Debug.LogWarning($"{nameof(trigger)} inside {nameof(EpisodeEnder)} can not be set to {nameof(EnvironmentResetTrigger)}, as this will cause infinite recursion");
}
}
public override void OnExecute() => Agent.UnityAgent.EndEpisode();
}
}