Fixed nan exception

This commit is contained in:
2022-05-18 01:37:06 +07:00
parent 4132787ef8
commit 7db8dbcfcf
8 changed files with 336 additions and 15 deletions

View File

@ -1309,7 +1309,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_SensorName: BufferSensor
m_ObservableSize: 5
m_ObservableSize: 4
m_MaxNumObservables: 118
--- !u!114 &5398236930075563215
MonoBehaviour:

View File

@ -849,6 +849,81 @@ Transform:
type: 3}
m_PrefabInstance: {fileID: 141161531}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &172049156
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 2059424040}
m_Modifications:
- target: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_RootOrder
value: 26
objectReference: {fileID: 0}
- target: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_LocalPosition.x
value: -63.85
objectReference: {fileID: 0}
- target: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_LocalPosition.z
value: 34.06
objectReference: {fileID: 0}
- target: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_LocalRotation.w
value: 0.9425063
objectReference: {fileID: 0}
- target: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_LocalRotation.y
value: 0.33418855
objectReference: {fileID: 0}
- target: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 39.046
objectReference: {fileID: 0}
- target: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3795099593284827133, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_Name
value: Cover_3 (15)
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: d8275b9af6784b74c8967f4d816626bb, type: 3}
--- !u!4 &172049157 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
m_PrefabInstance: {fileID: 172049156}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &229753248
PrefabInstance:
m_ObjectHideFlags: 0
@ -1014,7 +1089,7 @@ PrefabInstance:
- target: {fileID: 7378066357312323926, guid: f58a14c8ba97dfa4f9f4103bbee852d4,
type: 3}
propertyPath: m_LocalPosition.x
value: -106.5
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7378066357312323926, guid: f58a14c8ba97dfa4f9f4103bbee852d4,
type: 3}
@ -1024,7 +1099,7 @@ PrefabInstance:
- target: {fileID: 7378066357312323926, guid: f58a14c8ba97dfa4f9f4103bbee852d4,
type: 3}
propertyPath: m_LocalPosition.z
value: 23.6
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7378066357312323926, guid: f58a14c8ba97dfa4f9f4103bbee852d4,
type: 3}
@ -2032,6 +2107,11 @@ PrefabInstance:
propertyPath: m_Name
value: Spawn (1)
objectReference: {fileID: 0}
- target: {fileID: 4255753142809516133, guid: 4cfff540e080a384d9b353f00e6fa431,
type: 3}
propertyPath: m_LocalPosition.x
value: -3.73
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 4cfff540e080a384d9b353f00e6fa431, type: 3}
--- !u!4 &571822923 stripped
@ -3300,6 +3380,81 @@ Transform:
m_Father: {fileID: 535118393}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &985247346
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 2059424040}
m_Modifications:
- target: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_RootOrder
value: 28
objectReference: {fileID: 0}
- target: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_LocalPosition.x
value: -60.46
objectReference: {fileID: 0}
- target: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_LocalPosition.z
value: 28.39
objectReference: {fileID: 0}
- target: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_LocalRotation.w
value: -0.45593947
objectReference: {fileID: 0}
- target: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_LocalRotation.y
value: 0.8900108
objectReference: {fileID: 0}
- target: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 234.25099
objectReference: {fileID: 0}
- target: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3795099593284827133, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_Name
value: Cover_3 (17)
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: d8275b9af6784b74c8967f4d816626bb, type: 3}
--- !u!4 &985247347 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
m_PrefabInstance: {fileID: 985247346}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &992268555
PrefabInstance:
m_ObjectHideFlags: 0
@ -3916,6 +4071,81 @@ Transform:
type: 3}
m_PrefabInstance: {fileID: 1046330343}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &1061569220
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 2059424040}
m_Modifications:
- target: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_RootOrder
value: 27
objectReference: {fileID: 0}
- target: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_LocalPosition.x
value: -58.85
objectReference: {fileID: 0}
- target: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_LocalPosition.z
value: 32.17
objectReference: {fileID: 0}
- target: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_LocalRotation.w
value: 0.4561691
objectReference: {fileID: 0}
- target: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_LocalRotation.y
value: 0.8898932
objectReference: {fileID: 0}
- target: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 125.72001
objectReference: {fileID: 0}
- target: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3795099593284827133, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_Name
value: Cover_3 (16)
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: d8275b9af6784b74c8967f4d816626bb, type: 3}
--- !u!4 &1061569221 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
m_PrefabInstance: {fileID: 1061569220}
m_PrefabAsset: {fileID: 0}
--- !u!4 &1079073055 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 757972022053882386, guid: 4cfff540e080a384d9b353f00e6fa431,
@ -4648,7 +4878,7 @@ PrefabInstance:
- target: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_LocalPosition.x
value: -95.24
value: -97.55
objectReference: {fileID: 0}
- target: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
@ -5249,6 +5479,81 @@ Transform:
type: 3}
m_PrefabInstance: {fileID: 1560844638}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &1561457766
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 2059424040}
m_Modifications:
- target: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_RootOrder
value: 25
objectReference: {fileID: 0}
- target: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_LocalPosition.x
value: -65.42
objectReference: {fileID: 0}
- target: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_LocalPosition.z
value: 29.34
objectReference: {fileID: 0}
- target: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_LocalRotation.w
value: 0.9961947
objectReference: {fileID: 0}
- target: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_LocalRotation.y
value: -0.08715578
objectReference: {fileID: 0}
- target: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: -10
objectReference: {fileID: 0}
- target: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3795099593284827133, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
propertyPath: m_Name
value: Cover_3 (14)
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: d8275b9af6784b74c8967f4d816626bb, type: 3}
--- !u!4 &1561457767 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 3795099593284827132, guid: d8275b9af6784b74c8967f4d816626bb,
type: 3}
m_PrefabInstance: {fileID: 1561457766}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &1586338151
PrefabInstance:
m_ObjectHideFlags: 0
@ -5325,6 +5630,11 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 760001244}
m_Modifications:
- target: {fileID: 6818223691859422290, guid: 1685c1d9ce4ab174f95c646b1826010b,
type: 3}
propertyPath: m_Radius
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6818223691859422291, guid: 1685c1d9ce4ab174f95c646b1826010b,
type: 3}
propertyPath: m_Name
@ -6478,6 +6788,10 @@ Transform:
- {fileID: 569436203}
- {fileID: 1008451103}
- {fileID: 1141646483}
- {fileID: 1561457767}
- {fileID: 172049157}
- {fileID: 1061569221}
- {fileID: 985247347}
m_Father: {fileID: 760001244}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -6641,6 +6955,11 @@ PrefabInstance:
propertyPath: m_Name
value: Spawn
objectReference: {fileID: 0}
- target: {fileID: 4255753142809516133, guid: 4cfff540e080a384d9b353f00e6fa431,
type: 3}
propertyPath: m_LocalPosition.x
value: 5.79
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 4cfff540e080a384d9b353f00e6fa431, type: 3}
--- !u!1001 &3795099594054657013

