//A test to see if a given input lets you continue to try to perform this trick or makes you fail this trick. public bool ContinueTrick(TrickInput_Mobile i) { if (alternateInputs.Count > 0) { //Starting with the first required input for this trick, if that matches the input the player pressed, if (inputs[currentInput].isSameAs(i) || alternateInputs[currentInput].isSameAs(i)) { //Move onto the next required input. currentInput++; //If the player completed all the required inputs. if (currentInput >= inputs.Count || currentInput >= alternateInputs.Count) { //Invoke this trick, onInputted.Invoke(); //And reset the index, currentInput = 0; } //And return true. return(true); } //If that input does not match the required input, else { //Reset our index and return false. currentInput = 0; return(false); } } else { //Starting with the first required input for this trick, if that matches the input the player pressed, if (inputs[currentInput].isSameAs(i)) { //Move onto the next required input. currentInput++; //If the player completed all the required inputs. if (currentInput >= inputs.Count) { //Invoke this trick, onInputted.Invoke(); //And reset the index, currentInput = 0; } //And return true. return(true); } //If that input does not match the required input, else { //Reset our index and return false. currentInput = 0; return(false); } } }
//A test that we use in the Trick class. public bool isSameAs(TrickInput_Mobile test) { return(type == test.type); }