Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using System.Security.Cryptography;
- using UnityEngine;
- using UnityEngine.AI;
- public class MinionController : MonoBehaviour
- {
- public GameObject enemyInnerTower;
- public GameObject enemyOuterTower;
- public GameObject allyInnerTower;
- public float attackRange;
- public float aggroRange;
- private NavMeshAgent minionAgent;
- private bool hasTarget;
- void Start()
- {
- minionAgent = GetComponent<NavMeshAgent>();
- hasTarget = false;
- }
- void Update()
- {
- if (hasTarget == false) // focuses enemy outer then inner tower
- {
- if (enemyOuterTower.GetComponent<ManagerScript>().currentHealth > 0)
- {
- minionAgent.SetDestination((transform.position - enemyOuterTower.transform.position).normalized * (attackRange - 0.5f) + enemyOuterTower.transform.position);
- }
- if (enemyInnerTower.GetComponent<ManagerScript>().currentHealth > 0)
- {
- minionAgent.SetDestination((transform.position - enemyInnerTower.transform.position).normalized * (attackRange - 0.5f) + enemyInnerTower.transform.position);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement