void Start() { moving = false; rig = GetComponent <Rigidbody>(); obj = new List <Transform> { }; if (points.Length > 0) { currentTarget = points[0]; } tolerance = speed * Time.fixedDeltaTime; dis = GetComponent <NavMeshAgentDisabler>(); links = GetComponentsInChildren <NavMeshLinkPoints>(); setLinks = false; }
IEnumerator DelayFall() { if (falldelay > 0) { yield return(new WaitForSeconds(falldelay)); } Fall(); NavMeshAgentDisabler dis = GetComponent <NavMeshAgentDisabler>(); if (dis) { dis.SetAgent(false); } yield return(new WaitForSeconds(deathDelayAfterFall)); if (dis) { dis.SetAgent(true); } Destroy(gameObject); yield return(null); }