forked from cgvr/DeltaVR
npcs turn towards the player separately from being aggroed
This commit is contained in:
@@ -121,14 +121,14 @@ public abstract class NPCController : MonoBehaviour
|
||||
currentVoicelineEvent.release();
|
||||
}
|
||||
|
||||
public void PlayerApproach(Transform player) {
|
||||
playerTransform = player;
|
||||
public void PlayerApproach() {
|
||||
|
||||
OnPlayerApproach();
|
||||
}
|
||||
|
||||
public void PlayerLeave()
|
||||
{
|
||||
playerTransform = null;
|
||||
|
||||
OnPlayerLeave();
|
||||
}
|
||||
|
||||
@@ -136,6 +136,22 @@ public abstract class NPCController : MonoBehaviour
|
||||
|
||||
protected virtual void OnPlayerLeave() {}
|
||||
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if (other.gameObject.tag == "Player Head")
|
||||
{
|
||||
playerTransform = other.transform;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerExit(Collider other)
|
||||
{
|
||||
if (other.gameObject.tag == "Player Head")
|
||||
{
|
||||
playerTransform = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void SpeakVoiceLine(int voiceLineId, GameObject emitter = null, float radioAmount = 0f)
|
||||
{
|
||||
if (voiceLineId < 0 || voiceLineId >= voiceLineKeys.Length)
|
||||
|
||||
Reference in New Issue
Block a user