Fixed merge errors
This commit is contained in:
@ -9,22 +9,12 @@ public class CharacterCondition
|
||||
public event Action<int> OnChangeAmmunitionEvent;
|
||||
|
||||
private int health;
|
||||
<<<<<<< HEAD
|
||||
public int HealthPoints
|
||||
{
|
||||
get
|
||||
{
|
||||
return health;
|
||||
}
|
||||
=======
|
||||
|
||||
public int HealthPoints
|
||||
{
|
||||
get
|
||||
{
|
||||
return health;
|
||||
}
|
||||
>>>>>>> 351fa8ee12c499a0374be71a192a5f288611f467
|
||||
private set
|
||||
{
|
||||
health = value;
|
||||
|
@ -6,18 +6,11 @@ using UnityEngine.AI;
|
||||
[RequireComponent(typeof(NavMeshAgent))]
|
||||
public class MovementController : MonoBehaviour
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
public int PointStartID { get; set; }
|
||||
public int PointEndID { get; private set; }
|
||||
public float FlagDistance { get; private set; }
|
||||
private const float updateFlagPositionDelay = 5;
|
||||
private const float updateReachedDestinationDelay = 5;
|
||||
=======
|
||||
public NavPoint currentPosition { get; set; }
|
||||
private Dictionary<int, NavPoint> navPoints = new Dictionary<int, NavPoint>();
|
||||
|
||||
[SerializeField] private NavMeshAgent navMeshAgent;
|
||||
>>>>>>> 351fa8ee12c499a0374be71a192a5f288611f467
|
||||
|
||||
[SerializeField] private NavMeshAgent navMeshAgent;
|
||||
[SerializeField] private GameObject flag;
|
||||
@ -28,7 +21,6 @@ public class MovementController : MonoBehaviour
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
navMeshAgent.speed = SettingsReader.Instance.GetSettings.MovementSpeed;
|
||||
idNavPointDict = MapManager.IDToNavPoint;
|
||||
InvokeRepeating(nameof(UpdateFlagPosition), 0, updateFlagPositionDelay);
|
||||
@ -43,12 +35,6 @@ public class MovementController : MonoBehaviour
|
||||
private void UpdateFlagPosition()
|
||||
{
|
||||
FlagDistance = (flag.transform.position - gameObject.transform.position).magnitude;
|
||||
=======
|
||||
navMeshAgent.speed = SettingsReader.Instance.GetSettings.movementSpeed;
|
||||
foreach (var np in MapManager.navPoints) {
|
||||
navPoints[np.PointId] = np;
|
||||
}
|
||||
>>>>>>> 351fa8ee12c499a0374be71a192a5f288611f467
|
||||
}
|
||||
|
||||
public void MoveToPointById(int id)
|
||||
@ -62,27 +48,16 @@ public class MovementController : MonoBehaviour
|
||||
}
|
||||
|
||||
public void MoveToRandomPoint()
|
||||
<<<<<<< HEAD
|
||||
{
|
||||
Debug.Log(MapManager.NavPoints == null);
|
||||
GoToNextNavPoint(MapManager.NavPoints[Random.Range(0, MapManager.NavPoints.Count)]);
|
||||
=======
|
||||
{
|
||||
// Debug.Log(MapManager.navPoints == null);
|
||||
goToNextNavPoint(MapManager.navPoints[Random.Range(0, MapManager.navPoints.Count)]);
|
||||
>>>>>>> 351fa8ee12c499a0374be71a192a5f288611f467
|
||||
}
|
||||
|
||||
public List<NavPoint> GetPointsCandidate()
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
return MapManager.NavPoints
|
||||
.Where(point =>
|
||||
(idNavPointDict[PointStartID].Position - point.Position).magnitude < SettingsReader.Instance.GetSettings.MovementDistance)
|
||||
=======
|
||||
return MapManager.navPoints
|
||||
.Where(point => (currentPosition.position - point.position).magnitude < SettingsReader.Instance.GetSettings.movementDistance)
|
||||
>>>>>>> 351fa8ee12c499a0374be71a192a5f288611f467
|
||||
.ToList();
|
||||
}
|
||||
|
||||
|
@ -70,14 +70,7 @@ public class NPC : Agent, ICharacter
|
||||
|
||||
public override void CollectObservations(VectorSensor sensor)
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
var candidates = moveController.GetPointsCandidate();
|
||||
=======
|
||||
sensor.AddObservation(Condition.HealthPoints);
|
||||
sensor.AddObservation(Condition.ArmourPoints);
|
||||
sensor.AddObservation(Condition.Ammunition);
|
||||
sensor.AddObservation((int) NPC_State.State);
|
||||
>>>>>>> 351fa8ee12c499a0374be71a192a5f288611f467
|
||||
|
||||
//common sensors
|
||||
sensor.AddObservation(GameManager.IsHaveSeenByEnemy(AgentCharacter.Team.GetOppositeTeam(),
|
||||
@ -100,7 +93,6 @@ public class NPC : Agent, ICharacter
|
||||
//point sensors
|
||||
foreach (var point in candidates)
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
bufferSensor.AppendObservation(new float[] {
|
||||
point.DeathAttr,
|
||||
(int)point.navType,
|
||||
@ -112,35 +104,6 @@ public class NPC : Agent, ICharacter
|
||||
GameManager.IsHaveSeenByEnemy(AgentCharacter.Team.GetOppositeTeam(),
|
||||
point.Position).ToInt()
|
||||
});
|
||||
=======
|
||||
var parray = new float[]
|
||||
{
|
||||
//1 position in navpointId
|
||||
(float) moveController.currentPosition.PointId,
|
||||
//2 distance to flag
|
||||
moveController.currentPosition.FlagDistance,
|
||||
//3 death count in point
|
||||
moveController.currentPosition.DeathAttr,
|
||||
//4 flagEnemyDistance
|
||||
GameManager.IsCloserToFlagFromNextNavPoint(point, transform.position) == true ? 1 : 0,
|
||||
//5 EnemyVsNavPointDistance
|
||||
GameManager.IsCloserToEnemyThanToNextNavPoint(point, transform.position, AgentCharacter.Team) == true
|
||||
? 1
|
||||
: 0
|
||||
};
|
||||
// var _parray = string.Join(" ", parray);
|
||||
// Debug.Log("OBS: " + _parray);
|
||||
bufferSensor.AppendObservation(parray);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Heuristic(in ActionBuffers actionsOut)
|
||||
{
|
||||
var discreteActionsOut = actionsOut.DiscreteActions;
|
||||
if (Input.GetKeyDown(KeyCode.W))
|
||||
{
|
||||
discreteActionsOut[0] = 1;
|
||||
>>>>>>> 351fa8ee12c499a0374be71a192a5f288611f467
|
||||
}
|
||||
}
|
||||
|
||||
@ -149,7 +112,6 @@ public class NPC : Agent, ICharacter
|
||||
var result = actions.DiscreteActions;
|
||||
if (result[0] == 0)
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
if (navPointIdDict[moveController.PointStartID].navType != NavPointType.Cover)
|
||||
return;
|
||||
NpcState = CoverState;
|
||||
@ -185,13 +147,6 @@ public class NPC : Agent, ICharacter
|
||||
case 1: moveController.ReturnToStartPoint(); NpcState = RunningState; break;
|
||||
default: throw new ArgumentException("Undefined Action recieved");
|
||||
}
|
||||
=======
|
||||
moveController.MoveToRandomPoint();
|
||||
NPC_State = RunningState;
|
||||
} else if (actions.DiscreteActions[0] == 2)
|
||||
{
|
||||
moveController.MoveToPointById(actions.DiscreteActions[1]);
|
||||
>>>>>>> 351fa8ee12c499a0374be71a192a5f288611f467
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
@ -17,21 +17,12 @@ public class NavPoint : MonoBehaviour
|
||||
public NavPointType navType = NavPointType.Direction;
|
||||
|
||||
[HideInInspector]
|
||||
<<<<<<< HEAD
|
||||
public int PointId = 0;
|
||||
=======
|
||||
public int PointId;
|
||||
>>>>>>> 351fa8ee12c499a0374be71a192a5f288611f467
|
||||
public float DeathAttr = 0;
|
||||
public List<Vector3> EnemiesSeen = new List<Vector3>();
|
||||
|
||||
private void Start()
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
FlagDistance = (GameObject.FindGameObjectWithTag("Flag").transform.position - Position).magnitude;
|
||||
=======
|
||||
PointId = GetInstanceID();
|
||||
FlagDistance = (GameObject.FindGameObjectWithTag("Flag").transform.position - position).magnitude;
|
||||
>>>>>>> 351fa8ee12c499a0374be71a192a5f288611f467
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user