Example #1
0
 archerBehaviour()    //The behaviour method for Archers. Includes shooting their bow and maintaining distance.
 {
     if (isSearching) //Behaviour for beelining to the goblins
     {
         if ((goblin.CompareTag("Goblin")) &&
             (Vector2.Distance(body.transform.position, goblin.transform.position) >= 5f)
             ) //Check if the goblins are outside near range but inside visible range
         {
             body.velocity = ((Vector2)goblin.transform.position - body.position).normalized * speed *
                             PlayerController.SpeedMultiplier /
                             enemySpeedMultiplier; //Moves the enemy towards the goalbeen
         }
     }
 }