Beispiel #1
0
    //This can be upgraded
    private void DetermineFearState()
    {
        //
        if (fearCurrent == fearMax && fearReset != fearMax)
        {

            //
            fearState = fearCase.feared;

            //Increases the fear reset point for when the NPC leaves fear
            fearReset += scaleFearReset;

            //
            hasBeenFeared = true;
        }

        //This creates a diminishing return where the NPC eventually becomes unfearable
        else if (fearCurrent == fearReset)
        {

            //
            fearState = fearCase.notFeared;

            //
            hasBeenFeared = false;
        }
    }
Beispiel #2
0
    void Start()
    {
        //Assigns NavMeshAgent
        agent = GetComponent<NavMeshAgent>();

        //Initial destination is first element of the array
        currentDest = 0;

        //Sets initial fearState to not feared
        fearState = fearCase.notFeared;

        //
        if (randomizeNavPoints)
            RandomizeNavPoints();

        //Assigns agent's first destination to first array element
        agent.destination = navPoints[currentDest].transform.position;
    }