Example #1
0
    public override void Start()
    {
        base.Start();
        NavAgent = GetComponent <NavMeshAgent>();

        // currentBehaviour = new Seek(this, behSettings);
        currentBehaviour = new GoTo(this, behSettings);
        currentBehaviour.OnStart();
    }
Example #2
0
    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();
        }
    }