final commit
This commit is contained in:
@ -4,16 +4,23 @@ using UnityEngine;
|
||||
|
||||
public class DumbAI : MonoBehaviour
|
||||
{
|
||||
public Transform feetTransform;
|
||||
// Start is called before the first frame update
|
||||
[SerializeField]
|
||||
private List<NavPoint> _aiPathRaw;
|
||||
private Queue<NavPoint> _aiPath;
|
||||
private int _nextPointId;
|
||||
|
||||
void Start()
|
||||
{
|
||||
var current_position = feetTransform.transform.position;
|
||||
_aiPath = new Queue<NavPoint>(_aiPathRaw);
|
||||
StepOnNavPoint();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
private void StepOnNavPoint()
|
||||
{
|
||||
|
||||
if (_aiPath.Count != 0)
|
||||
{
|
||||
_nextPointId = _aiPath.Peek().PointId;
|
||||
_aiPath.Dequeue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
2
Assets/Scripts/Character/DumbAI.cs.meta
generated
2
Assets/Scripts/Character/DumbAI.cs.meta
generated
@ -4,7 +4,7 @@ MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
executionOrder: 200
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
|
@ -16,13 +16,13 @@ public class MovementController : MonoBehaviour
|
||||
|
||||
public void MoveToRandomPoint()
|
||||
{
|
||||
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)]);
|
||||
}
|
||||
|
||||
public List<NavPoint> getPointsCandidate()
|
||||
{
|
||||
return MapManager.navPoints
|
||||
return MapManager.NavPoints
|
||||
.Where(point => (currentPosition.position - point.position).magnitude <= SettingsReader.Instance.GetSettings.movementSpeed)
|
||||
.ToList();
|
||||
}
|
||||
|
@ -8,10 +8,8 @@ using System.Collections.Generic;
|
||||
[RequireComponent(typeof(MovementController))]
|
||||
public class NPC : Agent, ICharacter
|
||||
{
|
||||
[HideInInspector]
|
||||
public Character AgentCharacter;
|
||||
public CharacterCondition Condition;
|
||||
|
||||
private Character AgentCharacter;
|
||||
private CharacterCondition Condition;
|
||||
public NPC_BaseState NPC_State { get; private set; }
|
||||
|
||||
public Character GetCharacter => AgentCharacter;
|
||||
|
Reference in New Issue
Block a user