public void update(PlayerProgress.RatedMoves rated, bool ratingComplete, long time, long deltaT) { this.transitions.update(time); this.flash = 1.0f - ((time % this.beatTimeInMs) / this.beatTimeInMs); this.flash = this.flash / 16; if (ratingComplete) this.seqSuccessSound.play(); if (null != rated) { foreach (DanceSequence.Input ratedInput in rated.allFromUserInput) { if (!this.hud.ContainsKey(ratedInput.handicap)) continue; Sound sound = getSoundForRating(rated, ratedInput); if (null != sound) { sound.play(); } Color color = getColorForRating(rated, ratedInput); this.hud[ratedInput.handicap].start(color); } } foreach (KeyValuePair<InputState.Move, DirectionalIndicator> hudElement in this.hud) { hudElement.Value.update(time, deltaT); } }
internal PlayerProgress clone() { PlayerProgress progress = new PlayerProgress(); progress.score = this.score; progress.ratedUntil = this.ratedUntil; progress.notYetRated = this.notYetRated; return progress; }
public void startPlayerAnimation(InputState.Move move, long startPoint, PlayerProgress.Rating rating) { this.startAnimation(this.player[rating], move, startPoint); }
private bool checkSequenceCompletion(PlayerProgress.RatedMoves rated, bool sequenceComplete) { if (null == this.currentSequence) return false; DanceSequence.Input lastMove = this.currentSequence.lastMoveInput; if (rated.contains(lastMove)) { sequenceComplete = !this.progress.errorInLastSequence; } return sequenceComplete; }
public void initialize(ContentUtil content, SceneActivationParameters parameters) { this.exit = false; this.paused = false; this.textures.clear(); this.currentSequence = null; this.input = new ExplicitInputState(); script.reload(); this.textures.loadTextures(content, "player_character", "btn_up", "btn_down", "btn_left", "btn_right", "btn_fail"); //this.backgroundTexture = this.script.get("background"); //this.textures.loadTextures(content, this.backgroundTexture); this.background.initialize(content, this.script); this.song = new Song(this.script, content); this.progress = new PlayerProgress(); this.sequences.initialize(this.script); float uiSpeed = 1.0f; if (this.script.contains("ui_speed")) uiSpeed = this.script.asFloat["ui_speed"][0]; this.ui.initialize(content, this.sequences, this.song.beatTimeInMs, uiSpeed); long beatTimeMs = (long) this.song.beatTimeInMs; this.enemy = new AnimatedCharacter(this.script.get("enemy"), content, beatTimeMs); this.player = new AnimatedCharacter("toasty/toasty", content, beatTimeMs); this.lastTime = 0; this.song.play(); }
private Sound getSoundForRating(PlayerProgress.RatedMoves rated, DanceSequence.Input ratedInput) { Sound sound; if (rated.ok.Contains(ratedInput)) { sound = this.successSound; } else if (rated.good.Contains(ratedInput)) { sound = this.successSound; } else if (rated.perfect.Contains(ratedInput)) { sound = this.successSound; } else { sound = this.errorSound; } return sound; }
private static Color getColorForRating(PlayerProgress.RatedMoves rated, DanceSequence.Input ratedInput) { Color color; if (rated.ok.Contains(ratedInput)) { color = Color.Yellow; } else if (rated.good.Contains(ratedInput)) { color = Color.GreenYellow; } else if (rated.perfect.Contains(ratedInput)) { color = Color.Lime; } else { color = Color.Red; } return color; }