IEnumerator IstunnedNPC(float t, SimpleIA sIA) { while (t > 0 && !playerControl.checkers.isDominated) { transform.Rotate(0, 1000 * Time.deltaTime, 0); t -= Time.deltaTime; playerControl.checkers.isStuned = true; yield return(null); } if (!playerControl.checkers.isDominated) { setEffects.noneFx("fxStun"); playerControl.checkers.isStuned = false; sIA.getNavMeshAgent().enabled = true; sIA.enabled = true; sIA.setVisor(true); stunnedControl = false; } else { setEffects.noneFx("fxStun"); // Debug.Log("despues de cancelar"); playerControl.checkers.isStuned = false; sIA.getNavMeshAgent().enabled = false; sIA.enabled = false; sIA.setVisor(true); stunnedControl = false; } }
public void stunnedNPC(SimpleIA simpleIA, float timeStunned) { if (!stunnedControl) { if (setEffects.GetFX("fxStun") != null) { setEffects.PlayFx("fxStun"); } if (setEffects.GetSX("sxStun") != null) { setEffects.GetSX("sxStun").Play(); } stunnedControl = true; simpleIA.setVisor(false); simpleIA.getNavMeshAgent().enabled = false; simpleIA.enabled = false; coStun = StartCoroutine(IstunnedNPC(timeStunned, simpleIA)); } }