public BattleCryPlugin() { var dllLocation = Helper.GetPluginDllLocation(); _soundFileDir = dllLocation + "\\AudioFiles\\"; var soundBoard = new SoundBoard(_soundFileDir); var configManager = new XmlConfigManager(); var cardSoundPicker = new ConfigCardSoundPicker(configManager, _soundFileDir + "cardsoundconfig.xml"); var playHandler = new PlayHandler(soundBoard, cardSoundPicker); _gameMonitor = new GameMonitor(playHandler); }
void Awake() { mode = Mode.Intro; currentNumber = UnityEngine.Random.Range (1, 20); bgSoundBoard = GameObject.Find ("BG").GetComponent<SoundBoard> (); bgAudioSource = GameObject.Find ("BG").GetComponent<AudioSource> (); for (int i = 1; i <= 19; i++) { var dim = GameObject.Find (i.ToString ()); dim.GetComponent<SpriteRenderer> ().color = new Color (1f, 1f, 1f, 0f); } }
void Start() { if (main == null) { main = this; player = GetComponent <AudioSource>(); } else { Destroy(this.gameObject); } }
/// <summary> /// Does attack when player has a target and wants to attack /// </summary> private void DoAttack() { if (cooldownShoot > 0) { return; // too soon! } if (!wantsToTarget) { return; // player not targeting } if (!wantsToAttack) { return; // player not shooting } if (target == null) { return; // no target } if (!CanSeeThing(target)) { return; // target can't be seen } // spawns bullets on left and right hand Instantiate(bullets, handL.position, handL.rotation); Instantiate(bullets, handR.position, handR.rotation); cooldownShoot = 1 / roundsPerSecond; // rounds per second SoundBoard.PlayGun(); // plays gun sound // attack! camOrbit.Shake(.5f); // shakes camera slightly when shooting // spawns muzzle particles to look like the player is shooting a gun if (handL) { Instantiate(prefavMuzzleFlash, handL.position, handL.rotation); } if (handR) { Instantiate(prefavMuzzleFlash, handR.position, handR.rotation); } // trigger arm animation // rotates the arms up: armL.localEulerAngles += new Vector3(-20, 0, 0); armR.localEulerAngles += new Vector3(-20, 0, 0); // moves the arms backwards: armL.position += -armL.forward * .1f; armR.position += -armR.forward * .1f; }
private void Awake() { if (Instance) { Debug.Log("Found existing SoundBoard. Destroying copy."); Destroy(gameObject); } else { DontDestroyOnLoad(this); Instance = this; } }
static void OnUserJoinedVoiceChannel(ChannelUserEventArgs e, SoundBoard soundBoard, SoundManager soundManager, Random random) { if (e.User.IsBot) { MyLogger.WriteLine("Bot joined a voice channel. Ignoring..."); return; } if (e.Channel.IsAFK()) { MyLogger.WriteLine("User joined an AFK voice channel. Ignoring..."); return; } if (soundManager.IsPlaying) { MyLogger.WriteLine("_soundManager.HasThingsInQueue() is true. Ignoring..."); return; } MyLogger.WriteLine(e.User.Name + " joined voice channel: " + e.Channel); var list = new[] { Tuple.Create("reinhardt", "hello"), Tuple.Create("genji", "hello"), Tuple.Create("mercy", "hello"), Tuple.Create("torbjorn", "hello"), Tuple.Create("winston", "hi there"), Tuple.Create("suhdude", "#random") }; var i = random.Next(list.Length); var x = list[i]; MyLogger.WriteLine("User joined a voice channel. Sending: " + x.Item1 + " " + x.Item2); FileInfo soundFile; if (soundBoard.TryGetSoundPath(x.Item1, x.Item2, out soundFile) == false) { MyLogger.WriteException(new FileNotFoundException("Couldn't Find TrackRequest but should have")); return; } var track = new Track { Path = soundFile.FullName, Title = $"{x.Item1}: {x.Item2}" }; var sound = new TrackRequest(track, e.Channel.Server.DefaultChannel, e.Channel) { TextUpdates = false }; soundManager.EnqueueSound(sound); }
void SwitchBoard() { if (Input.GetKeyDown(KeyCode.Space)) { currentSoundboardIndex++; if (currentSoundboardIndex >= soundBoard.Length) { currentSoundboardIndex = 0; } currentSoundboard = soundBoard[currentSoundboardIndex]; } }
public void SelectBlock(int?x, int?y) { if (CurrentState == GameState.GameOver) { return; } if (x.HasValue && y.HasValue) { if (Board[y.Value, x.Value] != null && Board[y.Value, x.Value] != SelectedBlock) { SoundBoard.PlayBlockSelect(); } SelectedBlock = Board[y.Value, x.Value]; if ((Board[y.Value, x.Value] == null || Board[y.Value, x.Value].IsPending)) { x = null; y = null; SelectedBlock = null; } } else { SelectedBlock = null; } selectedX = x; selectedY = y; for (int r = 0; r < Rows; r++) { for (int c = 0; c < Cols; c++) { if (r == y && c == x) { Tiles[r, c].SetSelectedCell(); } else if (r == y || c == x) { Tiles[r, c].SetSelectedRowCol(); } else { Tiles[r, c].SetUnselected(); } } } ShowAndHideArrows(); }
void Update() { if (Player.Current.State == Player.PlayerState.Shopping && GameState.Current.State == GameState.GlobalState.Playing) { if (Input.GetAxis(HORIZONTAL) < 0) { Player.Current.State = Player.PlayerState.Moving; Toggle(false); } if (Input.GetButtonUp(FIRE)) { if (GameState.Current.Moneys < Costs[SelectedItem]) { // Do nothing SoundBoard.PlayCantBuy(); } else { ApplyBonus(); SoundBoard.PlayBuy(); GameState.Current.Moneys -= Costs[SelectedItem]; Player.Current.State = Player.PlayerState.Moving; Toggle(false); } } if (Timer > 0) { Timer -= Time.deltaTime; } if (Timer <= 0 && Mathf.Abs(Input.GetAxis(VERTICAL)) > 0) { axisY = Input.GetAxis(VERTICAL); if (axisY > 0 && SelectedItem > 0) { SelectedItem--; Timer = MaxTimer; SetCursor(); } else if (axisY < 0 && SelectedItem < MenuOptions.Length - 1) { SelectedItem++; Timer = MaxTimer; SetCursor(); } } } }
private void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.tag == "Ground") { SoundBoard.Play(SoundType.BouncingGround); scoreKeeper.GroundCollision(); cam.shaker.Shake(); } else if (collision.gameObject.tag == "Bottom" || collision.gameObject.tag == "Surface") { SoundBoard.Play(SoundType.BouncingGround); cam.shaker.Shake(); } }
private void OnMouseEnter() { if (Time.timeSinceLevelLoad < noCleanStartDuration) { return; } if (!cleaning && vessel.PlayerPlaying && !cleaned) { isLasered = false; SoundBoard.Play(SoundType.TargetGunk); StartCoroutine(PlayCleaning()); } cleaningTarget = this; }
public void DoTimeStop() { if (TimeStopItems > 0 && CurrentState != GameState.GameOver) { SoundBoard.PlayTimeStopStart(); TimeStopItems--; TimeStopButton.Current.UpdateCount(TimeStopItems); StopCoroutine(TIME_STOP_COROUTINE); StopCoroutine(TICK_SOUND_COROUTINE); StartCoroutine(TIME_STOP_COROUTINE); StartCoroutine(TICK_SOUND_COROUTINE); } }
void OnMouseUpAsButton() { if (GameState.CurrentMode == GameState.PlayMode.NotStarted) { GameState.CurrentMode = GameState.PlayMode.Started; sprite.SetSprite(DiscardButton); SoundBoard.PlayCard(); } else if (GameState.PowerTimer <= 0 && GameState.DiscardTimer <= 0) { GameState.DiscardTimer = GameState.DiscardTimerMax; GameState.PickNewPower(false); SoundBoard.PlayCard(); } }
void SelectTool(string toolName, Graphic icon) { if (GameState.EditorSelection != toolName) { SoundBoard.Play(SOUND_SELECT); GameEngine.Current.SelectTool(toolName); Selector.enabled = true; Selector.transform.position = icon.transform.position; } else { GameEngine.Current.SelectTool(null); Selector.enabled = false; } }
public void DeleteTool() { if (GameState.EditorSelection != GameState.EDITOR_DELETE) { SoundBoard.Play(SOUND_SELECT); GameEngine.Current.SelectTool(GameState.EDITOR_DELETE); Selector.enabled = true; Selector.transform.position = DeleteIcon.transform.position; } else { GameEngine.Current.SelectTool(null); Selector.enabled = false; } }
void FixedUpdate() { if (State == GlobalState.Playing) { Times -= Time.fixedDeltaTime; if (Times < 0) { SoundBoard.PlayMusic(false); SoundBoard.PlayTimeUp(); Player.Current.DoAnimation(Player.ANIM_STAND); BaitIndicator.Current.Reset(); State = GlobalState.GameOver; } } }
public void SlideSelection(int directionX, int directionY) { if (CurrentState != GameState.Selecting) { return; } if (!selectedX.HasValue || !selectedY.HasValue || Board[selectedY.Value, selectedX.Value] == null || SelectedBlock == null || selectedX.Value + directionX < 0 || selectedY.Value + directionY < 0 || selectedX.Value + directionX >= Cols || selectedY.Value + directionY >= Rows || Board[selectedY.Value + directionY, selectedX.Value + directionX] != null) { return; } SoundBoard.PlayBlockShift(); Board[selectedY.Value, selectedX.Value].StartSliding(directionX, directionY); }
/// <summary> /// Death animation when the player or object has lost all health /// </summary> private void DeathAnimation() { // Rotates player or object transform.localRotation = AnimMath.Slide(transform.localRotation, Quaternion.Euler(deathX, deathY, deathZ), percent); if (deathPos.y >= -deathLevel) // if the death position y is greater than or equal to negative death level { deathPos = transform.localPosition; // gets local position deathPos.y += Time.deltaTime * -2; // gets Y position for vector transform.localPosition = deathPos; // Moves player or object down if (playOnce) // if playOnce is true { SoundBoard.PlayDeath(); // Plays death sound playOnce = false; // turns to false to play only once } } }
public void Init() { var initObjectPreDcs = new WpcCpuBoard.InitObject { interruptCallback = new InterruptCallbackData { firqFromDmd = () => { } }, romObject = new RomObject { preDcsSoundboard = true } }; playbackArray = new List <SoundBoardCallbackData>(); instancePreDcs = SoundBoard.getInstance(initObjectPreDcs); instancePreDcs.reset(); instancePreDcs.registerSoundBoardCallback((msg) => { Debug.Print("CALLBACK!", msg); playbackArray.Add(msg); }); var initObjectDcs = new WpcCpuBoard.InitObject { interruptCallback = new InterruptCallbackData { firqFromDmd = () => { } }, romObject = new RomObject { preDcsSoundboard = false } }; instanceDcs = SoundBoard.getInstance(initObjectDcs); instanceDcs.reset(); instanceDcs.registerSoundBoardCallback((msg) => { Debug.Print("CALLBACK!", msg); playbackArray.Add(msg); }); }
private IEnumerator <WaitForSeconds> Cleaned() { GetComponent <Collider2D>().enabled = false; SoundBoard.Play(SoundType.ExplodingGunk); float start = Time.timeSinceLevelLoad; while (Time.timeSinceLevelLoad - start < 0.5f) { Vibrate(); yield return(new WaitForSeconds(0.02f)); } Laser.ClearTarget(); vessel.scoreKeeper.AddCleaning(); ps.Play(); yield return(new WaitForSeconds(0.1f)); GetComponentInChildren <SpriteRenderer>().enabled = false; Destroy(gameObject, 2f); }
public void DoBoardClear() { if (BoardClearItems > 0 && CurrentState != GameState.GameOver) { SoundBoard.PlayBoardClear(); BoardClearItems--; BoardClearButton.Current.UpdateCount(BoardClearItems); for (int r = 0; r < Rows; r++) { for (int c = 0; c < Cols; c++) { if (Board[r, c] != null && !Board[r, c].IsPending) { GameBlock.Despawn(Board[r, c]); } } } SelectBlock(null, null); } }
void SetupAudio() { SoundBoard = FindObjectOfType<SoundBoard>(); if (SoundBoard) { OnFloorCollision += () => { if (CollisionSoundCoolDown < 0) { PlaySound(CollisionSound); CollisionSoundCoolDown = 0.5f; } }; OnEnterZone += () => PlaySound(EnterZoneSound); OnLeaveZone += () => PlaySound(LeaveZoneSound); OnWin += () => PlaySound(WinSound); } }
IEnumerator TickSoundCoroutine() { tickTimer = 0; tickTimerCount = 0; tickTimerCountMax = 4; while (isTimeStopped) { // First 6 seconds, every half second if (timeStopTimer <= 6.0f) { tickTimerCountMax = 4; } // Next 3 seconds, every quarter second else if (timeStopTimer <= 9.0f) { tickTimerCountMax = 2; } // Next 3 seconds, every quarter second else { tickTimerCountMax = 1; } tickTimer += Time.deltaTime; if (tickTimer >= 0.125f) { tickTimer = tickTimer % 0.125f; tickTimerCount++; if (tickTimerCount >= tickTimerCountMax) { tickTimerCount = tickTimerCount % tickTimerCountMax; SoundBoard.PlayTimeStopTick(); } } yield return(null); } SoundBoard.PlayTimeStopEnd(); }
public static void LevelReset() { while (Deck.Count > 0) { DiscardPile.Add(Deck.Pop()); } PowerTimer = 0; DiscardTimer = 0; Avatar.Current.transform.position = avatarStart; Avatar.Current.firstNode = firstNode; Avatar.Current.ResetLevel(); SoundBoard.StartMusic(); GameState.LevelTimer = levelTimerStart; foreach (GameObject obj in Collectables) { obj.SetActive(true); } Collectables.Clear(); }
void Update() { if (Fishes.Count < MaxFish && State == GlobalState.Playing) { FishTimer -= Time.deltaTime; if (FishTimer < 0) { SpawnFish(1); FishTimer = RandomFloat(MinFishTimer, MaxFishTimer); } } else if (State == GlobalState.Paused) { if (Input.GetButtonUp(FIRE)) { SoundBoard.PlayStartup(); SoundBoard.PlayMusic(true); State = GlobalState.Playing; } } }
IEnumerator FlyCoroutine() { time = 0; while (time < (TotalTime * distance)) { time += (Time.deltaTime / Time.timeScale); tmpPos = Vector3.Lerp( originalPos, targetPos, time / (TotalTime * distance)); tmpPos.z = _t.position.z; _t.position = tmpPos; yield return(null); } if (trgt != null) { trgt.SendMessage(BOUNCE_MESSAGE); trgt.SendMessage(UPDATE_NUMBER_MESSAGE, targetMessageNumber); } if (audioToPlay.HasValue) { switch (audioToPlay.Value) { case AudioToPlay.BlockCollect: SoundBoard.PlayBlockCollect(); break; case AudioToPlay.ItemCollect: SoundBoard.PlayItemCollect(); break; } } Despawn(this); }
/// <summary> /// Does attack when turret has a target /// </summary> private void DoAttack() { if (cooldownShoot > 0) { return; // too soon! } if (target == null) { return; // no target } if (!CanSeeThing(target)) { return; // target can't be seen } Instantiate(bullets, turretMuzzle.position, turretMuzzle.rotation); // Spawns bullets SoundBoard.PlayGun(); // Plays gun sound cooldownShoot = 1 / roundsPerSecond; // Rounds per second shot // attack! //camOrbit.Shake(.5f); if (turretMuzzle) { Instantiate(prefavMuzzleFlash, turretMuzzle.position, turretMuzzle.rotation); // shows muzzle flash particles } // trigger arm animation // rotates the arms up: turretHead.localEulerAngles += new Vector3(-5, 0, 0); // moves the arms backwards: turretHead.position += -turretHead.forward * .05f; }
void Update() { if (GameState.Current.State != GameState.GlobalState.Playing) { return; } if (Input.GetButtonDown(FIRE)) { if (Player.Current.State == Player.PlayerState.Fishing) { SoundBoard.PlayReel(true); Player.Current.DoAnimation(Player.ANIM_REEL); ReelAnimTimer = 0; Player.Current.State = Player.PlayerState.Reeling; foreach (FishMouth fish in HookedFishes) { fish.Fish.ReelingIn(); fish.Disable(_t.position); fish.Fish.transform.parent = _t; } } } }
public static void SaveSoundBoard(SoundBoard soundBoard) { Save(soundBoard); }
void Start() { CurrentPlayer = 1; CurrentPhase = ConfigurationPhase.SlideUp; SoundBoard = FindObjectOfType<SoundBoard>(); Cursor.visible = false; }
public static void RegisterEventHandlers(DiscordClient _client, SoundBoard _soundBoard, SoundManager _soundManager) { MyLogger.Write("Registering Event Handlers..."); #region ConnectedEvents _client.Ready += (sender, e) => { MyLogger.WriteLine("Client is Ready/Connected! ໒( ͡ᵔ ▾ ͡ᵔ )७", ConsoleColor.Green); MyLogger.WriteLine("Setting game..."); _client.SetGame("gniyalP"); }; #endregion #region MessageEvents _client.MessageDeleted += (sender, e) => { }; _client.MessageUpdated += (sender, e) => { }; _client.MessageReceived += (sender, e) => { }; #endregion #region ChannelEvents _client.ChannelCreated += async(sender, e) => { try { await e.Channel.SendMessageEx("less is more"); if (e.Channel.Name.ToLower().Contains("bundtbot")) { if (BundtBot.TextChannelOverrides.ContainsKey(e.Server)) { BundtBot.TextChannelOverrides[e.Server] = e.Channel; } else { BundtBot.TextChannelOverrides.Add(e.Server, e.Channel); } } } catch (Exception ex) { MyLogger.WriteException(ex); } }; _client.ChannelDestroyed += async(sender, e) => { try { await e.Channel.SendMessageEx("RIP in pieces " + e.Channel.Name); if (BundtBot.TextChannelOverrides.ContainsKey(e.Server)) { if (BundtBot.TextChannelOverrides[e.Server] == e.Channel) { BundtBot.TextChannelOverrides.Remove(e.Server); } } } catch (Exception ex) { MyLogger.WriteException(ex); } }; _client.ChannelUpdated += (sender, e) => { if (e.After.Name.ToLower().Contains("bundtbot")) { if (BundtBot.TextChannelOverrides.ContainsKey(e.Server)) { BundtBot.TextChannelOverrides[e.Server] = e.After; } else { BundtBot.TextChannelOverrides.Add(e.Server, e.After); } } }; #endregion #region ServerEvents _client.ServerAvailable += async(sender, e) => { MyLogger.Write("Server available! "); MyLogger.WriteLine(e.Server.Name, ConsoleColorHelper.GetRoundRobinColor()); try { var nickname = ConfigurationManager.AppSettings["BotNickName"]; await e.Server.CurrentUser.Edit(nickname : nickname + " v" + BundtBot.Version); } catch (HttpException ex) { MyLogger.WriteLine($"{ex.GetType()} thrown from trying to change the bot's nickname", ConsoleColor.DarkYellow); MyLogger.WriteLine("The bot might not have permission on that server to change it's nickname", ConsoleColor.DarkYellow); } catch (Exception ex) { MyLogger.WriteException(ex); } // Set override channel if exists foreach (var textChannel in e.Server.TextChannels) { if (textChannel.Name.ToLower().Contains("bundtbot")) { BundtBot.TextChannelOverrides.Add(e.Server, textChannel); break; } } // Register Users in DB foreach (var user in e.Server.Users) { if (DB.Users.Exists(x => x.SnowflakeId == user.Id) == false) { DB.Users.Insert(new Models.User { SnowflakeId = user.Id }); } } }; _client.JoinedServer += (sender, e) => { MyLogger.WriteLine("Joined Server! " + e.Server.Name); }; #endregion #region UserEvents _client.UserBanned += (s, e) => { }; _client.UserJoined += async(s, e) => { await e.User.Server.DefaultChannel.SendMessageEx("welcome to server " + e.User.NicknameMention); await e.User.Server.DefaultChannel.SendMessageEx("beware of the airhorns..."); }; _client.UserUpdated += async(s, e) => { var voiceChannelBefore = e.Before.VoiceChannel; var voiceChannelAfter = e.After.VoiceChannel; if (voiceChannelBefore == voiceChannelAfter) { return; } if (voiceChannelBefore != null) { await OnUserLeftVoiceChannel(new ChannelUserEventArgs(voiceChannelBefore, e.After), _soundManager); } if (voiceChannelAfter != null) { OnUserJoinedVoiceChannel(new ChannelUserEventArgs(voiceChannelAfter, e.After), _soundBoard, _soundManager, new Random()); } }; _client.UserLeft += async(sender, e) => { // Can't send message to server if we just left it if (e.User.Id == _client.CurrentUser.Id) { return; } await e.Server.DefaultChannel.SendMessageEx("RIP in pieces " + e.User.Nickname); }; #endregion #region OtherEvents _client.Log.Message += (sender, eventArgs) => { Console.WriteLine($"[{eventArgs.Severity}] {eventArgs.Source}: {eventArgs.Message}"); }; #endregion MyLogger.WriteLine("Done!"); }
void Awake() { Current = this; }
void Start() { instance = this; source = GetComponent <AudioSource>(); }
void SetupAudio() { SoundBoard = FindObjectOfType<SoundBoard>(); if (SoundBoard) { OnSlide += (() => PlaySound(SlideSound)); OnRocket += (() => PlaySound(RocketSound)); } }