public RhythmCore.RhythmExpectedEventInfo GenerateExpectedEvent_B(MutexArrowNoRepeatStrat_B strat) { RhythmCore.RhythmExpectedEventInfo ret; if (strat == this._genStratB) { // Generate a non-repeating prompt arrow direction this.currInfoB = RandomArrowGenStrat.GenerateExpectedEventStatic(); if (_myState == State.WAITING_FOR_FIRST) { while (this.currInfoB.expectedKey == this.prevInfoB.expectedKey) { this.currInfoB = RandomArrowGenStrat.GenerateExpectedEventStatic(); } this._myState = State.B_REQUESTED_A_PENDING; //Debug.Log("GenerateExpectedEvent_B -> B_REQUESTED_A_PENDING"); } else if (_myState == State.A_REQUESTED_B_PENDING) { while (this.currInfoB.expectedKey == this.prevInfoB.expectedKey || this.currInfoB.expectedKey == this.currInfoA.expectedKey) { this.currInfoB = RandomArrowGenStrat.GenerateExpectedEventStatic(); } this._myState = State.WAITING_FOR_FIRST; //Debug.Log("GenerateExpectedEvent_B -> WAITING_FOR_FIRST"); } else { Debug.LogError("Invalid state in MutexArrowCoordinator.GenerateExpectedEvent_B"); } // Set this.prevInfo to track the previous key this strategy generated this.prevInfoB = this.currInfoB; // Return ret = this.currInfoB; } else { Debug.LogError("MutexArrowNoRepeatStrat_A passed into GenerateExpectedEvent_A does not match registered strategy"); ret = new RhythmCore.RhythmExpectedEventInfo() { expectedKey = KeyCode.A }; } return(ret); }
public void RegisterGenerator_B(MutexArrowNoRepeatStrat_B generatorB) { if (this._genStratB == null) { this._genStratB = generatorB; // once we have both A and B, start waiting for requests if (this._genStratA != null) { this._myState = State.WAITING_FOR_FIRST; //Debug.Log("RegisterGenerator_B -> WAITING_FOR_FIRST"); } } else { Debug.LogError("Attempting to register another B generator to MutexArrowCoordinator is an error"); } }