208 lines
7.2 KiB
C#
208 lines
7.2 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class RealTimeRewardChanger : MonoBehaviour
|
|
{
|
|
public GameObject Agent;
|
|
|
|
public InputField nonRInputField;
|
|
public InputField shootRInputField;
|
|
public InputField shootWithoutReadyRInputField;
|
|
public InputField hitRInputField;
|
|
public InputField killRInputField;
|
|
public InputField winRInputField;
|
|
public InputField loseRInputField;
|
|
|
|
public Text nonRPlaceholder;
|
|
public Text shootRPlaceholder;
|
|
public Text shootWithoutReadyRPlaceholder;
|
|
public Text hitRPlaceholder;
|
|
public Text killRPlaceholder;
|
|
public Text winRPlaceholder;
|
|
public Text loseRPlaceholder;
|
|
|
|
|
|
public void nonRBTPresses()
|
|
{
|
|
if (nonRInputField.GetComponent<InputField>().text == "-")
|
|
{
|
|
// input chara not illegal
|
|
nonRPlaceholder.color = Color.red;
|
|
nonRPlaceholder.text = "Wrong Type!";
|
|
nonRInputField.GetComponent<InputField>().text = "";
|
|
}else if (nonRInputField.GetComponent<InputField>().text == "")
|
|
{
|
|
// empty chara
|
|
nonRPlaceholder.color = Color.gray;
|
|
nonRPlaceholder.text = "nonR";
|
|
}
|
|
else
|
|
{
|
|
// good to go~
|
|
nonRPlaceholder.color = Color.gray;
|
|
nonRPlaceholder.text = "nonR";
|
|
string reward = nonRInputField.GetComponent<InputField>().text;
|
|
Agent.GetComponent<AgentWithGun>().nonReward = float.Parse(reward);
|
|
nonRInputField.GetComponent<InputField>().text = "";
|
|
}
|
|
}
|
|
|
|
public void shootRBTPresses()
|
|
{
|
|
if (shootRInputField.GetComponent<InputField>().text == "-")
|
|
{
|
|
// input chara not illegal
|
|
shootRPlaceholder.color = Color.red;
|
|
shootRPlaceholder.text = "Wrong Type!";
|
|
shootRInputField.GetComponent<InputField>().text = "";
|
|
}
|
|
else if (shootRInputField.GetComponent<InputField>().text == "")
|
|
{
|
|
// empty chara
|
|
shootRPlaceholder.color = Color.gray;
|
|
shootRPlaceholder.text = "shootR";
|
|
}
|
|
else
|
|
{
|
|
// good to go~
|
|
shootRPlaceholder.color = Color.gray;
|
|
shootRPlaceholder.text = "shootR";
|
|
string reward = shootRInputField.GetComponent<InputField>().text;
|
|
Agent.GetComponent<AgentWithGun>().shootReward = float.Parse(reward);
|
|
shootRInputField.GetComponent<InputField>().text = "";
|
|
}
|
|
}
|
|
|
|
public void shootWithoutReadyRBTPresses()
|
|
{
|
|
if (shootWithoutReadyRInputField.GetComponent<InputField>().text == "-")
|
|
{
|
|
// input chara not illegal
|
|
shootWithoutReadyRPlaceholder.color = Color.red;
|
|
shootWithoutReadyRPlaceholder.text = "Wrong Type!";
|
|
shootWithoutReadyRInputField.GetComponent<InputField>().text = "";
|
|
}
|
|
else if (shootWithoutReadyRInputField.GetComponent<InputField>().text == "")
|
|
{
|
|
// empty chara
|
|
shootWithoutReadyRPlaceholder.color = Color.gray;
|
|
shootWithoutReadyRPlaceholder.text = "SWORR";
|
|
}
|
|
else
|
|
{
|
|
// good to go~
|
|
shootWithoutReadyRPlaceholder.color = Color.gray;
|
|
shootWithoutReadyRPlaceholder.text = "SWORR";
|
|
string reward = shootWithoutReadyRInputField.GetComponent<InputField>().text;
|
|
Agent.GetComponent<AgentWithGun>().shootWithoutReadyReward = float.Parse(reward);
|
|
shootWithoutReadyRInputField.GetComponent<InputField>().text = "";
|
|
}
|
|
}
|
|
|
|
public void hitRBTPresses()
|
|
{
|
|
if (hitRInputField.GetComponent<InputField>().text == "-")
|
|
{
|
|
// input chara not illegal
|
|
hitRPlaceholder.color = Color.red;
|
|
hitRPlaceholder.text = "Wrong Type!";
|
|
hitRInputField.GetComponent<InputField>().text = "";
|
|
}
|
|
else if (hitRInputField.GetComponent<InputField>().text == "")
|
|
{
|
|
// empty chara
|
|
hitRPlaceholder.color = Color.gray;
|
|
hitRPlaceholder.text = "hitR";
|
|
}
|
|
else
|
|
{
|
|
// good to go~
|
|
hitRPlaceholder.color = Color.gray;
|
|
hitRPlaceholder.text = "hitR";
|
|
string reward = hitRInputField.GetComponent<InputField>().text;
|
|
Agent.GetComponent<AgentWithGun>().hitReward = float.Parse(reward);
|
|
hitRInputField.GetComponent<InputField>().text = "";
|
|
}
|
|
}
|
|
|
|
public void killRBTPresses()
|
|
{
|
|
if (killRInputField.GetComponent<InputField>().text == "-")
|
|
{
|
|
// input chara not illegal
|
|
killRPlaceholder.color = Color.red;
|
|
killRPlaceholder.text = "Wrong Type!";
|
|
killRInputField.GetComponent<InputField>().text = "";
|
|
}
|
|
else if (killRInputField.GetComponent<InputField>().text == "")
|
|
{
|
|
// empty chara
|
|
killRPlaceholder.color = Color.gray;
|
|
killRPlaceholder.text = "killR";
|
|
}
|
|
else
|
|
{
|
|
// good to go~
|
|
killRPlaceholder.color = Color.gray;
|
|
killRPlaceholder.text = "killR";
|
|
string reward = killRInputField.GetComponent<InputField>().text;
|
|
Agent.GetComponent<AgentWithGun>().killReward = float.Parse(reward);
|
|
killRInputField.GetComponent<InputField>().text = "";
|
|
}
|
|
}
|
|
|
|
public void winRBTPresses()
|
|
{
|
|
if (winRInputField.GetComponent<InputField>().text == "-")
|
|
{
|
|
// input chara not illegal
|
|
winRPlaceholder.color = Color.red;
|
|
winRPlaceholder.text = "Wrong Type!";
|
|
winRInputField.GetComponent<InputField>().text = "";
|
|
}
|
|
else if (winRInputField.GetComponent<InputField>().text == "")
|
|
{
|
|
// empty chara
|
|
winRPlaceholder.color = Color.gray;
|
|
winRPlaceholder.text = "winR";
|
|
}
|
|
else
|
|
{
|
|
// good to go~
|
|
winRPlaceholder.color = Color.gray;
|
|
winRPlaceholder.text = "winR";
|
|
string reward = winRInputField.GetComponent<InputField>().text;
|
|
Agent.GetComponent<AgentWithGun>().winReward = float.Parse(reward);
|
|
winRInputField.GetComponent<InputField>().text = "";
|
|
}
|
|
}
|
|
|
|
public void loseRBTPresses()
|
|
{
|
|
if (loseRInputField.GetComponent<InputField>().text == "-")
|
|
{
|
|
// input chara not illegal
|
|
loseRPlaceholder.color = Color.red;
|
|
loseRPlaceholder.text = "Wrong Type!";
|
|
loseRInputField.GetComponent<InputField>().text = "";
|
|
}
|
|
else if (loseRInputField.GetComponent<InputField>().text == "")
|
|
{
|
|
// empty chara
|
|
loseRPlaceholder.color = Color.gray;
|
|
loseRPlaceholder.text = "loseR";
|
|
}
|
|
else
|
|
{
|
|
// good to go~
|
|
loseRPlaceholder.color = Color.gray;
|
|
loseRPlaceholder.text = "loseR";
|
|
string reward = loseRInputField.GetComponent<InputField>().text;
|
|
Agent.GetComponent<AgentWithGun>().loseReward = float.Parse(reward);
|
|
loseRInputField.GetComponent<InputField>().text = "";
|
|
}
|
|
}
|
|
}
|