Finally bots can die. Player to. And another fixes.

This commit is contained in:
2022-05-17 00:21:53 +07:00
parent 06fdfc077c
commit 229c4490c4
15 changed files with 160 additions and 171 deletions

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using Animators.Leonid_Animator.Player;
using Unity.MLAgents;
using UnityEngine;
@ -48,7 +49,7 @@ public class GameManager : MonoBehaviour
if ((SettingsReader.Instance.GetSettings.HasHumanAttacker == true && oppositeTeam == Team.Attackers) ||
(SettingsReader.Instance.GetSettings.HasHumanDefender == true && oppositeTeam == Team.Defenders))
{
if (distToNavPoint > (currentTransform - CharacterFactory.Instance.player.transform.position).magnitude)
if (distToNavPoint > (currentTransform - CharacterFactory.Instance.Player.transform.position).magnitude)
return true;
}
return false;
@ -64,7 +65,7 @@ public class GameManager : MonoBehaviour
if ((SettingsReader.Instance.GetSettings.HasHumanAttacker == true && oppositeTeam == Team.Attackers) ||
(SettingsReader.Instance.GetSettings.HasHumanDefender == true && oppositeTeam == Team.Defenders))
{
if ((currentTransform - CharacterFactory.Instance.player.transform.position).magnitude < SettingsReader.Instance.GetSettings.ViewDistance)
if ((currentTransform - CharacterFactory.Instance.Player.transform.position).magnitude < SettingsReader.Instance.GetSettings.ViewDistance)
return true;
}
return false;
@ -99,9 +100,9 @@ public class GameManager : MonoBehaviour
if ((SettingsReader.Instance.GetSettings.HasHumanAttacker == true && oppositeTeam == Team.Attackers) ||
(SettingsReader.Instance.GetSettings.HasHumanDefender == true && oppositeTeam == Team.Defenders))
{
var player = CharacterFactory.Instance.player;
var player = CharacterFactory.Instance.Player;
if (Physics.Raycast(position,
(player.GetComponent<MeshRenderer>().bounds.center - position).normalized,
(player.GetComponent<CharacterLocomotion>().GetMeshCenter() - position).normalized,
out rayHit,
SettingsReader.Instance.GetSettings.ViewDistance))
{

View File

@ -47,16 +47,15 @@ public class MapManager : MonoBehaviour
var startNavPoint = _instance.IDToNavPoint[startPoint];
var endNavPoint = _instance.IDToNavPoint[endPoint];
float coef;
try
if (allDistance != 0)
{
coef = remainingDistance / allDistance;
startNavPoint.DeathAttr += 1 - coef;
endNavPoint.DeathAttr += coef;
}
catch (System.ArithmeticException)
else
{
Debug.LogError("Path Length is zero");
return;
startNavPoint.DeathAttr += 1;
}
startNavPoint.DeathAttr += 1 - coef;
endNavPoint.DeathAttr += coef;
}
}