public virtual void Aggrevate()
    {
        if (_aiHealth.IsDead)
        {
            return;
        }

        //Move the last known location to the players position when the player shoots.
        _lastKnownLocation.transform.position = _player.position;

        _isAggrevated = true;

        if (stateMachine == null)
        {
            stateMachine = new AIStateMachine(this);
            stateMachine.RegisterState(new AIDeathState(this));
            stateMachine.RegisterState(new AIIdleState(this));
            stateMachine.RegisterState(new AICombatState(this));
            stateMachine.RegisterState(new AISearchForPlayerState(this));
            stateMachine.RegisterState(new AICheckPlayerState(this));
            stateMachine.RegisterState(new AIMeleeState(this));

            if (_startingWeapon)
            {
                RaycastWeapon weapon = Instantiate(_startingWeapon.Weapon);

                _aiWeapon = GetComponent <AIWeapons>();
                _aiWeapon.EquipWeapon(weapon);
            }
        }

        stateMachine.ChangeState(AiStateId.CombatState);
    }
    // Start is called before the first frame update
    void Start()
    {
        //Find the player
        if (!_player)
        {
            _player = GameObject.FindGameObjectWithTag("Player").transform;
        }

        stateMachine = new AIStateMachine(this);
        stateMachine.RegisterState(new AIDeathState(this));
        stateMachine.RegisterState(new AIIdleState(this));
        stateMachine.RegisterState(new AICombatState(this));
        stateMachine.RegisterState(new AISearchForPlayerState(this));
        stateMachine.RegisterState(new AICheckPlayerState(this));
        stateMachine.RegisterState(new AIMeleeState(this));

        //Registers the patrol state if we have a patrol route
        if (_route)
        {
            stateMachine.RegisterState(new PatrolState(this, _route, _movementSpeedInPatrol, _waitAtEachPointDuration));
        }

        //If we have a starting weapon then instantiate and equip it
        if (_startingWeapon)
        {
            RaycastWeapon weapon = Instantiate(_startingWeapon.Weapon);

            _aiWeapon = GetComponent <AIWeapons>();
            _aiWeapon.EquipWeapon(weapon);
        }
        else
        {
            Debug.LogError(transform.name + " has no starting weapon");
        }

        stateMachine.ChangeState(_initialState);
        if (_initialState == AiStateId.CombatState)
        {
            Aggrevate();
        }
    }