View File

@ -44,14 +44,18 @@ public class MovementController : MonoBehaviour
private void Update()
{
var thisPoint = _idNavPointDict[PointStartID];
if (ReachedDestination())
{
_myNpc.ChangePointState(_idNavPointDict[PointStartID].navType == NavPointType.Cover
_myNpc.ChangePointState(thisPoint.navType == NavPointType.Cover
? NpcEnumState.InCover
: NpcEnumState.InDirectPoint);
thisPoint.isOcuppied = true;
}
else
{
thisPoint.isOcuppied = false;
_idNavPointDict[PointEndID].isOcuppied = false;
_myNpc.ChangeBodyState(NpcBodyState.Standing);
_myNpc.ChangePointState(NpcEnumState.InRunning);
}
@ -78,7 +82,7 @@ public class MovementController : MonoBehaviour
{
return MapManager.Instance.NavPoints
.Where(point =>
(transform.position - point.Position).magnitude < _settings.MovementDistance)
(transform.position - point.Position).magnitude < _settings.MovementDistance && point.isOcuppied == false)
.ToList();
}

View File

@ -132,9 +132,7 @@ public class NPC : Agent, ICharacter
//state sensors
sensor.AddObservation((int)NpcState.State);
sensor.AddObservation((int)NpcBodyState.State);
sensor.AddObservation(GameManager.IsEnemyNearby(gameObject.transform.position, GetCharacter.Team));
//sensor.AddObservation(_navPointIdDict[_moveController.PointStartID].DeathAttr);
//sensor.AddObservation(_navPointIdDict[_moveController.PointEndID].DeathAttr);
sensor.AddObservation(GameManager.IsEnemyNearby(gameObject.transform.position, GetCharacter.Team));
sensor.AddObservation(_moveController.FlagDistance);
//point sensors
@ -142,13 +140,9 @@ public class NPC : Agent, ICharacter
{
var position = transform.position;
_bufferSensor.AppendObservation(new float[] {
point.DeathAttr,
(int)point.navType,
//4 flagEnemyDistance
GameManager.IsCloserToFlagFromNextNavPoint(point, position).ToInt(),
//5 EnemyVsNavPointDistance
GameManager.IsCloserToEnemyThanToNextNavPoint(point, position, GetCharacter.Team.GetOppositeTeam()).ToInt(),
//6 Have been seen by enemy in this point
GameManager.IsHaveSeenByEnemy(GetCharacter.Team.GetOppositeTeam(),
point.Position).ToInt()
});

View File

@ -56,6 +56,7 @@ public class FlagZone : MonoBehaviour
}
else if (occupAttackers > 0)
{
print("Atackers ocuppy flag");
TimeStayAttackers += Time.deltaTime;
GameManager._attackersTeam.AddGroupReward(Time.deltaTime* 0.1f);
GameManager._defendersTeam.AddGroupReward(-Time.deltaTime* 0.1f);
@ -67,6 +68,8 @@ public class FlagZone : MonoBehaviour
}
else if (occupDefenders > 0)
{
print("Defenders ocuppy flag");
GameManager._defendersTeam.AddGroupReward(+Time.deltaTime* 0.1f);
TimeStayDefenders += Time.deltaTime;
if (TimeStayDefenders > timeForWin)
{

View File

@ -15,6 +15,7 @@ public class NavPoint : MonoBehaviour
public float FlagDistance { get; private set; }
[SerializeField] public NavPointType navType;
[HideInInspector] public bool isOcuppied;
[HideInInspector] public int PointId = 0;
[HideInInspector] public float DeathAttr = 0;

View File

@ -19,8 +19,8 @@ MonoBehaviour:
MovementSpeed: 1
DefTeamAI: 3
AtcTeamAI: 3
NumOfDefenders: 2
NumOfAttackers: 2
NumOfDefenders: 3
NumOfAttackers: 3
HasHumanDefender: 0
HasHumanAttacker: 0
HealthPickupAmount: 50