private void Actions_Following()
    {
        mNavMeshAgent.SetDestination(mTargetToFollow.position);

        if (mNavMeshAgent.speed != nisseVariables.normalSpeed)
        {
            mNavMeshAgent.speed = nisseVariables.normalSpeed;
        }
        if (mNavMeshAgent.speed != nisseVariables.normalAcceleration)
        {
            mNavMeshAgent.speed = nisseVariables.normalAcceleration;
        }

        if (!mAnimations.Animations_GetMovementState())
        {
            mAnimations.Animations_SetMovementState(true);
        }


        //Debugging if player ever LOS the target.
        if (!TargetInSight())
        {
            mCurrentStance = TypeOfStance.Idle;
        }
    }
    private void CheckRangeOfTarget()
    {
        if (!isDying)
        {
            float distanceToTarget = (mTargetToFollow.position - transform.position).magnitude;

            if (distanceToTarget < nisseVariables.detectionRange && mCurrentStance == TypeOfStance.Idle)
            {
                if (TargetInSight())
                {
                    mCurrentStance = TypeOfStance.Following;
                }
            }
            else if (distanceToTarget < nisseVariables.combatRange && mCurrentStance == TypeOfStance.Following)
            {
                if (TargetInSight())
                {
                    mCurrentStance = TypeOfStance.Throwing;
                }
                else
                {
                    mCurrentStance = TypeOfStance.Idle;
                }
            }
        }
    }
    private IEnumerator ReatreatDuration()
    {
        yield return(new WaitForSeconds(durationOfRetreat));

        if (!deathStart)
        {
            mCurrentStance = TypeOfStance.Reloading;
        }
    }
    private IEnumerator Reloading()
    {
        yield return(new WaitForSeconds(reloadDuration));

        if (!deathStart)
        {
            mCurrentStance   = TypeOfStance.Following;
            reloadingStarted = false;
        }
    }
 public void DoneThrowing()
 {
     if (mTargetToFollow.tag == "Player")
     {
         mCurrentStance = TypeOfStance.Retreating;
     }
     else
     {
         needToReload   = false;
         mCurrentStance = TypeOfStance.Idle;
     }
 }
 private void Actions_RePosition()
 {
     if (!TargetInSight())
     {
         mNavMeshAgent.SetDestination(mTargetToFollow.position);
     }
     else
     {
         SetLocationToThrowAt();
         mCurrentStance = TypeOfStance.Throwing;
     }
 }
    public void Initialize_Death()
    {
        GetComponent <TargetBehavior>().IsTargetDead = true;
        mCurrentStance = TypeOfStance.Dying;
        deathStart     = true;
        Destroy(gameObject, 1f);
        GameObject nisseDeathExplosion = Instantiate(deathExplosion, transform.position, Quaternion.identity, null);

        Destroy(nisseDeathExplosion, 2f);
        mAnimations.Animation_Death();
        Destroy(currentObjectToThrow);
        currentScale = transform.localScale.x;
    }
 public void AnimationEvent_DoneTakingDamage()
 {
     mCurrentStance = TypeOfStance.Retreating;
     needToReload   = true;
 }
 public void TookDamage()
 {
     Destroy(currentObjectToThrow);
     mCurrentStance = TypeOfStance.TakingDamage;
     tookDamage     = true;
 }