public void RpcOnRevived() { player.Collider2D.isTrigger = false; player.gameObject.layer = LayerDict.Instance.GetPlayerLayer(); FMODUtil.PlayOnTransform(reviveSound, transform); OnRevived?.Invoke(); }
/// <summary> /// Called when a bullet was fired. /// </summary> public void OnFiredSingleShot() { --remainingBullets; NetworkWeaponAnimator.OnSingleShotFired(); FMODUtil.PlayOnTransform(weapon.WeaponSoundModel.ShootSound, transform); BulletCountChanged?.Invoke(remainingBullets); }
private static void FootStepSound(Living living, Tile footStepsOn) { if (living.FootStepTimer.Allow()) { FMODUtil.RaiseEvent(EffectsTable.FootSteps, "Material", footStepsOn.FootStepSound); } }
protected override List <Item> HarvestPercent(double percentMined, Point2D position) { if (this.HarvestSound != string.Empty) { FMODUtil.RaiseEvent(this.HarvestSound, "", 0, position); } return(null); }
public override List <Item> Harvested(Point2D position) { if (this.CompletionSound != string.Empty) { FMODUtil.RaiseEvent(this.CompletionSound, "", 0, position); } return(this.Items); }
protected override List <Item> HarvestPercent(double percent, Point2D position) { if (!string.IsNullOrWhiteSpace(this.HarvestSound)) { Point2D screenPosition = new Point2D(position.X * Tile.GetTileSize().X, position.Y * Tile.GetTileSize().Y); FMODUtil.RaiseEvent(this.HarvestSound, "", 0, screenPosition); } return(default);
private void MainMenuButton_ClickEvent(object sender, Reusable.Event.ClickEventArgs e) { FMODUtil.RaiseEvent(SoundsTable.UIClick); MenuHandler.Clear(); if (FromMainMenu) { MainMenu.MainMenu.Initialize(); } }
private IEnumerator Dash() { FMODUtil.PlayOnTransform(dashSound, transform); Dashing = true; yield return(new WaitForSeconds(dashDuration)); Dashing = false; dashTimer = dashCooldown; }
public override List <Item> Harvested(Point2D position) { if (!string.IsNullOrWhiteSpace(this.CompletionSound)) { Point2D screenPosition = new Point2D(position.X * Tile.GetTileSize().X, position.Y * Tile.GetTileSize().Y); FMODUtil.RaiseEvent(this.CompletionSound, "", 0, screenPosition); } return(this.Items); }
private void RpcOnDied() { OnDied?.Invoke(); FMODUtil.PlayOnTransform(diedSound, transform); if (!isServer) { GetComponent <IDieable>().Die(); } }
protected override List <Item> HarvestPercent(double percentMined, Point2D position) { if (this.HarvestSound != string.Empty) { Point2D screenPosition = new Point2D(position.X * Tile.GetTileSize().X, position.Y * Tile.GetTileSize().Y); FMODUtil.RaiseEvent(this.HarvestSound, "", 0, screenPosition); } return(null); }
private void JoinButton_ClickEvent(object sender, Reusable.Event.ClickEventArgs e) { World.Mode = MagicalLifeAPI.Networking.EngineMode.ClientOnly; FMODUtil.RaiseEvent(SoundsTable.UIClick); ClientSendRecieve.Initialize(new MagicalLifeAPI.Networking.NetworkSettings(JoinGameMenu.Menu.IpInputBox.Text, int.Parse(JoinGameMenu.Menu.PortInputBox.Text))); Client.Load(); MenuHandler.Clear(); InGameGUI.Initialize(); BoundHandler.Popup(InGameGUI.InGame); }
/// <summary> /// Called when the current health amount changed. /// </summary> /// <param name="prevHealth">The previous health amount.</param> /// <param name="currentHealth">The current health amount.</param> private void OnCurrentChanged(int prevHealth, int currentHealth) { CurrentChanged?.Invoke(prevHealth, currentHealth); CurrentChangedAsPercentage?.Invoke((float)currentHealth / (float)max); if (prevHealth > currentHealth) { FMODUtil.PlayOnTransform(hitSound, transform); } }
/// <summary> /// Called when the weapon has reloaded. /// </summary> public void OnReloaded() { remainingBullets = weapon.MagazineSize; NetworkWeaponAnimator.OnStoppedReload(); if (isLocalPlayer) { FMODUtil.PlayOnTransform(weapon.WeaponSoundModel.ReloadSound, transform); } BulletCountChanged?.Invoke(remainingBullets); }
public override void Click(MouseEventArgs e, GUIContainer container) { World.Mode = MagicalLifeAPI.Networking.EngineMode.ClientOnly; FMODUtil.RaiseEvent(EffectsTable.UIClick); ClientSendRecieve.Initialize(new MagicalLifeAPI.Networking.NetworkSettings(JoinGameMenu.menu.IpInputBox.Text, int.Parse(JoinGameMenu.menu.PortInputBox.Text))); Client.Load(); MenuHandler.Clear(); InGameGUI.Initialize(); BoundHandler.Popup(InGameGUI.InGame); }
private IEnumerator InnerShow() { FMODUtil.PlayOneShot(loadingStartSound); for (int i = 0; i < playerElements.Count; i++) { playerElements[i].FadeIn(); yield return(new WaitForSeconds(fadeInTime * 0.25f)); } yield return(new WaitForSeconds(fadeInTime * 0.75f)); }
private static void FootStepSound(Living living, Tile footStepsOn) { if (living.FootStepTimer.Allow()) { Point2DFloat screenLocation = new Point2DFloat((float)living.TileLocation.X, (float)living.TileLocation.Y); screenLocation.X *= Tile.GetTileSize().X; screenLocation.Y *= Tile.GetTileSize().Y; FMODUtil.RaiseEvent(SoundsTable.FootSteps, "Material", footStepsOn.FootStepSound, screenLocation.ToPoint2D()); } }
/// <summary> /// Plays a sound. /// </summary> /// <param name="sound">The sound to be played.</param> public void PlaySound(Sound sound) { for (int i = 0; i < sounds.Length; i++) { if (sounds[i].sound == sound) { FMODUtil.PlayOneShot(sounds[i].eventName); return; } } throw new System.Exception("Sound " + sound + " not found!"); }
private void RpcItemPickedUp(Pickable pickable) { switch (pickable.PickableType) { case PickableType.Consumable: case PickableType.Item: FMODUtil.PlayOnTransform(itemPickUpSound, transform); break; case PickableType.Weapon: FMODUtil.PlayOnTransform(((Weapon)pickable).WeaponSoundModel.EquipSound, transform); break; } }
/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { float deltaTime = (float)gameTime.ElapsedGameTime.TotalSeconds; this.DisplayInGame(); FMODUtil.Update(); //Used to render things to a buffer that will have a zoom multiplier applied before rendering. this.GraphicsDevice.Clear(Color.Black); if (Game1.SplashDone) { if (World.Dimensions.Count > 0) { //Never set this to SpriteSortMode.Texture, as that causes bugs. this.MapSpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, RenderInfo.Camera2D.TranslationMatrix); RenderingPipe.DrawScreen(this.MapSpriteBatch); this.MapSpriteBatch.End(); } this.GUIBatch.Begin(); RenderingPipe.DrawGUI(this.GUIBatch); this.GUIBatch.End(); } else { int length = Game1.SplashScreens.Count; for (int i = 0; i < length; i++) { LogoScreen item = Game1.SplashScreens[i]; if (!item.Done()) { item.Draw(this.MapSpriteBatch); break; } if (i == length - 1) { Game1.SplashDone = true; //Initialize main menu GUI.MainMenu.MainMenu.Initialize(); this.IsMouseVisible = true; } } } base.Draw(gameTime); }
private static void FootStepSound(Living living, Tile footStepsOn) { ComponentMovement movementComponent = living.GetExactComponent <ComponentMovement>(); if (movementComponent.FootStepTimer.Allow()) { Point2DFloat screenLocation = new Point2DFloat((float)movementComponent.TileLocation.X, (float)movementComponent.TileLocation.Y); screenLocation.X *= Tile.GetTileSize().X; screenLocation.Y *= Tile.GetTileSize().Y; FMODUtil.RaiseEvent(SoundsTable.FootSteps, "Material", footStepsOn.FootStepSound, screenLocation.ToPoint2D()); } }
private IEnumerator InnerHide() { FMODUtil.PlayOneShot(loadingEndSound); for (int i = 0; i < playerElements.Count; i++) { playerElements[i].FadeOut(); yield return(new WaitForSeconds(fadeOutTime * 0.25f)); } yield return(new WaitForSeconds(fadeOutTime * 0.75f)); for (int i = 0; i < playerElements.Count; i++) { Destroy(playerElements[i].gameObject); } playerElements.Clear(); gameObject.SetActive(false); }
public override void Click(MouseEventArgs e, GUIContainer container) { World.Mode = MagicalLifeAPI.Networking.EngineMode.ServerAndClient; Server.Load(); ClientSendRecieve.Initialize(new MagicalLifeAPI.Networking.NetworkSettings()); FMODUtil.RaiseEvent(EffectsTable.UIClick); ServerSendRecieve.Initialize(new MagicalLifeAPI.Networking.NetworkSettings()); Client.Load(); NewGameInputHandler a = new NewGameInputHandler(); a.StartNewGame(); Server.StartGame(); BoundHandler.RemoveContainer(NewWorldMenu.NewWorldMenuM); MenuHandler.Clear(); BoundHandler.HideAll(); InGameGUI.Initialize(); BoundHandler.Popup(InGameGUI.InGame); }
private void NewWorldNextButton_ClickEvent(object sender, Reusable.Event.ClickEventArgs e) { World.Mode = MagicalLifeAPI.Networking.EngineMode.ServerAndClient; Server.Load(); ClientSendRecieve.Initialize(new MagicalLifeAPI.Networking.NetworkSettings(MagicalLifeAPI.Networking.EngineMode.ServerAndClient)); FMODUtil.RaiseEvent(SoundsTable.UIClick); //FMODUtil.RaiseEvent(SoundsTable.Ambience); ServerSendRecieve.Initialize(new MagicalLifeAPI.Networking.NetworkSettings(MagicalLifeAPI.Networking.EngineMode.ServerAndClient)); Client.Load(); NewGameInputHandler a = new NewGameInputHandler(); a.StartNewGame(); Server.StartGame(); RenderInfo.Camera2D.InitializeForDimension(0); BoundHandler.RemoveContainer(NewWorldMenu.NewWorldMenuM); MenuHandler.Clear(); BoundHandler.HideAll(); InGameGUI.Initialize(); BoundHandler.Popup(InGameGUI.InGame); }
public void Hide() { if (fromWeapon != null && string.IsNullOrEmpty(fromWeapon.WeaponSoundModel.ImpactSound) == false) { FMODUtil.PlayOnPosition(fromWeapon.WeaponSoundModel.ImpactSound, transform.position); } if (inAirLoop.isValid() == true) { inAirLoop.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT); inAirLoop.release(); } owningPlayer = -1; gameObject.SetActive(false); if (ignoringCollider) { Physics2D.IgnoreCollision(ignoringCollider, OwnCollider, false); } ignoringCollider = null; }
public override void OnStartClient() { if (isServer) { return; } ShooterHealth = shooterObject.GetComponent <Health>(); SpriteRenderer.sprite = fromWeapon.BulletInfo.Sprite; if (fromWeapon != null && string.IsNullOrEmpty(fromWeapon.WeaponSoundModel.InAirLoop) == false) { inAirLoop = RuntimeManager.CreateInstance(fromWeapon.WeaponSoundModel.InAirLoop); inAirLoop.set3DAttributes(RuntimeUtils.To3DAttributes(transform)); inAirLoop.start(); FMODUtil.PlayOnPosition(fromWeapon.WeaponSoundModel.ImpactSound, transform.position); } gameObject.layer = layer; if (Player.LocalPlayer?.playerId == owningPlayer) { gameObject.SetActive(false); } else { /* * Debug.Log(velocity); * Body.velocity = velocity; */ /* * Ssm.setPosition(transform.position, true); * StateMirror stateMirror = new StateMirror(); * stateMirror.copyFromSmoothSync(Ssm); * stateMirror.velocity = velocity; * Debug.Log(Ssm.stateCount); * Ssm.addState(stateMirror); */ } }
public override void Click(MouseEventArgs e, GUIContainer container) { int selected = LoadGameMenu.Menu.SaveSelectListBox.SelectedIndex; if (selected != -1) { FMODUtil.RaiseEvent(SoundsTable.UIClick); World.Mode = MagicalLifeAPI.Networking.EngineMode.ServerAndClient; RenderableString selectedItem = (RenderableString)LoadGameMenu.Menu.SaveSelectListBox.Items[selected]; WorldStorage.LoadWorld(selectedItem.Text); Server.Load(); ClientSendRecieve.Initialize(new MagicalLifeAPI.Networking.NetworkSettings(MagicalLifeAPI.Networking.EngineMode.ServerAndClient)); ServerSendRecieve.Initialize(new MagicalLifeAPI.Networking.NetworkSettings(MagicalLifeAPI.Networking.EngineMode.ServerAndClient)); Client.Load(); Server.StartGame(); BoundHandler.RemoveContainer(LoadGameMenu.Menu); MenuHandler.Clear(); BoundHandler.HideAll(); InGameGUI.Initialize(); BoundHandler.Popup(InGameGUI.InGame); } }
private void LoadSaveButton_ClickEvent(object sender, Reusable.Event.ClickEventArgs e) { int selected = LoadGameMenu.Menu.SaveSelectListBox.SelectedIndex; if (selected != -1) { FMODUtil.RaiseEvent(SoundsTable.UIClick); World.Mode = MagicalLifeAPI.Networking.EngineMode.ServerAndClient; RenderableString selectedItem = (RenderableString)LoadGameMenu.Menu.SaveSelectListBox.Items[selected]; WorldStorage.LoadWorld(selectedItem.Text); Server.Load(); ClientSendRecieve.Initialize(new MagicalLifeAPI.Networking.NetworkSettings(MagicalLifeAPI.Networking.EngineMode.ServerAndClient)); ServerSendRecieve.Initialize(new MagicalLifeAPI.Networking.NetworkSettings(MagicalLifeAPI.Networking.EngineMode.ServerAndClient)); Client.Load(); Server.StartGame(); BoundHandler.RemoveContainer(LoadGameMenu.Menu); MenuHandler.Clear(); BoundHandler.HideAll(); InGameGUI.Initialize(); BoundHandler.Popup(InGameGUI.InGame); RenderInfo.Camera2D.InitializeForDimension(0); } }
public override void Click(MouseEventArgs e, GUIContainer container) { FMODUtil.RaiseEvent(SoundsTable.UIClick); LoadGameMenu.Initialize(); MainMenu.MainMenuID.PopupChild(LoadGameMenu.Menu); }
private void QuitButton_ClickEvent(object sender, Reusable.Event.ClickEventArgs e) { FMODUtil.RaiseEvent(SoundsTable.UIClick); }