Add Enemy Change Button
Add Enemy Change Button. Tidy up Unity Script folder.
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a21ce0a6cd8625d40a303acfa21d924c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+3
@@ -99,6 +99,9 @@ public class AgentWithGun : Agent
|
||||
HistoryRec = transform.GetComponent<HistoryRecorder>();
|
||||
rayScript = GetComponent<RaySensors>();
|
||||
|
||||
// Enemy Num
|
||||
enemyNum = DataTransfer.EnemyNum;
|
||||
|
||||
// get load directory.
|
||||
LoadDirDate = DataTransfer.LoadDirDate;
|
||||
LoadDirTime = DataTransfer.LoadDirTime;
|
||||
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class RealTimeEnemyNumChanger : MonoBehaviour
|
||||
{
|
||||
public GameObject Agent;
|
||||
|
||||
public InputField enemyNumInputField;
|
||||
public Text enemyNumPlaceholder;
|
||||
public Text enemyNumAddInfoText;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
enemyNumAddInfoText.text = "";
|
||||
}
|
||||
|
||||
public void nonRBTPresses()
|
||||
{
|
||||
if (enemyNumInputField.GetComponent<InputField>().text == "-")
|
||||
{
|
||||
// input chara not illegal
|
||||
enemyNumPlaceholder.color = Color.red;
|
||||
enemyNumPlaceholder.text = "Wrong Type!";
|
||||
enemyNumInputField.GetComponent<InputField>().text = "";
|
||||
}
|
||||
else if (enemyNumInputField.GetComponent<InputField>().text == "")
|
||||
{
|
||||
// empty chara
|
||||
enemyNumPlaceholder.color = Color.gray;
|
||||
enemyNumPlaceholder.text = "nonR";
|
||||
}
|
||||
else
|
||||
{
|
||||
// good to go~
|
||||
enemyNumPlaceholder.color = Color.gray;
|
||||
enemyNumPlaceholder.text = "nonR";
|
||||
string num = enemyNumInputField.GetComponent<InputField>().text;
|
||||
Agent.GetComponent<AgentWithGun>().enemyNum = Math.Abs(int.Parse(num));
|
||||
enemyNumInputField.GetComponent<InputField>().text = "";
|
||||
enemyNumAddInfoText.text = $"Enemy Num = {num} add Success. Valid in the next round.";
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d1f4766daac5b854db2634c914619261
|
||||
guid: 137cfd15c80550b4589b3dce99ff2d09
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -0,0 +1,207 @@
|
||||
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 = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e23822cccaf08084ab5cde559ca068e0
|
||||
guid: f31155528181e24438cf507311adf048
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -1,17 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class OnCam : MonoBehaviour
|
||||
{
|
||||
public void OnBecameInvisible()
|
||||
{
|
||||
Debug.Log("I SEE U");
|
||||
}
|
||||
|
||||
// ...and enable it again when it becomes visible.
|
||||
public void OnBecameVisible()
|
||||
{
|
||||
Debug.Log("NO Visual");
|
||||
}
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 58aaf9e292ab84e488d6a832943252d0
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+7
-7
@@ -34,7 +34,7 @@ public class RewardsChange : MonoBehaviour
|
||||
|
||||
public void nonRValueChanged()
|
||||
{
|
||||
if (nonRInputOBJ.GetComponent<InputField>().text == "")
|
||||
if (nonRInputOBJ.GetComponent<InputField>().text == "" || nonRInputOBJ.GetComponent<InputField>().text == "-")
|
||||
{
|
||||
nonRInputText.color = Color.gray;
|
||||
DataTransfer.GetComponent<StartSeneData>().nonReward = DataTransfer.GetComponent<StartSeneData>().nonRewardDefault;
|
||||
@@ -47,7 +47,7 @@ public class RewardsChange : MonoBehaviour
|
||||
}
|
||||
public void shootRValueChanged()
|
||||
{
|
||||
if (shootRInputOBJ.GetComponent<InputField>().text == "")
|
||||
if (shootRInputOBJ.GetComponent<InputField>().text == "" || shootRInputOBJ.GetComponent<InputField>().text == "-")
|
||||
{
|
||||
shootRInputText.color = Color.gray;
|
||||
DataTransfer.GetComponent<StartSeneData>().shootReward = DataTransfer.GetComponent<StartSeneData>().shootRewardDefault;
|
||||
@@ -59,7 +59,7 @@ public class RewardsChange : MonoBehaviour
|
||||
}
|
||||
public void shootWOReadyRValueChanged()
|
||||
{
|
||||
if(shootWithoutReadyRInputOBJ.GetComponent<InputField>().text == "")
|
||||
if(shootWithoutReadyRInputOBJ.GetComponent<InputField>().text == "" || shootWithoutReadyRInputOBJ.GetComponent<InputField>().text == "-")
|
||||
{
|
||||
shootWithoutReadyRInputText.color = Color.gray;
|
||||
DataTransfer.GetComponent<StartSeneData>().shootWithoutReadyReward = DataTransfer.GetComponent<StartSeneData>().shootWithoutReadyRewardDefault;
|
||||
@@ -71,7 +71,7 @@ public class RewardsChange : MonoBehaviour
|
||||
}
|
||||
public void hitRValueChanged()
|
||||
{
|
||||
if(hitRInputOBJ.GetComponent<InputField>().text == "")
|
||||
if(hitRInputOBJ.GetComponent<InputField>().text == "" || hitRInputOBJ.GetComponent<InputField>().text == "-")
|
||||
{
|
||||
hitRInputText.color = Color.gray;
|
||||
DataTransfer.GetComponent<StartSeneData>().hitReward = DataTransfer.GetComponent<StartSeneData>().hitRewardDefault;
|
||||
@@ -83,7 +83,7 @@ public class RewardsChange : MonoBehaviour
|
||||
}
|
||||
public void winRValueChanged()
|
||||
{
|
||||
if(winRInputOBJ.GetComponent<InputField>().text == "")
|
||||
if(winRInputOBJ.GetComponent<InputField>().text == "" || winRInputOBJ.GetComponent<InputField>().text == "-")
|
||||
{
|
||||
winRInputText.color = Color.gray;
|
||||
DataTransfer.GetComponent<StartSeneData>().winReward = DataTransfer.GetComponent<StartSeneData>().winRewardDefault;
|
||||
@@ -95,7 +95,7 @@ public class RewardsChange : MonoBehaviour
|
||||
}
|
||||
public void loseRValueChanged()
|
||||
{
|
||||
if(loseRInputOBJ.GetComponent<InputField>().text == "")
|
||||
if(loseRInputOBJ.GetComponent<InputField>().text == "" || loseRInputOBJ.GetComponent<InputField>().text == "-")
|
||||
{
|
||||
loseRInputText.color = Color.gray;
|
||||
DataTransfer.GetComponent<StartSeneData>().loseReward = DataTransfer.GetComponent<StartSeneData>().loseRewardDefault;
|
||||
@@ -107,7 +107,7 @@ public class RewardsChange : MonoBehaviour
|
||||
}
|
||||
public void killRValueChanged()
|
||||
{
|
||||
if(killRInputOBJ.GetComponent<InputField>().text == "")
|
||||
if(killRInputOBJ.GetComponent<InputField>().text == "" || killRInputOBJ.GetComponent<InputField>().text == "-")
|
||||
{
|
||||
killRInputText.color = Color.gray;
|
||||
DataTransfer.GetComponent<StartSeneData>().killReward = DataTransfer.GetComponent<StartSeneData>().killRewardDefault;
|
||||
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class StartSceneEnemyNumChanger : MonoBehaviour
|
||||
{
|
||||
public GameObject DataTransfer;
|
||||
public InputField EnemyNumInput;
|
||||
public Text EnemyNumText;
|
||||
|
||||
public void onValueChanged()
|
||||
{
|
||||
if (EnemyNumInput.GetComponent<InputField>().text == "" || EnemyNumInput.GetComponent<InputField>().text.Contains("-"))
|
||||
{
|
||||
EnemyNumText.color = Color.gray;
|
||||
DataTransfer.GetComponent<StartSeneData>().nonReward = DataTransfer.GetComponent<StartSeneData>().EnemyNumDefault;
|
||||
}
|
||||
else
|
||||
{
|
||||
EnemyNumText.color = Color.yellow;
|
||||
DataTransfer.GetComponent<StartSeneData>().EnemyNum = Math.Abs(int.Parse(EnemyNumInput.GetComponent<InputField>().text));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 64d0bcf55e4db0c488996ba1051c279f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+20
-13
@@ -1,11 +1,10 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class StartSeneData : MonoBehaviour
|
||||
{
|
||||
public string LoadDirDate = "0";
|
||||
public string LoadDirTime = "0";
|
||||
[Header("Default Rewards")]
|
||||
public float nonRewardDefault = -0.05f;
|
||||
public float shootRewardDefault = -0.06f;
|
||||
@@ -15,18 +14,26 @@ public class StartSeneData : MonoBehaviour
|
||||
public float winRewardDefault = 20.0f;
|
||||
public float loseRewardDefault = -10.0f;
|
||||
|
||||
[Header("Rewards for Transfer")]
|
||||
public float nonReward;
|
||||
public float shootReward;
|
||||
public float shootWithoutReadyReward;
|
||||
public float hitReward;
|
||||
public float killReward;
|
||||
public float winReward;
|
||||
public float loseReward;
|
||||
// LoadDir
|
||||
[System.NonSerialized]public string LoadDirDate = "0";
|
||||
[System.NonSerialized]public string LoadDirTime = "0";
|
||||
|
||||
[Header("Decision Period")]
|
||||
public int DecisionPeriod = 1;
|
||||
public bool ActionsBetweenDecisions = true;
|
||||
// Rewards
|
||||
[System.NonSerialized]public float nonReward;
|
||||
[System.NonSerialized] public float shootReward;
|
||||
[System.NonSerialized]public float shootWithoutReadyReward;
|
||||
[System.NonSerialized]public float hitReward;
|
||||
[System.NonSerialized]public float killReward;
|
||||
[System.NonSerialized]public float winReward;
|
||||
[System.NonSerialized]public float loseReward;
|
||||
|
||||
// DecisionPeriod
|
||||
[System.NonSerialized]public int DecisionPeriod = 1;
|
||||
[System.NonSerialized]public bool ActionsBetweenDecisions = true;
|
||||
|
||||
// EnemyNum
|
||||
public int EnemyNumDefault = 3;
|
||||
[System.NonSerialized]public int EnemyNum = 3;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
Reference in New Issue
Block a user