public RhythmCore.RhythmExpectedEventInfo GenerateExpectedEvent_A(MutexArrowNoRepeatStrat_A strat) { RhythmCore.RhythmExpectedEventInfo ret; if (strat == this._genStratA) { // Generate a non-repeating prompt arrow direction this.currInfoA = RandomArrowGenStrat.GenerateExpectedEventStatic(); if (_myState == State.WAITING_FOR_FIRST) { while (this.currInfoA.expectedKey == this.prevInfoA.expectedKey) { this.currInfoA = RandomArrowGenStrat.GenerateExpectedEventStatic(); } this._myState = State.A_REQUESTED_B_PENDING; //Debug.Log("GenerateExpectedEvent_A -> A_REQUESTED_B_PENDING"); } else if (_myState == State.B_REQUESTED_A_PENDING) { while (this.currInfoA.expectedKey == this.prevInfoA.expectedKey || this.currInfoA.expectedKey == this.currInfoB.expectedKey) { this.currInfoA = RandomArrowGenStrat.GenerateExpectedEventStatic(); } this._myState = State.WAITING_FOR_FIRST; //Debug.Log("GenerateExpectedEvent_A -> WAITING_FOR_FIRST"); } else { Debug.LogError("Invalid state in MutexArrowCoordinator.GenerateExpectedEvent_A"); } // Set this.prevInfo to track the previous key this strategy generated this.prevInfoA = this.currInfoA; // Return ret = this.currInfoA; } 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_A(MutexArrowNoRepeatStrat_A generatorA) { if (this._genStratA == null) { this._genStratA = generatorA; // once we have both A and B, start waiting for requests if (this._genStratB != null) { this._myState = State.WAITING_FOR_FIRST; //Debug.Log("RegisterGenerator_A -> WAITING_FOR_FIRST"); } } else { Debug.LogError("Attempting to register another A generator to MutexArrowCoordinator is an error"); } }