private IEnumerator EndMotionOnButtonPress() { bool done = false; while (!done) { if (isPerforming == false) { done = true; yield break; } if (Input.GetKeyDown(skipKeyCode)) { if (isPerforming == true) { isCancel = true; executionState = ANIMOTIONEXECUTIONSTATE.SKIP; done = true; OnMotionSkip(); yield break; } } yield return(null); } yield return(null); }
protected IEnumerator ReproduceMotion() { executionState = ANIMOTIONEXECUTIONSTATE.PERFORMING; isPerforming = true; isCancel = false; StartMotion(); // Este lo ponemos ya que sino en el primer frame estan todos en Idlle entonces no reconoce el cambio y termina toda la funcion // TECNICAMENTE DEBERIA ESTAR SOLUCIONADO SI HABILITAMOS EL CODIGO DEL ANIMATED MOTION QUE CHEQUEA ENTRAR EN EL ESTADO ANTES // PARA ESO DEBEMOS CORREGIR TANTO LA ANIMATED MOTION COMO TODOS SUS CHILDS PARA QUE TENGAN LA MISMA LOGICA // TENER CUIDADO CON IDDLE O TODOS LOS QUE NO REQUIERAN QUE TERMINE POR LAS DUDAS yield return(null); // Esto es para chequear el final de la animacion/tween/sonido/timer presionando un boton skipKeyCode if (canSkip) { coroutineMono.StartCoroutine(EndMotionOnButtonPress()); } // Esperamos a terminar de hacer la animacion y volver a Iddle tanto de ataque como de recibir dano de los enemigos yield return(CheckPendingRunningMotions()); OnMotionEnd(); yield return(null); }
public virtual void OnMotionSkip() { executionState = ANIMOTIONEXECUTIONSTATE.SKIP; //// VER SI LO HACEMOS ASI O NO //if (actualMotionCoroutine != null) //{ // coroutineMono.StopCoroutine(actualMotionCoroutine); //} SetNormalSpeedMotion(); }
private void OnMotionEnd() { if (isCancel == false) { CheckMotionAfterEnd(); SetNormalSpeedMotion(); isPerforming = false; executionState = ANIMOTIONEXECUTIONSTATE.EXECUTED; } else { isCancel = false; isPerforming = false; executionState = ANIMOTIONEXECUTIONSTATE.EXECUTED; } }
protected IEnumerator ReproduceMotion() { executionState = ANIMOTIONEXECUTIONSTATE.PERFORMING; //isPerforming = true; //isCancel = false; StartMotion(); // Este lo ponemos ya que sino en el primer frame estan todos en Idlle entonces no reconoce el cambio y termina toda la funcion // TECNICAMENTE DEBERIA ESTAR SOLUCIONADO SI HABILITAMOS EL CODIGO DEL ANIMATED MOTION QUE CHEQUEA ENTRAR EN EL ESTADO ANTES // PARA ESO DEBEMOS CORREGIR TANTO LA ANIMATED MOTION COMO TODOS SUS CHILDS PARA QUE TENGAN LA MISMA LOGICA // TENER CUIDADO CON IDDLE O TODOS LOS QUE NO REQUIERAN QUE TERMINE POR LAS DUDAS yield return(null); //// Esto es para chequear el final de la animacion/tween/sonido/timer presionando un boton skipKeyCode //if (canSkip) //{ // coroutineMono.StartCoroutine(EndMotionOnButtonPress()); //} // Esperamos a terminar de hacer la animacion y volver a Iddle tanto de ataque como de recibir dano de los enemigos yield return(CheckPendingRunningMotions()); // SI LLEGAMOS ACA LA MOTION YA SE FINALIZO, SIEMPRE, SI O SI, YA SEA POR SKIP O POR QUE TERMINO REALMENTE // PODRIA PASAR QUE JUSTO LE DIMOS END EN EL MISMO FRAME QUE HABIA TERMINADO DE CHECKEAR Y VA A EJECUTAR EL ON MOTION SKIP // HAY QUE VER SI PRIMERO SE DETIENE LA COROUTINE O SI SE EJECUTA LA COROUTINE Y DESPUES EL ON MOTION SKIP // PODRIA PONER UN ONMOTIONSKIP ACA PARA VER COMO FUNCIONA //OnMotionSkip(); if (executionState == ANIMOTIONEXECUTIONSTATE.SKIP) { yield break; } OnMotionEnd(); SetNormalSpeedMotion(); executionState = ANIMOTIONEXECUTIONSTATE.EXECUTED; yield return(null); }
public virtual void OnMotionSkip() { SetNormalSpeedMotion(); isPerforming = false; executionState = ANIMOTIONEXECUTIONSTATE.SKIP; }