Skip to content

Instantly share code, notes, and snippets.

@unity3dcollege
Created August 30, 2017 17:31
Show Gist options
  • Save unity3dcollege/edeff73621d7e02cbbcc1e9ba953967d to your computer and use it in GitHub Desktop.
Save unity3dcollege/edeff73621d7e02cbbcc1e9ba953967d to your computer and use it in GitHub Desktop.
using UnityEngine;
using UnityEngine.AI;
public class Character : MonoBehaviour
{
private CharacterBrain brain;
private void Start()
{
UseAIBrain();
}
private void Update()
{
brain.Tick();
}
public void UsePlayerBrain()
{
brain = new PlayerBrain(GetComponent<NavMeshAgent>());
}
public void UseAIBrain()
{
brain = new AIBrain(GetComponent<NavMeshAgent>());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment