private void DetactState() { if (IsP1) { if (instructions.currentstate[currentTask]) { SuccessState(); instructions.ResetInstructionP1(); } } else { if (instructions.currentstate[currentTask + count]) { SuccessState(); instructions.ResetInstructionP2(); } } }