Created
August 30, 2017 17:31
-
-
Save unity3dcollege/edeff73621d7e02cbbcc1e9ba953967d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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