IEnumerator ControllerButtonListenter(XboxCtrlrInput.XboxButton button, Queue <GameObject> beats, SpriteRenderer buttonSpriteRenderer, float labelCountdownTimer) //forever repeat the while loop { while (true) { if (XboxCtrlrInput.XCI.GetButtonDown(button, controllerNumber)) //when A button is pressed { if (beats.Count > 0) //check to see if there are any A buttons on the stack { beats.Peek().GetComponent <RhythmBeat>().CalculateBeatScore(); //calculate the score for the beat float score = beats.Peek().GetComponent <RhythmBeat>().Score; //get the score for the beat itemPowerBar.AddPower(score); //add score to the power bar //add the score for the beat beats.Peek().GetComponent <RhythmBeat> ().DestroyBeat(true); //then destroy the beat labelCountdownTimer = .5f; //time until label disappears buttonSpriteRenderer.enabled = true; //reenable the sprite renderer StartCoroutine(CheckButtonLabelTimer(buttonSpriteRenderer, labelCountdownTimer)); if (score == 1) { buttonSpriteRenderer.sprite = perfectSprite; } else if (score == .65f) { buttonSpriteRenderer.sprite = goodSprite; } else if (score == .4f || score == .25f) { buttonSpriteRenderer.sprite = okaySprite; } else if (score == .1f) { buttonSpriteRenderer.sprite = badSprite; } else if (score == -2f) { buttonSpriteRenderer.sprite = missSprite; } } else if (gameStarted) //else there are no beats in stack - but the game has started { itemPowerBar.RemovePower(2f); //remove score from the power bar //play bad noise //bad animation - scale up and red } else /*if (!gameStarted)*/ //else the game has not started //call animation that increases scale of targetA //so no negative repurcussions //play a mild noise { } } yield return(0); } }
public bool EspecificButton(XboxCtrlrInput.XboxButton button) { return(XCI.GetButtonDown(button, controller)); }
public static ControlKey XboxButton(XboxCtrlrInput.XboxButton btn) { return(new ControlKey(ControlKeyType.Xbox, btn.ToString())); }