Separated walk AI from demon/patron reactions.
This commit is contained in:
parent
0a866b7574
commit
1be47add34
11 changed files with 464 additions and 886 deletions
27
Assets/Scripts/WalkAI.cs
Normal file
27
Assets/Scripts/WalkAI.cs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class WalkAI : MonoBehaviour {
|
||||
|
||||
public GameObject[] destinations;
|
||||
public int currentDestIndex = 0;
|
||||
public Material evilMat;
|
||||
public Material neutralMat;
|
||||
|
||||
private NavMeshAgent nva;
|
||||
|
||||
void Awake() {
|
||||
nva = GetComponent<NavMeshAgent>();
|
||||
nva.updateRotation = false;
|
||||
nva.SetDestination(destinations[currentDestIndex].transform.position);
|
||||
}
|
||||
|
||||
public void NextDest() {
|
||||
if(currentDestIndex + 1 < destinations.Length)
|
||||
++currentDestIndex;
|
||||
else
|
||||
currentDestIndex = 0;
|
||||
|
||||
nva.SetDestination(destinations[currentDestIndex].transform.position);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue