Add Enemy Change Button
Add Enemy Change Button. Tidy up Unity Script folder.
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class DecisionPeriodChanger : MonoBehaviour
|
||||
{
|
||||
public GameObject DataTransfer;
|
||||
public Slider DecisionPeriodSlide;
|
||||
public Text DecisionPeriodDataText;
|
||||
public Toggle TakeActionsBetweenDecisionsToggle;
|
||||
|
||||
public void onSlideValueChanged()
|
||||
{
|
||||
DataTransfer.GetComponent<StartSeneData>().DecisionPeriod = (int)(DecisionPeriodSlide.GetComponent<Slider>().value);
|
||||
DecisionPeriodDataText.text = DataTransfer.GetComponent<StartSeneData>().DecisionPeriod.ToString();
|
||||
}
|
||||
public void onToggleChanged()
|
||||
{
|
||||
DataTransfer.GetComponent<StartSeneData>().ActionsBetweenDecisions = TakeActionsBetweenDecisionsToggle.isOn;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0d097ecbef2d7b843b772144dd301b2b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,14 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class LoadDirDateTextChange : MonoBehaviour
|
||||
{
|
||||
public GameObject DataTransfer;
|
||||
public void OnValueChanged()
|
||||
{
|
||||
string input = this.GetComponent<InputField>().text;
|
||||
DataTransfer.GetComponent<StartSeneData>().LoadDirDate = input;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cce4f6a22ca8eba4b94c1bfc6ac08072
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,14 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class LoadDirTimeTextChange : MonoBehaviour
|
||||
{
|
||||
public GameObject DataTransfer;
|
||||
public void OnValueChanged()
|
||||
{
|
||||
string input = this.GetComponent<InputField>().text;
|
||||
DataTransfer.GetComponent<StartSeneData>().LoadDirTime = input;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8396a1a162e012447a0e4f7626e70dc7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,30 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class LoadDirToggle : MonoBehaviour
|
||||
{
|
||||
public InputField LoadDirDateTextBox;
|
||||
public InputField LoadDirTimeTextBox;
|
||||
public Toggle Toggle;
|
||||
public GameObject DataTransfer;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void OnToggleChanged()
|
||||
{
|
||||
// if loadDirToggle is on then turn off the input text boxs.
|
||||
LoadDirDateTextBox.interactable = Toggle.isOn;
|
||||
LoadDirTimeTextBox.interactable = Toggle.isOn;
|
||||
// if loadDirToggle is off set loaddirs as 0.
|
||||
if (!Toggle.isOn)
|
||||
{
|
||||
DataTransfer.GetComponent<StartSeneData>().LoadDirDate = "0";
|
||||
DataTransfer.GetComponent<StartSeneData>().LoadDirTime = "0";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e18f417f93a39c74481660da3236c133
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,120 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class RewardsChange : MonoBehaviour
|
||||
{
|
||||
public GameObject DataTransfer;
|
||||
|
||||
public GameObject nonRInputOBJ;
|
||||
public GameObject shootRInputOBJ;
|
||||
public GameObject shootWithoutReadyRInputOBJ;
|
||||
public GameObject hitRInputOBJ;
|
||||
public GameObject killRInputOBJ;
|
||||
public GameObject winRInputOBJ;
|
||||
public GameObject loseRInputOBJ;
|
||||
|
||||
|
||||
public Text nonRInputText;
|
||||
public Text shootRInputText;
|
||||
public Text shootWithoutReadyRInputText;
|
||||
public Text hitRInputText;
|
||||
public Text killRInputText;
|
||||
public Text winRInputText;
|
||||
public Text loseRInputText;
|
||||
|
||||
|
||||
|
||||
private void Start()
|
||||
{
|
||||
}
|
||||
// Update is called once per frame
|
||||
|
||||
public void nonRValueChanged()
|
||||
{
|
||||
if (nonRInputOBJ.GetComponent<InputField>().text == "" || nonRInputOBJ.GetComponent<InputField>().text == "-")
|
||||
{
|
||||
nonRInputText.color = Color.gray;
|
||||
DataTransfer.GetComponent<StartSeneData>().nonReward = DataTransfer.GetComponent<StartSeneData>().nonRewardDefault;
|
||||
}
|
||||
else
|
||||
{
|
||||
nonRInputText.color = Color.yellow;
|
||||
DataTransfer.GetComponent<StartSeneData>().nonReward = float.Parse(nonRInputOBJ.GetComponent<InputField>().text);
|
||||
}
|
||||
}
|
||||
public void shootRValueChanged()
|
||||
{
|
||||
if (shootRInputOBJ.GetComponent<InputField>().text == "" || shootRInputOBJ.GetComponent<InputField>().text == "-")
|
||||
{
|
||||
shootRInputText.color = Color.gray;
|
||||
DataTransfer.GetComponent<StartSeneData>().shootReward = DataTransfer.GetComponent<StartSeneData>().shootRewardDefault;
|
||||
}
|
||||
else {
|
||||
shootRInputText.color = Color.yellow;
|
||||
DataTransfer.GetComponent<StartSeneData>().shootReward = float.Parse(shootRInputOBJ.GetComponent<InputField>().text);
|
||||
}
|
||||
}
|
||||
public void shootWOReadyRValueChanged()
|
||||
{
|
||||
if(shootWithoutReadyRInputOBJ.GetComponent<InputField>().text == "" || shootWithoutReadyRInputOBJ.GetComponent<InputField>().text == "-")
|
||||
{
|
||||
shootWithoutReadyRInputText.color = Color.gray;
|
||||
DataTransfer.GetComponent<StartSeneData>().shootWithoutReadyReward = DataTransfer.GetComponent<StartSeneData>().shootWithoutReadyRewardDefault;
|
||||
}
|
||||
else{
|
||||
shootWithoutReadyRInputText.color = Color.yellow;
|
||||
DataTransfer.GetComponent<StartSeneData>().shootWithoutReadyReward = float.Parse(shootWithoutReadyRInputOBJ.GetComponent<InputField>().text);
|
||||
}
|
||||
}
|
||||
public void hitRValueChanged()
|
||||
{
|
||||
if(hitRInputOBJ.GetComponent<InputField>().text == "" || hitRInputOBJ.GetComponent<InputField>().text == "-")
|
||||
{
|
||||
hitRInputText.color = Color.gray;
|
||||
DataTransfer.GetComponent<StartSeneData>().hitReward = DataTransfer.GetComponent<StartSeneData>().hitRewardDefault;
|
||||
}
|
||||
else{
|
||||
hitRInputText.color = Color.yellow;
|
||||
DataTransfer.GetComponent<StartSeneData>().hitReward = float.Parse(hitRInputOBJ.GetComponent<InputField>().text);
|
||||
}
|
||||
}
|
||||
public void winRValueChanged()
|
||||
{
|
||||
if(winRInputOBJ.GetComponent<InputField>().text == "" || winRInputOBJ.GetComponent<InputField>().text == "-")
|
||||
{
|
||||
winRInputText.color = Color.gray;
|
||||
DataTransfer.GetComponent<StartSeneData>().winReward = DataTransfer.GetComponent<StartSeneData>().winRewardDefault;
|
||||
}
|
||||
else{
|
||||
winRInputText.color = Color.yellow;
|
||||
DataTransfer.GetComponent<StartSeneData>().winReward = float.Parse(winRInputOBJ.GetComponent<InputField>().text);
|
||||
}
|
||||
}
|
||||
public void loseRValueChanged()
|
||||
{
|
||||
if(loseRInputOBJ.GetComponent<InputField>().text == "" || loseRInputOBJ.GetComponent<InputField>().text == "-")
|
||||
{
|
||||
loseRInputText.color = Color.gray;
|
||||
DataTransfer.GetComponent<StartSeneData>().loseReward = DataTransfer.GetComponent<StartSeneData>().loseRewardDefault;
|
||||
}
|
||||
else{
|
||||
loseRInputText.color = Color.yellow;
|
||||
DataTransfer.GetComponent<StartSeneData>().loseReward = float.Parse(loseRInputOBJ.GetComponent<InputField>().text);
|
||||
}
|
||||
}
|
||||
public void killRValueChanged()
|
||||
{
|
||||
if(killRInputOBJ.GetComponent<InputField>().text == "" || killRInputOBJ.GetComponent<InputField>().text == "-")
|
||||
{
|
||||
killRInputText.color = Color.gray;
|
||||
DataTransfer.GetComponent<StartSeneData>().killReward = DataTransfer.GetComponent<StartSeneData>().killRewardDefault;
|
||||
}
|
||||
else{
|
||||
killRInputText.color = Color.yellow;
|
||||
DataTransfer.GetComponent<StartSeneData>().killReward = float.Parse(killRInputOBJ.GetComponent<InputField>().text);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 44fd351436d221849991bd84d37d8109
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,41 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class SceneChange : MonoBehaviour
|
||||
{
|
||||
public GameObject DataTransfer;
|
||||
public Text errorText;
|
||||
// Start is called before the first frame update
|
||||
bool checkLoadDirFormat()
|
||||
{
|
||||
string thisLoadDirDate = DataTransfer.GetComponent<StartSeneData>().LoadDirDate;
|
||||
string thisLoadDirTime = DataTransfer.GetComponent<StartSeneData>().LoadDirTime;
|
||||
int LoadDirDateLength = thisLoadDirDate.Length;
|
||||
int LoadDirTimeLength = thisLoadDirTime.Length;
|
||||
if ((LoadDirDateLength == 8 && LoadDirTimeLength == 6) || (thisLoadDirDate == "0" && thisLoadDirTime == "0"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void onStartClick()
|
||||
{
|
||||
if (checkLoadDirFormat())
|
||||
{
|
||||
errorText.text = "Loading next Scene...";
|
||||
errorText.color = Color.green;
|
||||
SceneManager.LoadScene("InGame");
|
||||
}
|
||||
else
|
||||
{
|
||||
errorText.text = "Dir Format error";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 73ae3df5f5faba1428ab2529c043b7ae
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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:
|
||||
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class StartSeneData : MonoBehaviour
|
||||
{
|
||||
[Header("Default Rewards")]
|
||||
public float nonRewardDefault = -0.05f;
|
||||
public float shootRewardDefault = -0.06f;
|
||||
public float shootWithoutReadyRewardDefault = -0.06f;
|
||||
public float hitRewardDefault = 5.0f;
|
||||
public float killRewardDefault = 10.0f;
|
||||
public float winRewardDefault = 20.0f;
|
||||
public float loseRewardDefault = -10.0f;
|
||||
|
||||
// LoadDir
|
||||
[System.NonSerialized]public string LoadDirDate = "0";
|
||||
[System.NonSerialized]public string LoadDirTime = "0";
|
||||
|
||||
// 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()
|
||||
{
|
||||
nonReward = nonRewardDefault;
|
||||
shootReward = shootRewardDefault;
|
||||
shootWithoutReadyReward = shootWithoutReadyRewardDefault;
|
||||
hitReward = hitRewardDefault;
|
||||
killReward = killRewardDefault;
|
||||
winReward = winRewardDefault;
|
||||
loseReward = loseRewardDefault;
|
||||
}
|
||||
// Update is called once per frame
|
||||
void Awake()
|
||||
{
|
||||
DontDestroyOnLoad(transform.gameObject);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 52ba7faaa6129cf418f26c5933d4ea0e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user