public void deaggro() { if (aggressing) { GetComponent <Renderer>().material.color = Color.blue; Debug.Log("Stopping Aggro"); aggressing = false; target.SendMessage("noLongerSeenBy", gameObject); SendMessage("stopAggro"); walker.startTransit(); } }
IEnumerator applyDelay(WalkOnRoute walker) { if (walker.arrived()) { for (float timer = 0f; timer < delay; timer += Time.deltaTime) { if (walker.inTransit) { timer -= Time.deltaTime; // cheeky way to pause the countdown if the char is aggressing } yield return(null); } // yield return new WaitForSeconds( delay ); // Debug.Log( "changing to next waypoint" ); walker.setWaypoint(next); if (walker.keepMoving) { walker.startTransit(); } } }