public void PerFrameUpdate()
    {
        if (ParentCharacter.MyAI.BlackBoard.TargetEnemy != null)
        {
            //check if is in range
            _dist = Vector3.Distance(ParentCharacter.transform.position, ParentCharacter.MyAI.BlackBoard.TargetEnemy.transform.position);

            if (_dist > 1.5f && _biteState != BiteState.Bite)
            {
                //go to target enemy
                ParentCharacter.MyAI.BlackBoard.NavTarget = ParentCharacter.MyAI.BlackBoard.TargetEnemy.transform.position - ParentCharacter.MyAI.BlackBoard.TargetEnemy.transform.forward * 0.5f;
                ParentCharacter.Destination   = ParentCharacter.MyAI.BlackBoard.NavTarget;
                ParentCharacter.CurrentStance = HumanStances.Run;
                ParentCharacter.SendCommand(CharacterCommands.GoToPosition);
            }
            else if (_dist > 1.5f && _biteState == BiteState.Bite)
            {
                ParentCharacter.GetComponent <MutantCharacter>().OnCancelStrangle();
                StopAction();
                ParentCharacter.MyEventHandler.TriggerOnActionCompletion();
            }
            else
            {
                if (_biteState != BiteState.Bite)
                {
                    //Debug.Log("Ready to bite");
                    ParentCharacter.SendCommand(CharacterCommands.Bite);
                    _biteState = BiteState.Bite;
                }
            }
        }
    }
    public void UpdateAction()
    {
        if (!CheckAvailability())
        {
            return;
        }

        if (ParentCharacter.MyReference.CurrentWeapon == null)
        {
            ParentCharacter.SendCommand(ParentCharacter.MyAI.WeaponSystem.GetBestWeaponChoice());
        }

        if (_isCoverFound)
        {
            ParentCharacter.SendCommand(CharacterCommands.StopAim);
            ParentCharacter.SendCommand(CharacterCommands.StopCrouch);
            ParentCharacter.GetComponent <HumanCharacter>().CurrentStance = HumanStances.Sprint;


            ParentCharacter.MyAI.BlackBoard.NavTarget = ParentCharacter.MyAI.BlackBoard.SelectedCoverLoc;
            //GameObject.Find("Marker1").transform.position = ParentCharacter.MyAI.BlackBoard.SelectedCoverLoc;
            //GameObject.Find("Sphere").transform.position = ParentCharacter.MyAI.BlackBoard.SelectedCover.transform.position;
            ParentCharacter.Destination = ParentCharacter.MyAI.BlackBoard.NavTarget;
            ParentCharacter.SendCommand(CharacterCommands.GoToPosition);

            ParentCharacter.MyAI.TargetingSystem.SetTargetingMode(AITargetingModes.LookAround, ParentCharacter.MyAI.BlackBoard.AvgPersonalThreatDir);
        }


        if (CheckActionCompletion())
        {
            StopAction();
            ParentCharacter.MyEventHandler.TriggerOnActionCompletion();
        }
    }
    private void SetCollider(float height, float center, int direction)
    {
        CapsuleCollider collider = ParentCharacter.GetComponent <CapsuleCollider>();

        collider.height    = height;
        collider.center    = new Vector3(0, center, 0);
        collider.direction = direction;
    }
    public void UpdateAction()
    {
        if (!CheckAvailability())
        {
            return;
        }


        if (_isCoverFound)
        {
            ParentCharacter.SendCommand(CharacterCommands.StopAim);
            ParentCharacter.GetComponent <HumanCharacter>().CurrentStance = HumanStances.Sprint;
            ParentCharacter.MyAI.BlackBoard.NavTarget = ParentCharacter.MyAI.BlackBoard.SelectedCoverLoc;
            //GameObject.Find("Marker1").transform.position = ParentCharacter.MyAI.BlackBoard.SelectedCoverLoc;
            //GameObject.Find("Sphere").transform.position = ParentCharacter.MyAI.BlackBoard.SelectedCover.transform.position;
            ParentCharacter.Destination = ParentCharacter.MyAI.BlackBoard.NavTarget;
            ParentCharacter.SendCommand(CharacterCommands.GoToPosition);
        }


        if (CheckActionCompletion())
        {
            StopAction();
            Character target = ParentCharacter.MyAI.BlackBoard.TargetEnemy;
            if (target == null)
            {
                target = ParentCharacter.MyAI.BlackBoard.InvisibleEnemy;
            }

            if (target != null)
            {
                ParentCharacter.MyAI.TargetingSystem.SetTargetingMode(AITargetingModes.LookAround, target.transform.position - ParentCharacter.transform.position);
            }
            ParentCharacter.MyEventHandler.TriggerOnActionCompletion();
        }
    }
    public void UpdateAction()
    {
        if (!CheckAvailability() || _executionStopped)
        {
            return;
        }

        if (!_hasStarted)
        {
            //Debug.Log("is in area " + ParentCharacter.MyAI.BlackBoard.HighestDisturbanceLoc + " " + ParentCharacter.MyAI.BlackBoard.PatrolLoc + " " + ParentCharacter.MyAI.BlackBoard.CombatRange);
            bool isInArea = AI.IsPositionInArea(ParentCharacter.MyAI.BlackBoard.HighestDisturbanceLoc,
                                                ParentCharacter.MyAI.BlackBoard.PatrolLoc,
                                                ParentCharacter.MyAI.BlackBoard.CombatRange);


            bool isPlayerPartyMember = GameManager.Inst.PlayerControl.Party.Members.Contains(ParentCharacter.GetComponent <HumanCharacter>());


            //Debug.Log("Investigating... is in area? " + isInArea + ", disturbance threat " + ParentCharacter.MyAI.BlackBoard.HighestDisturbanceThreat);

            /** threats
             * 0 - look at direction
             * 1 - not alarmed, walk to check
             * 2 - alarmed, run to check
             *
             * 0 - when threat < 0.3 or when disturb is outside combat range
             * 1 - when threat > 0.3 and < 0.6 and disturb is inside combat range or inside immediate distance
             * 2 - when threat > 0.6
             **/

            /*
             * if(isPlayerPartyMember)
             * {
             *      _willInvestigate = false;
             *      Vector3 disturbDist = ParentCharacter.MyAI.BlackBoard.HighestDisturbanceLoc - ParentCharacter.transform.position;
             *      ParentCharacter.MyAI.TargetingSystem.SetTargetingMode(AITargetingModes.LookAround, disturbDist);
             * }
             */

            float   disturbThreat       = ParentCharacter.MyAI.BlackBoard.HighestDisturbanceThreat;
            Vector3 disturbDist         = ParentCharacter.MyAI.BlackBoard.HighestDisturbanceLoc - ParentCharacter.transform.position;
            bool    isImmediateDistance = disturbDist.magnitude < 15;
            if (disturbThreat > 0.6f)
            {
                //Debug.Log("Investigating: run to check " + ParentCharacter.name);
                //weapon drawn, flashlight on, run to check
                _willInvestigate = true;
                ParentCharacter.MyAI.BlackBoard.GuardLevel = 2;
                ParentCharacter.SendCommand(CharacterCommands.SetAlert);
                ParentCharacter.CurrentStance = HumanStances.Run;


                ParentCharacter.SendCommand(CharacterCommands.StopAim);

                ParentCharacter.Destination = ParentCharacter.MyAI.BlackBoard.HighestDisturbanceLoc;
                ParentCharacter.SendCommand(CharacterCommands.GoToPosition);
            }
            else
            {
                if ((isInArea || isImmediateDistance) && disturbThreat >= 0.3f)
                {
                    if (disturbThreat < 0.6f)
                    {
                        //weapon holstered, walk to check
                        ParentCharacter.SendCommand(CharacterCommands.SetAlert);
                        _willInvestigate = true;
                        ParentCharacter.CurrentStance = HumanStances.Walk;
                        ParentCharacter.SendCommand(CharacterCommands.StopAim);
                    }


                    ParentCharacter.Destination = ParentCharacter.MyAI.BlackBoard.HighestDisturbanceLoc;
                    ParentCharacter.SendCommand(CharacterCommands.GoToPosition);
                }
                else
                {
                    //only look at direction
                    _willInvestigate = false;
                    ParentCharacter.MyAI.TargetingSystem.SetTargetingMode(AITargetingModes.LookAround, disturbDist);
                }
            }



            _hasStarted = true;
        }

        if (Vector3.Distance(ParentCharacter.transform.position, ParentCharacter.Destination.Value) < 1 && _willInvestigate)
        {
            ParentCharacter.MyAI.TargetingSystem.SetTargetingMode(AITargetingModes.LookAround, Vector3.zero);
        }


        if (CheckActionCompletion())
        {
            StopAction();
            ParentCharacter.MyEventHandler.TriggerOnActionCompletion();
        }
    }