Aimbot-PPO/Aimbot-PPO-MultiScene/Assets/Script/RewardChanger.cs

56 lines
2.0 KiB
C#
Raw Normal View History

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class RewardChanger : MonoBehaviour
{
public GameObject Agent;
public Button nonRBT;
public Button shootRBT;
public Button shootWithoutReadyRBT;
public Button hitRBT;
public Button killRBT;
public Button winRBT;
public Button loseRBT;
public InputField nonRInputField;
public InputField shootRInputField;
public InputField shootWithoutReadyRInputField;
public InputField hitRInputField;
public InputField killRInputField;
public InputField winRInputField;
public InputField loseRInputField;
public void nonRBTPresses(){
string reward = nonRInputField.GetComponent<InputField>().text;
Agent.GetComponent<AgentWithGun>().nonReward = float.Parse(reward);
}
public void shootRBTPresses(){
string reward = shootRInputField.GetComponent<InputField>().text;
Agent.GetComponent<AgentWithGun>().shootReward = float.Parse(reward);
}
public void shootWithoutReadyRBTPresses(){
string reward = shootWithoutReadyRInputField.GetComponent<InputField>().text;
Agent.GetComponent<AgentWithGun>().shootWithoutReadyReward = float.Parse(reward);
}
public void hitRBTPresses(){
string reward = hitRInputField.GetComponent<InputField>().text;
Agent.GetComponent<AgentWithGun>().hitReward = float.Parse(reward);
}
public void killRBTPresses(){
string reward = killRInputField.GetComponent<InputField>().text;
Agent.GetComponent<AgentWithGun>().killReward = float.Parse(reward);
}
public void winRBTPresses(){
string reward = winRInputField.GetComponent<InputField>().text;
Agent.GetComponent<AgentWithGun>().winReward = float.Parse(reward);
}
public void loseRBTPresses(){
string reward = loseRInputField.GetComponent<InputField>().text;
Agent.GetComponent<AgentWithGun>().loseReward = float.Parse(reward);
}
}