Guest User

Untitled

a guest
Jun 12th, 2020
20
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Security.Cryptography;
  4. using UnityEngine;
  5. using UnityEngine.AI;
  6.  
  7. public class MinionController : MonoBehaviour
  8. {
  9. public GameObject enemyInnerTower;
  10. public GameObject enemyOuterTower;
  11. public GameObject allyInnerTower;
  12.  
  13. public float attackRange;
  14. public float aggroRange;
  15.  
  16. private NavMeshAgent minionAgent;
  17.  
  18. private bool hasTarget;
  19.  
  20. void Start()
  21. {
  22. minionAgent = GetComponent<NavMeshAgent>();
  23. hasTarget = false;
  24. }
  25.  
  26. void Update()
  27. {
  28. if (hasTarget == false) // focuses enemy outer then inner tower
  29. {
  30. if (enemyOuterTower.GetComponent<ManagerScript>().currentHealth > 0)
  31. {
  32. minionAgent.SetDestination((transform.position - enemyOuterTower.transform.position).normalized * (attackRange - 0.5f) + enemyOuterTower.transform.position);
  33. }
  34.  
  35. if (enemyInnerTower.GetComponent<ManagerScript>().currentHealth > 0)
  36. {
  37. minionAgent.SetDestination((transform.position - enemyInnerTower.transform.position).normalized * (attackRange - 0.5f) + enemyInnerTower.transform.position);
  38. }
  39. }
  40.  
  41. }
  42. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×