void stop(AttackState attackState) { // protect against the NONE inital state which will have a null enumerator if (attackState.getCoroutine() != null) { //NOTE: stopping a coroutine mid execution nees to be thought through // an attackState that is interruptable must only be interruptable if // it doesn't need to de-allocate objects other than with the complete function StopCoroutine(attackState.getCoroutine()); } // we've interrupted this attack. run the complete function to close resources/reset state attackState.getCompleteFunction()(); attackState.finished = true; }