/// <summary> /// Converts a AgentInfo to a protobuf generated AgentInfoActionPairProto /// </summary> /// <returns>The protobuf version of the AgentInfoActionPairProto.</returns> public static AgentInfoActionPairProto ToInfoActionPairProto(this AgentInfo ai) { var agentInfoProto = ai.ToAgentInfoProto(); var agentActionProto = new AgentActionProto(); if (ai.storedVectorActions != null) { agentActionProto.VectorActions.AddRange(ai.storedVectorActions); } return(new AgentInfoActionPairProto { AgentInfo = agentInfoProto, ActionInfo = agentActionProto }); }
/// <summary> /// Converts a AgentInfo to a protobuf generated AgentInfoActionPairProto /// </summary> /// <returns>The protobuf version of the AgentInfoActionPairProto.</returns> public static AgentInfoActionPairProto ToInfoActionPairProto(this AgentInfo ai) { var agentInfoProto = ai.ToAgentInfoProto(); var agentActionProto = new AgentActionProto(); if (!ai.storedActions.IsEmpty()) { if (!ai.storedActions.ContinuousActions.IsEmpty()) { agentActionProto.ContinuousActions.AddRange(ai.storedActions.ContinuousActions.Array); } if (!ai.storedActions.DiscreteActions.IsEmpty()) { agentActionProto.DiscreteActions.AddRange(ai.storedActions.DiscreteActions.Array); } } return(new AgentInfoActionPairProto { AgentInfo = agentInfoProto, ActionInfo = agentActionProto }); }
public static ActionBuffers ToActionBuffers(this AgentActionProto proto) { return(new ActionBuffers(proto.ContinuousActions.ToArray(), proto.DiscreteActions.ToArray())); }