V3.1.5 修正PlayMode中TargetUI问题
修正TargetUI初始化StayMode Button可使用的问题 修正TargetUI可使用按钮逻辑问题 修正TargetUI与TargetController联动问题 修正Enemy击杀后不死亡问题
This commit is contained in:
@@ -47,7 +47,7 @@ public class EnvironmentUIControl : MonoBehaviour
|
||||
{
|
||||
// while result is active and show time over timeOut
|
||||
// clear the result
|
||||
Debug.Log("clear result");
|
||||
Debug.Log("EnvironmentUIControl: clear result");
|
||||
winLoseText.text = "";
|
||||
winLoseText.color = Color.white;
|
||||
resultActive = false;
|
||||
@@ -182,11 +182,15 @@ public class EnvironmentUIControl : MonoBehaviour
|
||||
stateBuilder.Clear();
|
||||
|
||||
stateBuilder.Append($"States:\r\nTType:{targetStates[0]}");
|
||||
stateBuilder.Append("\r\nTPosition:");
|
||||
stateBuilder.Append(targetStates[1]).Append(targetStates[2]).Append(targetStates[3]);
|
||||
stateBuilder.Append("\r\nTDiameter:");
|
||||
stateBuilder.Append("\r\nTargetPosition:\r\nx:");
|
||||
stateBuilder.Append(targetStates[1]);
|
||||
stateBuilder.Append("\r\ny:");
|
||||
stateBuilder.Append(targetStates[2]);
|
||||
stateBuilder.Append("\r\nz:");
|
||||
stateBuilder.Append(targetStates[3]);
|
||||
stateBuilder.Append("\r\nTargetDiameter:");
|
||||
stateBuilder.Append(targetStates[4]);
|
||||
stateBuilder.Append("\r\nTRatio:");
|
||||
stateBuilder.Append("\r\nTargetBelongRatio:");
|
||||
stateBuilder.Append(targetStates[5]);
|
||||
stateBuilder.Append("\r\nInArea:");
|
||||
stateBuilder.Append(inAreaState);
|
||||
|
||||
@@ -20,6 +20,7 @@ public class MLAgentsCustomController : Agent
|
||||
private TargetController targetController;
|
||||
private EnvironmentUIControl envUIController;
|
||||
private HUDController hudController;
|
||||
private TargetUIController targetUIController;
|
||||
private RaySensors raySensors;
|
||||
|
||||
// observation
|
||||
@@ -44,6 +45,7 @@ public class MLAgentsCustomController : Agent
|
||||
targetController = targetControllerObj.GetComponent<TargetController>();
|
||||
envUIController = environmentUIObj.GetComponent<EnvironmentUIControl>();
|
||||
hudController = hudUIObj.GetComponent<HUDController>();
|
||||
targetUIController = hudUIObj.GetComponent<TargetUIController>();
|
||||
}
|
||||
|
||||
// ML-AGENTS处理-------------------------------------------------------------------------------------------ML-AGENTS
|
||||
@@ -64,6 +66,8 @@ public class MLAgentsCustomController : Agent
|
||||
{
|
||||
// play mode
|
||||
targetController.PlayInitialize();
|
||||
// reset target UI
|
||||
targetUIController.ClearGamePressed();
|
||||
}
|
||||
|
||||
// give default Reward to Reward value will be used.
|
||||
|
||||
@@ -133,7 +133,7 @@ public class ParameterContainer : MonoBehaviour
|
||||
private float targetInAreaTime = 0f;
|
||||
private float lastFrameTime = 0f;
|
||||
|
||||
[System.NonSerialized] public int gameMode;
|
||||
[System.NonSerialized] public int gameMode; // 0 = trainning mode, 1 = play mode
|
||||
[System.NonSerialized] public float attackProb = 0f;
|
||||
[System.NonSerialized] public float gotoProb = 0f;
|
||||
[System.NonSerialized] public float defenceProb = 0f;
|
||||
@@ -148,7 +148,7 @@ public class ParameterContainer : MonoBehaviour
|
||||
try
|
||||
{
|
||||
startSceneData = GameObject.Find("StartSceneDataTransfer").GetComponent<StartSeneData>();
|
||||
gameMode = startSceneData.gamemode;
|
||||
gameMode = startSceneData.gameMode;
|
||||
attackProb = startSceneData.attackProb;
|
||||
gotoProb = startSceneData.gotoProb;
|
||||
defenceProb = startSceneData.defenceProb;
|
||||
@@ -156,7 +156,7 @@ public class ParameterContainer : MonoBehaviour
|
||||
catch
|
||||
{
|
||||
Debug.LogError("PrameterContainer:Run WithOut StartScreen!");
|
||||
gameMode = 1;
|
||||
gameMode = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ using UnityEngine;
|
||||
|
||||
public class SceneBlock : MonoBehaviour
|
||||
{
|
||||
public GameObject firebasesAreaObj;
|
||||
public GameObject fireBasesAreaObj;
|
||||
public GameObject enemyContainerObj;
|
||||
public float group1InareaNum = 0;
|
||||
public float group2InareaNum = 0;
|
||||
@@ -37,21 +37,6 @@ public class SceneBlock : MonoBehaviour
|
||||
// Start is called before the first frame update
|
||||
private void Start()
|
||||
{
|
||||
// if firebasesAreaObj is null, find sub object by name
|
||||
if (firebasesAreaObj == null)
|
||||
{
|
||||
firebasesAreaObj = transform.Find("FirebasesArea").gameObject;
|
||||
}
|
||||
// if enemyContainerObj is null, find them by name
|
||||
if (enemyContainerObj == null)
|
||||
{
|
||||
enemyContainerObj = transform.Find("EnemyContainer").gameObject;
|
||||
}
|
||||
firebasesAreaPosition = transform.position + firebasesAreaObj.transform.position;
|
||||
firebasesAreaScale = firebasesAreaObj.transform.localScale.x;
|
||||
firebasesAreaDiameter = firebasesAreaScale * blockSize;
|
||||
firebasesBelong = -belongMaxPoint;
|
||||
addPointEachInterval = belongMaxPoint / (stayTimeNeeded / addPointInterval);
|
||||
intervalStart = Time.time;
|
||||
}
|
||||
|
||||
@@ -111,6 +96,25 @@ public class SceneBlock : MonoBehaviour
|
||||
}
|
||||
group1Objs = group1ObjsList.ToArray();
|
||||
group2Objs = group2ObjsList.ToArray();
|
||||
|
||||
// if firebasesAreaObj is null, find sub object by name
|
||||
if (fireBasesAreaObj == null)
|
||||
{
|
||||
Debug.Log("SceneBlock.Start: fireBasesAreaObj not found, get it by name");
|
||||
fireBasesAreaObj = transform.Find("FirebasesArea").gameObject;
|
||||
}
|
||||
// if enemyContainerObj is null, find them by name
|
||||
if (enemyContainerObj == null)
|
||||
{
|
||||
Debug.Log("SceneBlock.Start: enemyContainerObj not found, get it by name");
|
||||
enemyContainerObj = transform.Find("EnemyContainer").gameObject;
|
||||
}
|
||||
firebasesAreaPosition = transform.position + fireBasesAreaObj.transform.position;
|
||||
firebasesAreaScale = fireBasesAreaObj.transform.localScale.x;
|
||||
firebasesAreaDiameter = firebasesAreaScale * blockSize;
|
||||
firebasesBelong = -belongMaxPoint;
|
||||
addPointEachInterval = belongMaxPoint / (stayTimeNeeded / addPointInterval);
|
||||
intervalStart = Time.time;
|
||||
}
|
||||
|
||||
//check game over 0=notover 1=win
|
||||
@@ -182,8 +186,8 @@ public class SceneBlock : MonoBehaviour
|
||||
// get this position and target's distance and is in firebase area
|
||||
public (float, int) GetDistInArea(Vector3 thisPosition)
|
||||
{
|
||||
thisPosition.y = firebasesAreaObj.transform.position.y;
|
||||
float dist = Vector3.Distance(thisPosition, firebasesAreaObj.transform.position) - (firebasesAreaDiameter / 2);
|
||||
thisPosition.y = fireBasesAreaObj.transform.position.y;
|
||||
float dist = Vector3.Distance(thisPosition, fireBasesAreaObj.transform.position) - (firebasesAreaDiameter / 2);
|
||||
int isinarea = 0;
|
||||
if (dist <= 0)
|
||||
{
|
||||
|
||||
@@ -25,7 +25,7 @@ public class SceneBlockContainer : MonoBehaviour
|
||||
if (thisBlockObj != null)
|
||||
{
|
||||
// delete thisBlock
|
||||
Debug.LogWarning("Block not clear!");
|
||||
Debug.LogWarning("SceneBlockContainer.CreateNewBlock: Block not clear!");
|
||||
DestroyBlock();
|
||||
}
|
||||
// choose target type
|
||||
@@ -59,7 +59,7 @@ public class SceneBlockContainer : MonoBehaviour
|
||||
break;
|
||||
|
||||
default:
|
||||
Debug.LogWarning("SceneBlock: CreateNewBlock: targetType not found!");
|
||||
Debug.LogWarning("SceneBlockContainer.CreateNewBlock: targetType not found!");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,8 +57,8 @@ public class TargetController : MonoBehaviour
|
||||
private Vector3 targetLocalPosition;
|
||||
private bool firstRewardFlag = true;
|
||||
private bool targetEnemySpawnFinish = false;
|
||||
private SceneBlockContainer blockCont;
|
||||
private EnemyContainer enemyCont;
|
||||
private SceneBlockContainer sceneBlockCon;
|
||||
private EnemyContainer enemyCon;
|
||||
private EnvironmentUIControl envUICon;
|
||||
private ParameterContainer paramCon;
|
||||
private CharacterController agentCharaCon;
|
||||
@@ -72,9 +72,9 @@ public class TargetController : MonoBehaviour
|
||||
// Start is called before the first frame update
|
||||
private void Start()
|
||||
{
|
||||
blockCont = sceneBlockContainerObj.GetComponent<SceneBlockContainer>();
|
||||
sceneBlockCon = sceneBlockContainerObj.GetComponent<SceneBlockContainer>();
|
||||
envUICon = environmentUIObj.GetComponent<EnvironmentUIControl>();
|
||||
enemyCont = enemyContainerObj.GetComponent<EnemyContainer>();
|
||||
enemyCon = enemyContainerObj.GetComponent<EnemyContainer>();
|
||||
agentCharaCon = agentObj.GetComponent<CharacterController>();
|
||||
paramCon = parameterContainerObj.GetComponent<ParameterContainer>();
|
||||
worldUICon = worldUIObj.GetComponent<WorldUIController>();
|
||||
@@ -102,7 +102,7 @@ public class TargetController : MonoBehaviour
|
||||
targetNum = (int)SceneBlockContainer.Targets.Num;
|
||||
if (freeProb < 0)
|
||||
{
|
||||
Debug.LogError("target percentage wrong");
|
||||
Debug.LogError("TargetController.Start: target percentage wrong");
|
||||
}
|
||||
|
||||
// initialize a simple fake onehot encoder.
|
||||
@@ -125,7 +125,7 @@ public class TargetController : MonoBehaviour
|
||||
{
|
||||
leftTime = paramCon.timeLimit;
|
||||
// print out time
|
||||
Debug.Log("Playing Time: " + leftTime);
|
||||
// Debug.Log("Playing Time: " + leftTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -142,7 +142,7 @@ public class TargetController : MonoBehaviour
|
||||
{
|
||||
// goto target spawn
|
||||
Debug.Log("GOTO THIS TARGET!");
|
||||
SpawnSceneBlock(SceneBlockContainer.Targets.Go);
|
||||
RandomSpawnSceneBlock(SceneBlockContainer.Targets.Go);
|
||||
// set startDistance
|
||||
firstRewardFlag = true;
|
||||
}
|
||||
@@ -150,7 +150,7 @@ public class TargetController : MonoBehaviour
|
||||
{
|
||||
// attack target spawn
|
||||
Debug.Log("ATTACK!");
|
||||
SpawnSceneBlock(SceneBlockContainer.Targets.Attack);
|
||||
RandomSpawnSceneBlock(SceneBlockContainer.Targets.Attack);
|
||||
// set startDistance
|
||||
firstRewardFlag = true;
|
||||
targetEnemySpawnFinish = false;
|
||||
@@ -159,7 +159,7 @@ public class TargetController : MonoBehaviour
|
||||
{
|
||||
// defence target spawn
|
||||
Debug.Log("DEFENCE!");
|
||||
SpawnSceneBlock(SceneBlockContainer.Targets.Defence);
|
||||
RandomSpawnSceneBlock(SceneBlockContainer.Targets.Defence);
|
||||
// set startDistance
|
||||
firstRewardFlag = true;
|
||||
}
|
||||
@@ -167,20 +167,24 @@ public class TargetController : MonoBehaviour
|
||||
{
|
||||
//Debug.Log("Free");
|
||||
targetTypeInt = (int)SceneBlockContainer.Targets.Free;
|
||||
enemyCont.DestroyAllEnemys();
|
||||
enemyCont.RandomInitEnemys(hudCon.enemyNum);
|
||||
enemyCon.DestroyAllEnemys();
|
||||
enemyCon.RandomInitEnemys(hudCon.enemyNum);
|
||||
MoveAgentToSpwanArea();
|
||||
blockCont.DestroyBlock();
|
||||
sceneBlockCon.DestroyBlock();
|
||||
}
|
||||
UpdateTargetStates();
|
||||
envUICon.UpdateTargetType(targetTypeInt);
|
||||
}
|
||||
|
||||
// get target observation states
|
||||
private void UpdateTargetStates()
|
||||
private void UpdateTargetStates(Vector3? thisTargetPosition = null)
|
||||
{
|
||||
// targettype, x,y,z, firebasesAreaDiameter
|
||||
targetState[0] = targetTypeInt;
|
||||
if (thisTargetPosition != null)
|
||||
{
|
||||
targetPosition = (Vector3)thisTargetPosition;
|
||||
}
|
||||
if (targetTypeInt == (int)SceneBlockContainer.Targets.Free || targetTypeInt == (int)SceneBlockContainer.Targets.Stay)
|
||||
{
|
||||
for (int i = 1; i < targetState.Length; i++)
|
||||
@@ -188,14 +192,11 @@ public class TargetController : MonoBehaviour
|
||||
}
|
||||
else
|
||||
{
|
||||
/* targetState[1] = targetPosition.x / raySensors.viewDistance; // normalization
|
||||
targetState[2] = targetPosition.y / raySensors.viewDistance;
|
||||
targetState[3] = targetPosition.z / raySensors.viewDistance;*/
|
||||
targetState[1] = targetPosition.x; // normalization
|
||||
targetState[1] = targetPosition.x;
|
||||
targetState[2] = targetPosition.y;
|
||||
targetState[3] = targetPosition.z;
|
||||
targetState[4] = blockCont.thisBlock.firebasesAreaDiameter / raySensors.viewDistance;
|
||||
targetState[5] = blockCont.thisBlock.belongRatio;
|
||||
targetState[4] = sceneBlockCon.thisBlock.firebasesAreaDiameter;
|
||||
targetState[5] = sceneBlockCon.thisBlock.belongRatio;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,11 +243,11 @@ public class TargetController : MonoBehaviour
|
||||
{
|
||||
case (int)SceneBlockContainer.Targets.Go:
|
||||
// goto
|
||||
(nowDistance, inArea) = blockCont.GetAgentTargetDistanceAndInside(agentObj.transform.position);
|
||||
envUICon.UpdateTargetGauge(blockCont.thisBlock.firebasesBelong, blockCont.thisBlock.belongMaxPoint);
|
||||
(nowDistance, inArea) = sceneBlockCon.GetAgentTargetDistanceAndInside(agentObj.transform.position);
|
||||
envUICon.UpdateTargetGauge(sceneBlockCon.thisBlock.firebasesBelong, sceneBlockCon.thisBlock.belongMaxPoint);
|
||||
float areaTargetReward = GetDistanceReward(nowDistance, inArea);
|
||||
//if(inArea != 0)
|
||||
if (blockCont.thisBlock.firebasesBelong >= blockCont.thisBlock.belongMaxPoint)
|
||||
if (sceneBlockCon.thisBlock.firebasesBelong >= sceneBlockCon.thisBlock.belongMaxPoint)
|
||||
{
|
||||
// win
|
||||
// let the area belongs to me
|
||||
@@ -273,11 +274,10 @@ public class TargetController : MonoBehaviour
|
||||
|
||||
case (int)SceneBlockContainer.Targets.Attack:
|
||||
// attack
|
||||
(nowDistance, inArea) = blockCont.GetAgentTargetDistanceAndInside(agentObj.transform.position);
|
||||
envUICon.UpdateTargetGauge(blockCont.thisBlock.firebasesBelong, blockCont.thisBlock.belongMaxPoint);
|
||||
if (blockCont.thisBlock.GetInAreaNumber(group2Tag) <= 0 && targetEnemySpawnFinish)
|
||||
(nowDistance, inArea) = sceneBlockCon.GetAgentTargetDistanceAndInside(agentObj.transform.position);
|
||||
envUICon.UpdateTargetGauge(sceneBlockCon.thisBlock.firebasesBelong, sceneBlockCon.thisBlock.belongMaxPoint);
|
||||
if (sceneBlockCon.thisBlock.GetInAreaNumber(group2Tag) <= 0 && targetEnemySpawnFinish)
|
||||
{
|
||||
Debug.Log(blockCont.thisBlock.GetInAreaNumber(group2Tag));
|
||||
// win
|
||||
// let the area belongs to me and kill every enmy in this area.
|
||||
thisReward = 0;
|
||||
@@ -309,9 +309,9 @@ public class TargetController : MonoBehaviour
|
||||
case (int)SceneBlockContainer.Targets.Defence:
|
||||
//defence
|
||||
// !!! DIDN't FINISH!!!
|
||||
(nowDistance, inArea) = blockCont.GetAgentTargetDistanceAndInside(agentObj.transform.position);
|
||||
envUICon.UpdateTargetGauge(blockCont.thisBlock.firebasesBelong, blockCont.thisBlock.belongMaxPoint);
|
||||
if (leftTime <= 0 && blockCont.thisBlock.firebasesBelong >= 0f)
|
||||
(nowDistance, inArea) = sceneBlockCon.GetAgentTargetDistanceAndInside(agentObj.transform.position);
|
||||
envUICon.UpdateTargetGauge(sceneBlockCon.thisBlock.firebasesBelong, sceneBlockCon.thisBlock.belongMaxPoint);
|
||||
if (leftTime <= 0 && sceneBlockCon.thisBlock.firebasesBelong >= 0f)
|
||||
{
|
||||
// win
|
||||
// time over and the area still mine
|
||||
@@ -319,7 +319,7 @@ public class TargetController : MonoBehaviour
|
||||
//thisReward = (paramCon.inAreaReward * inArea) + getSceneReward(nowDistance);
|
||||
endTypeInt = (int)EndType.Win;
|
||||
}
|
||||
else if (blockCont.thisBlock.firebasesBelong <= blockCont.thisBlock.belongMaxPoint)
|
||||
else if (sceneBlockCon.thisBlock.firebasesBelong <= sceneBlockCon.thisBlock.belongMaxPoint)
|
||||
{
|
||||
// lost area lose
|
||||
thisReward = paramCon.loseReward;
|
||||
@@ -375,18 +375,18 @@ public class TargetController : MonoBehaviour
|
||||
}
|
||||
|
||||
// initialize scene block by target type
|
||||
private void SpawnSceneBlock(SceneBlockContainer.Targets thisTargetType)
|
||||
private void RandomSpawnSceneBlock(SceneBlockContainer.Targets thisTargetType)
|
||||
{
|
||||
int randBlockType = 0;
|
||||
switch (thisTargetType)
|
||||
{
|
||||
case SceneBlockContainer.Targets.Go:
|
||||
randBlockType = Random.Range(0, blockCont.goBlockPrefabs.Length);
|
||||
sceneBlockSize = blockCont.goBlockPrefabs[randBlockType].GetComponent<SceneBlock>().blockSize;
|
||||
randBlockType = Random.Range(0, sceneBlockCon.goBlockPrefabs.Length);
|
||||
sceneBlockSize = sceneBlockCon.goBlockPrefabs[randBlockType].GetComponent<SceneBlock>().blockSize;
|
||||
break;
|
||||
case SceneBlockContainer.Targets.Attack:
|
||||
randBlockType = Random.Range(0, blockCont.attackBlockPrefabs.Length);
|
||||
sceneBlockSize = blockCont.attackBlockPrefabs[randBlockType].GetComponent<SceneBlock>().blockSize;
|
||||
randBlockType = Random.Range(0, sceneBlockCon.attackBlockPrefabs.Length);
|
||||
sceneBlockSize = sceneBlockCon.attackBlockPrefabs[randBlockType].GetComponent<SceneBlock>().blockSize;
|
||||
break;
|
||||
case SceneBlockContainer.Targets.Defence:
|
||||
// randBlockType = Random.Range(0, blockCont.defenceBlockPrefabs.Length);
|
||||
@@ -402,11 +402,11 @@ public class TargetController : MonoBehaviour
|
||||
targetPosition = new Vector3(randX, 0, randZ);
|
||||
|
||||
// init scene block
|
||||
blockCont.DestroyBlock();
|
||||
blockCont.CreateNewBlock(thisTargetType, randBlockType, targetPosition, group1Tag, group2Tag);
|
||||
enemyCont.DestroyAllEnemys();
|
||||
enemyCont.RandomInitEnemysExcept(hudCon.enemyNum, targetPosition, sceneBlockSize);
|
||||
blockCont.thisBlock.InitBlock(environmentObj);
|
||||
sceneBlockCon.DestroyBlock();
|
||||
sceneBlockCon.CreateNewBlock(thisTargetType, randBlockType, targetPosition, group1Tag, group2Tag);
|
||||
enemyCon.DestroyAllEnemys();
|
||||
enemyCon.RandomInitEnemysExcept(hudCon.enemyNum, targetPosition, sceneBlockSize);
|
||||
sceneBlockCon.thisBlock.InitBlock(environmentObj);
|
||||
}
|
||||
|
||||
// caulculate sceneReward if close to target then get great reward
|
||||
@@ -415,7 +415,7 @@ public class TargetController : MonoBehaviour
|
||||
if (firstRewardFlag)
|
||||
{
|
||||
// first distance record
|
||||
(lastDistance, _) = blockCont.GetAgentTargetDistanceAndInside(agentObj.transform.position);
|
||||
(lastDistance, _) = sceneBlockCon.GetAgentTargetDistanceAndInside(agentObj.transform.position);
|
||||
firstRewardFlag = false;
|
||||
}
|
||||
float thisSceneReward = 0f;
|
||||
@@ -441,7 +441,7 @@ public class TargetController : MonoBehaviour
|
||||
if (targetTypeInt == (int)SceneBlockContainer.Targets.Attack)
|
||||
{
|
||||
// attack mode
|
||||
(_, int isInArea) = blockCont.thisBlock.GetDistInArea(enemyPosition);
|
||||
(_, int isInArea) = sceneBlockCon.thisBlock.GetDistInArea(enemyPosition);
|
||||
if (isInArea == 1)
|
||||
{
|
||||
// kill in area enemy
|
||||
@@ -472,7 +472,7 @@ public class TargetController : MonoBehaviour
|
||||
if (targetTypeInt == (int)SceneBlockContainer.Targets.Attack)
|
||||
{
|
||||
// attack mode
|
||||
(_, int isInArea) = blockCont.thisBlock.GetDistInArea(enemyPosition);
|
||||
(_, int isInArea) = sceneBlockCon.thisBlock.GetDistInArea(enemyPosition);
|
||||
if (isInArea == 1)
|
||||
{
|
||||
// hit in area enemy
|
||||
@@ -515,16 +515,18 @@ public class TargetController : MonoBehaviour
|
||||
public void PlayInitialize()
|
||||
{
|
||||
targetTypeInt = (int)SceneBlockContainer.Targets.Stay;
|
||||
UpdateTargetStates();
|
||||
envUICon.UpdateTargetType(targetTypeInt);
|
||||
MoveAgentToSpwanArea();
|
||||
enemyCont.DestroyAllEnemys();
|
||||
blockCont.DestroyBlock();
|
||||
enemyCon.DestroyAllEnemys();
|
||||
sceneBlockCon.DestroyBlock();
|
||||
}
|
||||
|
||||
// change to attack mode
|
||||
public void AttackModeChange()
|
||||
public void AttackModeChange(Vector3 thisTargetPosition)
|
||||
{
|
||||
targetTypeInt = (int)SceneBlockContainer.Targets.Attack;
|
||||
UpdateTargetStates(thisTargetPosition);
|
||||
envUICon.UpdateTargetType(targetTypeInt);
|
||||
}
|
||||
|
||||
@@ -532,13 +534,15 @@ public class TargetController : MonoBehaviour
|
||||
public void FreeModeChange()
|
||||
{
|
||||
targetTypeInt = (int)SceneBlockContainer.Targets.Free;
|
||||
UpdateTargetStates();
|
||||
envUICon.UpdateTargetType(targetTypeInt);
|
||||
}
|
||||
|
||||
// change to goto mode
|
||||
public void GotoModeChange()
|
||||
public void GotoModeChange(Vector3 thisTargetPosition)
|
||||
{
|
||||
targetTypeInt = (int)SceneBlockContainer.Targets.Go;
|
||||
UpdateTargetStates(thisTargetPosition);
|
||||
envUICon.UpdateTargetType(targetTypeInt);
|
||||
}
|
||||
|
||||
@@ -546,6 +550,7 @@ public class TargetController : MonoBehaviour
|
||||
public void StayModeChange()
|
||||
{
|
||||
targetTypeInt = (int)SceneBlockContainer.Targets.Stay;
|
||||
UpdateTargetStates();
|
||||
envUICon.UpdateTargetType(targetTypeInt);
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,7 @@ public class States : MonoBehaviour
|
||||
{
|
||||
if (damageSource.tag == "Player")
|
||||
{
|
||||
damageSource.GetComponent<AgentWithGun>().KillRecord(transform.position);
|
||||
damageSource.GetComponent<AgentController>().KillRecord(transform.position);
|
||||
Destroy(this.gameObject);
|
||||
isDead = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user