//Set two waypoints for the flank action public IEnumerator FollowWayPoints(Vector3 waypoint1, Vector3 waypoint2) { SetDestination(waypoint1); StartCoroutine(dd.RotateTowardsTarget(waypoint1)); yield return(new WaitUntil(() => (Vector3.Distance(transform.position, waypoint1) < 0.1f))); SetDestination(waypoint1); StartCoroutine(dd.RotateTowardsTarget(waypoint2)); }
public override void Actions(string name) { agent = GameObject.Find(name); DealDamage dd = agent.GetComponent <DealDamage>(); Movement movement = agent.GetComponent <Movement>(); StartCoroutine(dd.RotateTowardsTarget(GameObject.Find("Player").transform.position)); movement.SetDestination(GameObject.Find("Player").transform.position); UtilityBasedAI.actionComplete = true; }
public override void Actions(string name) { UtilityBasedAI UBA = GameObject.Find(name).GetComponent <UtilityBasedAI>(); if (!UBA.runOnce) { DealDamage dd = GameObject.Find(name).GetComponent <DealDamage>(); dd.RotateTowardsTarget(GameObject.Find("Player").transform.position); dd.ThrowGrenade(name); } }