public override void Start() { base.Start(); NavAgent = GetComponent <NavMeshAgent>(); // currentBehaviour = new Seek(this, behSettings); currentBehaviour = new GoTo(this, behSettings); currentBehaviour.OnStart(); }
public void SwitchBehaviour(AI_Behaviour newBehaviour) { if (currentBehaviour == null) { currentBehaviour = newBehaviour; currentBehaviour.OnStart(); previousBehaviour = currentBehaviour; return; } if (currentBehaviour != newBehaviour) { previousBehaviour = currentBehaviour; currentBehaviour.OnExit(); currentBehaviour = newBehaviour; currentBehaviour.OnStart(); } }