public override bool ParseBytesAndExecute(byte[] data) { if (data.Length != 24 + 1 + 1) { return(false); } Location loc = Location.FromDoubleBytes(data, 0); DefaultSound soundtype = (DefaultSound)data[24]; byte subdat = data[24 + 1]; switch (soundtype) { case DefaultSound.BREAK: PlayDefaultBlockSound(loc, (MaterialSound)subdat, 0.75f, 1f); break; case DefaultSound.PLACE: PlayDefaultBlockSound(loc, (MaterialSound)subdat, 1.5f, 0.8f); break; case DefaultSound.STEP: PlayDefaultBlockSound(loc, (MaterialSound)subdat, 1, 0.5f); break; default: return(false); } return(true); }
static void Main(string[] args) { var defaultSettings = SettingsHelper.GetSettings(args); if (defaultSettings == null) { Console.WriteLine("Oops! :( The settings file could not be loaded!"); } try { var board = MapperHelper.Mapper.Map <DefaultBoard>(defaultSettings.BoardSettings); var player = new Player(board); var defaultSound = new DefaultSound(); var defaultEngine = new DefaultEngine(player, defaultSettings, defaultSound); defaultEngine.Notify(Enums.EngineEvent.Play); var opt = GetMenu(defaultEngine); while (opt != EXIT) { var engineOperation = EngineOperationHelper.From(opt); if (engineOperation.HasValue) { defaultEngine.Do(engineOperation.Value); } opt = GetMenu(defaultEngine); } } catch (Exception ex) { Console.WriteLine("Oops! :( there was a little problem during the game! please restart the game."); Console.WriteLine($"ERROR => {ex}"); } Console.WriteLine("The end!"); }
public DefaultSoundPacketOut(Location loc, DefaultSound sound, byte subdat) { UsageType = NetUsageType.EFFECTS; ID = ServerToClientPacket.DEFAULT_SOUND; Data = new byte[24 + 1 + 1]; loc.ToDoubleBytes().CopyTo(Data, 0); Data[24] = (byte)sound; Data[24 + 1] = subdat; }
/// <summary> /// Handles the logic when the lose animation finishes /// </summary> private void _on_Lose_animation_finished() { s = 1000; lose.Stop(); losePopup.Show(); HideNextButton(); DefaultSound.disableSound(); AudioStream sfx = ResourceLoader.Load("res://Assets/SoundEffects/Jingle_Lose_00.wav") as AudioStream; audioStreamPlayer.Stream = sfx; audioStreamPlayer.Playing = true; }
/// <summary> /// Initialization /// </summary> public override void _Ready() { audioStreamPlayer = GetNode <AudioStreamPlayer>("AudioStreamPlayer2"); audioStreamPlayer.VolumeDb = Global.SfxVol; AudioStream sfx = ResourceLoader.Load("res://Assets/SoundEffects/battleThemeA.ogg") as AudioStream; DefaultSound.playSound(sfx); AddUserSignal("NoMoreQuestions"); charSprite = GetNode <AnimatedSprite>("CharSprite"); monsterSprite = GetNode <AnimatedSprite>("MonsterSprite"); charSkillSprite = GetNode <AnimatedSprite>("CharSprite/CharSkillSprite"); monsterSkillSprite = GetNode <AnimatedSprite>("MonsterSprite/MonsterSkillSprite"); activeSkill = GetNode <AnimatedSprite>("CharSprite/ActiveSkill"); countDown = GetNode <AnimatedSprite>("Countdown"); timerLabel = GetNode <Label>("TimerLabel"); questionLabel = GetNode <Label>("QuestionLabel"); levelTitle = GetNode <Label>("LevelTitle"); timerLbl2 = GetNode <Label>("TimerLabel2"); popupMenu = GetNode <PopupMenu>("PopupMenu"); losePopup = GetNode <PopupMenu>("LosePopup"); win = GetNode <AnimatedSprite>("Win"); lose = GetNode <AnimatedSprite>("Lose"); tick = GetNode <Sprite>("Ans/Tick"); cross = GetNode <Sprite>("Ans/Cross"); tick2 = GetNode <Sprite>("Ans/Tick2"); cross2 = GetNode <Sprite>("Ans/Cross2"); tick3 = GetNode <Sprite>("Ans/Tick3"); cross3 = GetNode <Sprite>("Ans/Cross3"); tick4 = GetNode <Sprite>("Ans/Tick4"); cross4 = GetNode <Sprite>("Ans/Cross4"); timer2 = GetNode <Timer>("Timer2"); animationList = new List <string>(); animationList.Add("Idle"); animationList.Add("Hurt"); animationList.Add("Die"); animationList.Add("Attack"); op1 = GetNode <Button>("Buttons/Option1"); op2 = GetNode <Button>("Buttons/Option2"); op3 = GetNode <Button>("Buttons/Option3"); op4 = GetNode <Button>("Buttons/Option4"); theme1 = ResourceLoader.Load("res://Assets/GUI/BtnUI.tres") as Theme; theme2 = ResourceLoader.Load("res://Assets/GUI/BtnUI2.tres") as Theme; theme3 = ResourceLoader.Load("res://Assets/GUI/BtnUI3.tres") as Theme; DisplayBtnDesign(); countDown.Play("Countdown"); timer = GetNode <Timer>("TimeLimit"); }
/// <summary> /// Handles the logic when the Next button is pressed /// </summary> private void _on_Next_pressed() { if (Global.LevelId != 5) { Global.LevelId++; } else { Global.SectionId++; Global.LevelId = 1; } AudioStream sfx = ResourceLoader.Load("res://Assets/SoundEffects/little town - orchestral.ogg") as AudioStream; DefaultSound.playSound(sfx); GetTree().ChangeScene("res://Presentation/GamePlay/Campaign.tscn"); }
/// <summary> /// Handles the logic when the Menu button is pressed /// </summary> private void _on_Menu_pressed() { AudioStream sfx = ResourceLoader.Load("res://Assets/SoundEffects/little town - orchestral.ogg") as AudioStream; DefaultSound.playSound(sfx); GetTree().ChangeScene("res://Presentation/MainMenu/MainMenu.tscn"); switch (gameType) { case "Assignment": GetTree().ChangeScene("res://Presentation/Assignment/ViewAssignment.tscn"); break; case "Campaign": GetTree().ChangeScene("res://Presentation/LevelSelection/LevelSelection.tscn"); break; case "CustomLevel": GetTree().ChangeScene("res://Presentation/CustomLevel/ViewCustomLevel.tscn"); break; } }
/// <summary> /// Display next Question /// </summary> public void DisplayNextQuestion() { Control ctr = GetNode <Control>("Buttons"); if (questionIndex < questionList.Count - 1) { questionIndex++; DisplayQuestion(); SetQuestionNum(); } else { //EmitSignal("NoMoreQuestions") timerLabel.Visible = false; HideBtns(); monsterSprite.Play("Die"); win.Play("Win"); DefaultSound.disableSound(); AudioStream sfx = ResourceLoader.Load("res://Assets/SoundEffects/Jingle_Win_00.wav") as AudioStream; audioStreamPlayer.Stream = sfx; audioStreamPlayer.Playing = true; } }