/// <summary> /// Initializes a new EntityComposer class. /// </summary> public EntityComposer() { Projectiles = new List<Projectile>(); Enemies = new List<Enemy>(); Explosions = new List<Explosion>(); Input = SGL.QueryComponents<InputManager>(); _scoreIndicators = new List<ScoreIndicator>(); Score = 0; _random = new GameRandom(); var contentManager = SGL.QueryComponents<ContentManager>(); var playerTexture = contentManager.Load<Texture2D>("shipAnimation.png"); _projectileTexture = contentManager.Load<Texture2D>("laser.png"); _enemyTexture = contentManager.Load<Texture2D>("mineAnimation.png"); _explosionTexture = contentManager.Load<Texture2D>("explosion.png"); EnableHPBars = true; _laserFire = new SoundEffect(SGL.QueryResource<Sound>("laserFire.wav"), AudioManager.Instance.SoundEffectGroups[0]); _explosion = new SoundEffect(SGL.QueryResource<Sound>("explosion.wav"), AudioManager.Instance.SoundEffectGroups[0]); AudioManager.Instance.SoundEffectGroups[0].MasterVolume = 0.05f; Player = new Player(playerTexture); }
public void PlaySound(SoundEffect sound) { AudioClip clip = null; switch (sound) { case SoundEffect.TaskComplete: clip = Resources.Load("task_complete") as AudioClip; break; } if (clip == null) { return; } var source = effectSources[0]; for (int i = 0; i < effectSources.Length && source.isPlaying; i++) { source = effectSources[i]; } if (source.isPlaying && source.time < 0.15f) { return; } source.Stop(); source.pitch = Random.Range(0.95f, 1.05f); source.clip = clip; source.volume = sfxVolume; source.Play(); }
public void Initialize() { Game.InitializeAssetDatabase(); defaultEngine = new AudioEngine(); using (var monoStream = AssetManager.FileProvider.OpenStream("EffectBip", VirtualFileMode.Open, VirtualFileAccess.Read)) { monoSoundEffect = SoundEffect.Load(defaultEngine, monoStream); } using (var stereoStream = AssetManager.FileProvider.OpenStream("EffectStereo", VirtualFileMode.Open, VirtualFileAccess.Read)) { stereoSoundEffect = SoundEffect.Load(defaultEngine, stereoStream); } using (var contStream = AssetManager.FileProvider.OpenStream("EffectToneA", VirtualFileMode.Open, VirtualFileAccess.Read)) { continousMonoSoundEffect = SoundEffect.Load(defaultEngine, contStream); } using (var contStream = AssetManager.FileProvider.OpenStream("EffectToneAE", VirtualFileMode.Open, VirtualFileAccess.Read)) { continousStereoSoundEffect = SoundEffect.Load(defaultEngine, contStream); } using (var monoStream = AssetManager.FileProvider.OpenStream("Effect44100Hz", VirtualFileMode.Open, VirtualFileAccess.Read)) { laugherMono = SoundEffect.Load(defaultEngine, monoStream); } monoInstance = monoSoundEffect.CreateInstance(); stereoInstance = stereoSoundEffect.CreateInstance(); }
/// <summary> /// Plays the given sound by name. /// </summary> /// <param name="soundName">The name of the sound to play.</param> /// <returns>True upon error, false otherwise.</returns> public static Status PlaySound(SoundEffect soundName) { // Look up the sound by its key. SoundPlayer player; if (s_soundLookup.TryGetValue(soundName, out player) == false) { s_log.WarnFormat("No sound loaded for key {0}", soundName); return Status.Success; } if (player == null) { s_log.ErrorFormat("No SoundPlayer for key {0}", soundName); return Status.NoResult; } try { player.Play(); return Status.Success; } catch (Exception e) { s_log.ErrorFormat("Failed to play sound file {0}: {1}", player.SoundLocation, e.Message); return Status.Failure; } }
public NsfEffect(SoundEffect fx, int track, byte priority, bool loop) { this.track = track - 1; sfx = fx; this.priority = priority; this.loop = loop; playing = false; }
void Awake() { // Register the singleton if (Instance != null) { Debug.LogError("Multiple instances of SoundEffect!"); } Instance = this; }
public void PlaySound(SoundEffect sound) { var clip = GetClip(sound); if (clip && audioPlayer) { audioPlayer.PlayOneShot(clip); } }
//The int returned matches the array number in the player sound effect Game Object. public int SoundEffectToArrayInt (SoundEffect effect) { if (effect == SoundEffect.MenuNavigation) { return 1; } else if (effect == SoundEffect.MenuConfirm) { return 2; } else if (effect == SoundEffect.MenuUnable) { return 3; } return 0; }
protected override async Task LoadContent() { await base.LoadContent(); music = Asset.Load<SoundMusic>("MusicFishLampMp3"); effect = Asset.Load<SoundEffect>("EffectBip"); music.IsLooped = true; effect.IsLooped = true; music.Play(); effect.Play(); }
TimeSpan timelimit; //De tijdlimiet van hoe lang een blokje stil mag blijven staan #endregion Fields #region Constructors public TetrisBlock(Texture2D sprite, ContentManager Content) { this.sprite = sprite; blockForm = new Color[4, 4]; currentBlockForm = new Color[4, 4]; for (int i = 0; i < 4; i++) for (int j = 0; j < 4; j++) blockForm[i, j] = Color.White; timelimit = TimeSpan.FromSeconds(0.9); fullrow = Content.Load<SoundEffect>("FullRow"); blockFormPosition = new Vector2(5 * TetrisGrid.cellwidth, 0); //Startpositie van het blokje }
public void InitComponent(SoundEffect sndEffect) { sound = sndEffect; Id = sndEffect.id; audioSourceBuffer = new List<AudioSource>(sound.maxAudioSources); // Create and setup corresponding AudioSource buffers list for this sound. for(int i = 0; i < sound.maxAudioSources; i++) { audioSourceBuffer.Add( CreateAudioSource(sound) ); } }
protected override Task LoadContent() { effect48kHz = Asset.Load<SoundEffect>("Effect48000Hz"); effect11kHz = Asset.Load<SoundEffect>("Effect11025Hz"); effect22kHz = Asset.Load<SoundEffect>("Effect22050Hz"); effect11kHzStereo = Asset.Load<SoundEffect>("Effect11025HzStereo"); effect22kHzStereo = Asset.Load<SoundEffect>("Effect22050HzStereo"); effectA = Asset.Load<SoundEffect>("EffectToneA"); musicA = Asset.Load<SoundMusic>("MusicToneA"); return Task.FromResult(true); }
public void Play(SoundEffect effect, bool loop) { if (effect == SoundEffect.Walk) { if (!runSource.isPlaying) { runSource.loop = loop; runSource.Play(); } } else if (effect == SoundEffect.Attack) { if (!attackSource.isPlaying) { attackSource.loop = loop; attackSource.Play(); } } else if (effect == SoundEffect.BotAttack) { if (!botAttackSource.isPlaying) { botAttackSource.loop = loop; botAttackSource.Play(); } } else if (effect == SoundEffect.PickUp) { if (!pickUpSource.isPlaying) { pickUpSource.loop = loop; pickUpSource.Play(); } } else if (effect == SoundEffect.Potion) { if (!potionSource.isPlaying) { potionSource.loop = loop; potionSource.Play(); } } else if (effect == SoundEffect.PowerUp) { if (!powerUpSource.isPlaying) { powerUpSource.loop = loop; powerUpSource.Play(); } } }
protected AudioSource CreateAudioSource(SoundEffect sndEffect) { AudioSource audioSrc = gameObject.AddComponent<AudioSource>(); audioSrc.loop = sndEffect.loop; audioSrc.priority = sndEffect.priority; audioSrc.volume = sndEffect.volume; audioSrc.pitch = sndEffect.pitch; audioSrc.playOnAwake = false; audioSrc.clip = sndEffect.audioClip; return audioSrc; }
public IAsset Load(string name, string path, Dictionary<string, string> parameters, ContentManager contenu) { string bank = parameters[@"bank"]; Microsoft.Xna.Framework.Audio.SoundEffect sound = contenu.Load<Microsoft.Xna.Framework.Audio.SoundEffect>(path); sound.Name = name; SoundEffect soundEffect = new SoundEffect(); soundEffect.Sound = sound; Audio.AudioController.SetSfx(bank, soundEffect); return soundEffect; }
public void Initialize() { Game.InitializeAssetDatabase(); engine = new AudioEngine(); using (var stream = AssetManager.FileProvider.OpenStream("EffectBip", VirtualFileMode.Open, VirtualFileAccess.Read)) { oneSound = SoundEffect.Load(engine, stream); } oneSound.IsLooped = true; sayuriPart = SoundMusic.Load(engine, AssetManager.FileProvider.OpenStream("MusicFishLampMp3", VirtualFileMode.Open, VirtualFileAccess.Read)); sayuriPart.IsLooped = true; }
public override void Begin() { // Tätä aliohjelmaa kutsumalla peli lataa kaikki PajaPeliin tehdyt sisällöt levyltä. LataaSisallotTiedostoista(); Mouse.IsCursorVisible = true; // Nollaa valinnat ValittuPelaajaHahmo = null; ValittuKartta = null; ValittuTausta = null; ValittuMusiikki = null; Apuri.NaytaAlkuValikko(); }
static void Main(string[] args) { Background = Color.Black; Static = new Color(52, 73, 94); Foreground = new Color(253, 227, 167); Engine.Initialize<SfmlRenderer, IrrKlangModule.IrrKlangAudioModule>(); Engine.EventHost.RegisterEvent<KeyDownEvent>((int)Keyboard.Key.Escape, 0, (ev) => { while (Engine.SceneHost.CurrentScene != null) Engine.SceneHost.Pop(); }); Engine.EventHost.RegisterEvent<InitializeEvent>(0, (ev) => { Engine.DesiredResolution = new Vector2(640f, 480f); Container = Engine.ResourceHost.LoadDictionary("main", "Resources"); Font12 = LoadFont("Fonts/merriweather_12.fnt"); Font16 = LoadFont("Fonts/merriweather_16.fnt"); Logo = LoadTexture("logo.png"); Player = LoadTexture("player.png"); Portal = LoadTexture("portal.png"); Hint1 = LoadTexture("hint1.png"); Hint2 = LoadTexture("hint2.png"); Hint3 = LoadTexture("hint3.png"); EndScreen = LoadTexture("endscreen.png"); Music = LoadSound("music.wav"); EnemyHit = LoadSound("ehit.wav"); Cut = LoadSound("cut.wav"); Ground = LoadSound("ground.wav"); Music.Loop(); Image image = new Image(1, 1); image.SetColor(0, 0, Color.White); Pixel = Engine.Renderer.TextureFromImage(image); var scene = Engine.SceneHost.CreateGlobal<MainScene>(); Engine.SceneHost.Push(scene); }); Engine.StartGame("cut", WindowStyle.Default); }
protected void ToistaTehoste(Tapahtuma tapahtuma) { if (Tehosteet.ContainsKey(tapahtuma)) { bool liikkumisAaniLoppunut = liikkumisTehoste == null || !liikkumisTehoste.IsPlaying; if (tapahtuma != Tapahtuma.Liikkuu || liikkumisAaniLoppunut) { SoundEffect tehoste = RandomGen.SelectOne<SoundEffect>(Tehosteet[tapahtuma]); tehoste.Play(0.25, 0.0, 0.0); if (tapahtuma == Tapahtuma.Liikkuu) { // Pistetään muistiin, että toistetaan liikkumisääntä liikkumisTehoste = tehoste; } } } }
public void Play(SoundEffect type, float volume = 1.0F) { //_soundEffect?.Dispose(); switch (type) { case SoundEffect.Move: _wfr = new WaveFileReader(Properties.Resources.Move); break; case SoundEffect.Confirm: _wfr = new WaveFileReader(Properties.Resources.Confirm); break; case SoundEffect.Cancel: _wfr = new WaveFileReader(Properties.Resources.Cance); break; case SoundEffect.Eliminate: _wfr = new WaveFileReader(Properties.Resources.Eliminate); break; case SoundEffect.EnemyAttack: _wfr = new WaveFileReader(Properties.Resources.EnemyAttack); break; case SoundEffect.Fail: _wfr = new WaveFileReader(Properties.Resources.Fail); break; case SoundEffect.GetItem: _wfr = new WaveFileReader(Properties.Resources.GetItem); break; case SoundEffect.OpenDoor: _wfr = new WaveFileReader(Properties.Resources.OpenDoor); break; case SoundEffect.PlayerAttack: _wfr = new WaveFileReader(Properties.Resources.PlayerAttack); break; case SoundEffect.Select: _wfr = new WaveFileReader(Properties.Resources.Select); break; default: throw new Exception("Not expected audioType."); } WaveChannel32 wc = new WaveChannel32(_wfr) { PadWithZeroes = false }; _soundEffect = new DirectSoundOut(); _soundEffect.Init(wc); _soundEffect.Volume = volume; _soundEffect.Play(); }
/// <summary> /// Adds or replaces a sound by name and file path. /// </summary> /// <param name="soundName">The name of the sound to load.</param> /// <param name="filePath">The path of the sound file.</param> /// <returns>True upon error, false otherwise.</returns> public static Status SetSound(SoundEffect soundName, string filePath) { // If the path is bad, if (String.IsNullOrEmpty(filePath) == true || File.Exists(filePath) == false) { s_log.ErrorFormat("Bad path provided: {0}", filePath); return Status.Failure; } // Make the SoundPlayer and save the sound name as the Tag. SoundPlayer player = new SoundPlayer(filePath); player.Tag = soundName; // Start loading the file. s_log.DebugFormat("Starting load of sound {0}.", player.SoundLocation); player.LoadCompleted += SoundLoadComplete; player.LoadAsync(); return Status.Success; }
private AudioClip GetClip(SoundEffect effect) { switch (effect) { case SoundEffect.DeepOneWalk: return deepOneWalk; case SoundEffect.StrandedWalk: return strandedWalk; case SoundEffect.TurnChange: return turnChange; case SoundEffect.DeepOneVictoryWarning: return deepOneVictoryWarning; } if (effect != SoundEffect.Undefined) { Debug.LogError("No clip for " + effect); } return null; }
public GameState(GraphicsDeviceManager graphics, ContentManager Content) { this.Singleplayer = Content.Load<Texture2D>("PongStartScreenSingle"); this.Multiplayer = Content.Load<Texture2D>("PongStartScreenMultiplayer"); this.Exit = Content.Load<Texture2D>("PongStartScreenExit"); RoodWint = Content.Load<Texture2D>("Red wins de goeie"); BlauwWint = Content.Load<Texture2D>("Blue wins de goeie"); Screen currentScreen = Screen.StartScreen; SelectionStart currentSelection = SelectionStart.Singleplayer; currentKeyBoardState = Keyboard.GetState(); PlayingBall = new Ball(Content, graphics, -250, 250); SpelerRood = new Paddle(Content, graphics, 0, 0, 1); // Inladen van Rood. SpelerRood.Position.Y = (graphics.GraphicsDevice.Viewport.Height / 2) - (SpelerRood.rodeSpeler.Height / 2); // ylocatie speler rood SpelerRood.xloc = (int)SpelerRood.Position.X; SpelerRood.yloc = (int)SpelerRood.Position.Y; SpelerBlauw = new Paddle(Content, graphics, 0, 0, 1); // Inladen van Blauw. SpelerBlauw.Position.Y = (graphics.GraphicsDevice.Viewport.Height / 2) - (SpelerBlauw.blauweSpeler.Height / 2); // y locatie speler blauw SpelerBlauw.yloc = (int)SpelerBlauw.Position.Y; SpelerBlauw.Position.X = graphics.GraphicsDevice.Viewport.Width - (SpelerBlauw.blauweSpeler.Width); // x locatie speler blauw SpelerBlauw.xloc = (int)SpelerBlauw.Position.X; livesBlue = 3; livesRed = 3; PaddleHit = Content.Load<SoundEffect>("Plop(2)"); }
public GameWorld(int width, int height, ContentManager Content) { screenWidth = width; screenHeight = height; random = new Random(); gameState = GameState.Playing; gridTexture = Content.Load<Texture2D>("gridBlock2"); blockTexture = Content.Load<Texture2D>("block"); blockEdgeTexture = Content.Load<Texture2D>("blockBackground"); gridBorder = Content.Load<Texture2D>("Border"); bufferBorder = Content.Load<Texture2D>("BufferBorder"); background = Content.Load<Texture2D>("background"); segoeui = Content.Load<SpriteFont>("segoeui"); segoeuiLarge = Content.Load<SpriteFont>("segoeuiLarge"); theme = Content.Load<Song>("themeSong"); MediaPlayer.IsRepeating = true; MediaPlayer.Volume = 0.07f; MediaPlayer.Play(theme); blockPlaced = Content.Load<SoundEffect>("blockPlaced"); blockPlaced2 = Content.Load<SoundEffect>("blockPlaceSound2"); blockPlaced3 = Content.Load<SoundEffect>("blockPlaceSound3"); blockPlaced4 = Content.Load<SoundEffect>("blockPlaceSound4"); rowCleared = Content.Load<SoundEffect>("rowCleared"); grid = new TetrisGrid(gridTexture, blockTexture, blockEdgeTexture, segoeui); //Timer for moving the blocks down one unit a second Timer aTimer = new System.Timers.Timer(500); aTimer.Elapsed += OnTimedEvent; aTimer.AutoReset = true; aTimer.Enabled = true; }
/// <summary> /// Checks if current sound is tagged with provided tag /// </summary> /// <returns></returns> public static bool HasTag(this SoundEffect sound, SoundEffectTag tag) { return(sound.GetAttribute <TagsAttribute>()?.Tags?.Contains(tag) ?? false); }
// Play a single clip through the sound effects source. public void Play(SoundEffect soundEffect) { effectsSource.PlayOneShot(SoundClip(soundEffect)); }
public SoundManager() { shoot = null; explosion = null; mediaFon = null; }
public BasicWeapon(Mob owner, RangedStats ranged, MeleeStats melee, Texture2D pTexture, Texture2D mTexture, SoundEffect soundEffect) : base(owner, ranged, melee, pTexture, mTexture, soundEffect) { }
public void PlaySound(string assetName) { SoundEffect snd = contentManager.Load <SoundEffect>(assetName); snd.Play(); }
public static void LoadContent(ContentManager Content) { AngelIslandAct2Song = Content.Load<Song>("Angel Island Act2"); Act2Signe = Content.Load<Texture2D>("Act2Signe"); FireAnim = Content.Load<Texture2D>("FireAnim"); Pente2 = Content.Load<Texture2D>("Pente2"); Obs4 = Content.Load<Texture2D>("Obs4"); BackComplete2 = Content.Load<Texture2D>("BackComplete2"); BackAct2Front = Content.Load<Texture2D>("Act2Front"); BackAct2 = Content.Load<Texture2D>("Act2Back"); TailLife = Content.Load<Texture2D>("TailLife"); ItemLifeTail = Content.Load<Texture2D>("ItemLifeTail"); TailFlag = Content.Load<Texture2D>("TailGoalSign"); TailText = Content.Load<Texture2D>("TailText"); SonicPause = Content.Load<Texture2D>("SonicPause"); DeadTail = Content.Load<Texture2D>("DeadTail"); TailHurt = Content.Load<Texture2D>("TailHurt"); TailAttack1 = Content.Load<Texture2D>("TailAttack"); TailCourse = Content.Load<Texture2D>("TailCourse"); TailMiCourse = Content.Load<Texture2D>("TailMiCourse"); TailJumpForward = Content.Load<Texture2D>("TailJumpForward"); SpiningTail = Content.Load<Texture2D>("TailSpining"); TailBoule = Content.Load<Texture2D>("TailBoule"); CrouchTail = Content.Load<Texture2D>("CrouchTail"); TailJump = Content.Load<Texture2D>("TailJump"); TailWalking = Content.Load<Texture2D>("TailWalking"); TailWaiting = Content.Load<Texture2D>("TailWaiting"); LevelComplete = Content.Load<Song>("Level Complete"); SonicText = Content.Load<Texture2D>("SonicText"); PassedText = Content.Load<Texture2D>("PassedText"); Act1Text = Content.Load<Texture2D>("Act1Text"); MinorBoss = Content.Load<Song>("Minor bosses"); DeadSonic = Content.Load<Texture2D>("DeadSonic"); TremplinBas = Content.Load<Texture2D>("RedBongB"); TremplinBasAnim = Content.Load<Texture2D>("RedBongBAnim"); Arriere3 = Content.Load<Texture2D>("Arriere3"); TremplinH2 = Content.Load<Texture2D>("redBongH2"); TremplinHAnim2 = Content.Load<Texture2D>("redBongHAnim2"); TremplinH = Content.Load<Texture2D>("redBongH"); TremplinHAnim = Content.Load<Texture2D>("redBongHAnim"); BossGoalSign = Content.Load<Texture2D>("BossGoalSign"); SonicFlag = Content.Load<Texture2D>("SonicGoalSign"); Flag = Content.Load<Texture2D>("FlagAnim"); MiniBossKill = Content.Load<SoundEffect>("Destruction MiniBoss"); MiniBossDes = Content.Load<Texture2D>("miniBossDes"); Hurt = Content.Load<SoundEffect>("Hurt"); FireBullet = Content.Load<SoundEffect>("FireBulletwav"); TouchBoss = Content.Load<SoundEffect>("TouchBoss"); MB1FireBullet = Content.Load<Texture2D>("FireBullet"); MB1feuAnim = Content.Load<Texture2D>("MB1FeuAnim"); MiniBoss1Touch = Content.Load<Texture2D>("MiniBoss1Touch"); MiniBoss1 = Content.Load<Texture2D>("MiniBoss1"); CheckPoint = Content.Load<SoundEffect>("CheckPoint"); Pente1A = Content.Load<Texture2D>("Pente1A"); Pente1 = Content.Load<Texture2D>("Pente1"); loop = Content.Load<Texture2D>("loop"); PerteBouclier = Content.Load<SoundEffect>("Perte Bouclier"); BulleAnim = Content.Load<Texture2D>("BulleAnim"); BulleJumpAnim = Content.Load<Texture2D>("bulleJumpAnim"); BubbleShieldAnim = Content.Load<Texture2D>("BulleShieldAnim"); LifeUp = Content.Load<SoundEffect>("LifeUp"); ItemDestroy = Content.Load<Texture2D>("itemDestroy"); ItemLife = Content.Load<Texture2D>("itemLife"); ItemRing = Content.Load<Texture2D>("itemRing"); ItemBulleBlanche = Content.Load<Texture2D>("itemBulleBlanche"); ItemTele = Content.Load<Texture2D>("itemTele"); NoixCoco = Content.Load<Texture2D>("NoixCoco"); NoixArmed = Content.Load<Texture2D>("NoixArmed"); MainSingeArticu = Content.Load<Texture2D>("MainBrasArticuler"); BouleBrasArti = Content.Load<Texture2D>("BouleBras"); BrasSinge = Content.Load<Texture2D>("BrasSinge"); TeteSinge = Content.Load<Texture2D>("TeteSinge"); EnnemiItem = Content.Load<SoundEffect>("EnnemiItem"); Poulet = Content.Load<Texture2D>("PoulelAnim"); Oiseau = Content.Load<Texture2D>("OiseauAnim"); Ecureuil = Content.Load<Texture2D>("EcureuilAnim"); KillEnnemie = Content.Load<Texture2D>("killBadnickAnim"); RhinoReturn1 = Content.Load<Texture2D>("RhinobotReturn1"); RhinoReturn2 = Content.Load<Texture2D>("RhinobotReturn2"); RhinobotMove = Content.Load<Texture2D>("RhinobotMove"); CheckNonPasser = Content.Load<Texture2D>("checkpointNonPasser"); CheckPasser = Content.Load<Texture2D>("checkpointPasser"); SonicLife = Content.Load<Texture2D>("SonicLife"); SonicHurt = Content.Load<Texture2D>("sonicHurt"); LostRing = Content.Load<SoundEffect>("LostRing"); PicVerticale = Content.Load<Texture2D>("PicVerticale"); RingTexte = Content.Load<Texture2D>("RingText"); Ring0 = Content.Load<Texture2D>("Ring0"); Ring1 = Content.Load<Texture2D>("Ring1"); Ring2 = Content.Load<Texture2D>("Ring2"); Ring3 = Content.Load<Texture2D>("Ring3"); Ring4 = Content.Load<Texture2D>("Ring4"); Ring5 = Content.Load<Texture2D>("Ring5"); Ring6 = Content.Load<Texture2D>("Ring6"); Ring7 = Content.Load<Texture2D>("Ring7"); Ring8 = Content.Load<Texture2D>("Ring8"); Ring9 = Content.Load<Texture2D>("Ring9"); CatchRing = Content.Load<SoundEffect>("CatchRing"); RingCatch = Content.Load<Texture2D>("ringcatch"); RingAnim = Content.Load<Texture2D>("ringAnim"); Ecorce2 = Content.Load<Texture2D>("ecorceComplexe2"); Ecorce = Content.Load<Texture2D>("ecorceComplexe"); Spring = Content.Load<SoundEffect>("Spring"); ArbreCoconut = Content.Load<Texture2D>("arbre"); Feuillage1 = Content.Load<Texture2D>("feuillage1"); Feuillage2 = Content.Load<Texture2D>("feuillage2"); tremplinrougeAnim = Content.Load<Texture2D>("RedBongAnim"); TremplinRouge = Content.Load<Texture2D>("RedBong"); Jump = Content.Load<SoundEffect>("Jump"); Spin = Content.Load<SoundEffect>("Spin"); Spin2 = Content.Load<SoundEffect>("Spin2"); SonicCourse = Content.Load<Texture2D>("SonicCourse"); SonicMiCourse = Content.Load<Texture2D>("SonicMiCourse"); EcritureInformative = Content.Load<SpriteFont>("Info"); Obs3 = Content.Load<Texture2D>("Obs3"); DustSpin = Content.Load<Texture2D>("DustSpin"); Attack1 = Content.Load<Texture2D>("attack1"); Obstacle2 = Content.Load<Texture2D>("obstacle2"); Obstacle1 = Content.Load<Texture2D>("obstacle1"); SonicWalking = Content.Load<Texture2D>("SonicWalking"); SonicJump = Content.Load<Texture2D>("SonicJump"); SpiningSonic = Content.Load<Texture2D>("SpiningSonic"); CrouchSonic = Content.Load<Texture2D>("CrouchSonic"); SonicWaiting = Content.Load<Texture2D>("SonicWaiting"); NormalSonic = Content.Load<Texture2D>("normalSonic"); CompleteBack = Content.Load<Texture2D>("CompleteAngelIslandBack"); AngelIslandAct1Song = Content.Load<Song>("Angel Island Act1"); MainMenuSong = Content.Load<Song>("MainMenu"); FlecheSelect = Content.Load<Texture2D>("flecheSelect"); TailPresent = Content.Load<Texture2D>("TailPresent"); SonicPresent = Content.Load<Texture2D>("sonicPresent"); Test = Content.Load<Texture2D>("Test"); CadreCarre = Content.Load<Texture2D>("cadreCarre"); Stage1 = Content.Load<Texture2D>("Stage1"); CadreNormal = Content.Load<Texture2D>("cadreNormal"); CadreNoSave = Content.Load<Texture2D>("cadreNoSave"); CadreAnim = Content.Load<Texture2D>("cadreAnim"); NewGame = Content.Load<Texture2D>("NewGame"); MainMenuBack = Content.Load<Texture2D>("MainMenuBack2"); PlayerIntro = Content.Load<Texture2D>("playerIntro"); CompetIntro = Content.Load<Texture2D>("CompetIntro"); MainSonic = Content.Load<Texture2D>("MainSonic"); ClinOeil = Content.Load<Texture2D>("ClinOeil"); CopyRight = Content.Load<Texture2D>("Copyright"); SonicEmbleme = Content.Load<Texture2D>("sonic3embleme"); SegaSong = Content.Load<Song>("sega"); IntroSong = Content.Load<Song>("SonicIntroRepeat"); LogoPart1 = Content.Load<Texture2D>("LogoPart1"); LogoPart2 = Content.Load<Texture2D>("LogoPart2"); LogoPart3 = Content.Load<Texture2D>("LogoPart3"); LogoPart4 = Content.Load<Texture2D>("LogoPart4"); LogoPart5 = Content.Load<Texture2D>("LogoPart5"); SegaLogo = Content.Load<Texture2D>("segalogow"); BackIntro = Content.Load<Texture2D>("backintro"); TailAirplane = Content.Load<Texture2D>("TailAirplane"); }
private static void LoadSound() { menu_select = Content.Load <SoundEffect>(@"sound\sfx\menu_select"); yes1 = Content.Load <SoundEffect>(@"sound\yessir\yes1"); moving_out = Content.Load <SoundEffect>(@"sound\speech\moving_out"); }
/// <summary> /// Retrieves the list of tags that are valid for this sound's replacement. If the sound has no ReplacableByTags attribute specified, returns all tags. /// </summary> /// <returns></returns> public static SoundEffectTag[] ReplacableByTags(this SoundEffect sound) { var tags = sound.GetAttribute <ReplacableByTagsAttribute>()?.Tags?.ToArray(); return(tags ?? Enum.GetValues(typeof(SoundEffectTag)).Cast <SoundEffectTag>().ToArray()); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { var settings = GlobalSettings.Default; if (FSOEnvironment.DPIScaleFactor != 1 || FSOEnvironment.SoftwareDepth) { settings.GraphicsWidth = GraphicsDevice.Viewport.Width / FSOEnvironment.DPIScaleFactor; settings.GraphicsHeight = GraphicsDevice.Viewport.Height / FSOEnvironment.DPIScaleFactor; } FSO.LotView.WorldConfig.Current = new FSO.LotView.WorldConfig() { AdvancedLighting = settings.Lighting, SmoothZoom = settings.SmoothZoom, SurroundingLots = settings.SurroundingLotMode, AA = settings.AntiAlias }; OperatingSystem os = Environment.OSVersion; PlatformID pid = os.Platform; GameFacade.Linux = (pid == PlatformID.MacOSX || pid == PlatformID.Unix); FSO.Content.Content.TS1Hybrid = GlobalSettings.Default.TS1HybridEnable; FSO.Content.Content.TS1HybridBasePath = GlobalSettings.Default.TS1HybridPath; //FSO.Content.Content.Init(GlobalSettings.Default.StartupPath, GraphicsDevice); base.Initialize(); GameFacade.GameThread = Thread.CurrentThread; SceneMgr = new _3DLayer(); SceneMgr.Initialize(GraphicsDevice); GameFacade.Scenes = SceneMgr; GameFacade.GraphicsDevice = GraphicsDevice; GameFacade.GraphicsDeviceManager = Graphics; GameFacade.Cursor = new CursorManager(GraphicsDevice); if (!GameFacade.Linux) { GameFacade.Cursor.Init(GlobalSettings.Default.StartupPath); } /** Init any computed values **/ GameFacade.Init(); //init audio now HITVM.Init(); var hit = HITVM.Get(); hit.SetMasterVolume(HITVolumeGroup.FX, GlobalSettings.Default.FXVolume / 10f); hit.SetMasterVolume(HITVolumeGroup.MUSIC, GlobalSettings.Default.MusicVolume / 10f); hit.SetMasterVolume(HITVolumeGroup.VOX, GlobalSettings.Default.VoxVolume / 10f); hit.SetMasterVolume(HITVolumeGroup.AMBIENCE, GlobalSettings.Default.AmbienceVolume / 10f); GameFacade.Strings = new ContentStrings(); GraphicsDevice.RasterizerState = new RasterizerState() { CullMode = CullMode.None }; try { var audioTest = new SoundEffect(new byte[2], 44100, AudioChannels.Mono); //initialises XAudio. audioTest.CreateInstance().Play(); } catch (Exception e) { //MessageBox.Show("Failed to initialize audio: \r\n\r\n" + e.StackTrace); } this.IsFixedTimeStep = true; WorldContent.Init(this.Services, Content.RootDirectory); base.Screen.Layers.Add(SceneMgr); base.Screen.Layers.Add(uiLayer); GameFacade.LastUpdateState = base.Screen.State; if (!GlobalSettings.Default.Windowed && !GameFacade.GraphicsDeviceManager.IsFullScreen) { GameFacade.GraphicsDeviceManager.ToggleFullScreen(); } }
void Start() { smoothFollow = GameObject.Find("Main Camera").GetComponent<SmoothFollow>(); soundEffect = GameObject.Find("SoundController").GetComponent<SoundEffect>(); SpawnPlayer(); }
/// <summary> /// Processes a sound that has finished playing. /// </summary> /// <param name="sound"> /// The sound. /// </param> private void ProcessFinishedSound(int sound) { if (this.musicEffect.Sound == sound) { if (!this.LoopSound(this.musicEffect)) { this.musicEffect = null; } return; } if (this.soundEffects != null) { var soundEffect = this.soundEffects.Front; if (sound == soundEffect.Sound) { if (!this.LoopSound(soundEffect) || this.soundEffects.Tail != null) { this.soundEffects = this.soundEffects.Tail; } this.PlayNextSound(); } } }
public void LoadContent(ContentManager Content) { shoot = Content.Load <SoundEffect>("Shoot"); explosion = Content.Load <SoundEffect>("Explosion"); }
/// <summary> /// <para>Checks if current soundeffect has ReplacableInMessage Attribute</para> /// /// </summary> public static bool IsReplacableInMessage(this SoundEffect sound) { return(sound.GetAttribute <ReplacableInMessageAttribute>() != null); }
public void LoadContent() { BlockHitSound = Helper.LoadSoundEffect("BlockExplode"); BlockEatSound = Helper.LoadSoundEffect("BlockEat"); }
public static void PlaySoundEffect(string name, float volume = 1, float pitch = 0, float pan = 0) { SoundEffect soundEffect = ContentHelper.GetSoundEffect("Audio/Sound Effects/" + name); soundEffect.Play(volume, pitch, pan); }
protected override void LoadContent() { base.LoadContent(); m_BarrierHitSoundEffect = this.Game.Content.Load <SoundEffect>("Sounds/BarrierHit"); }
public void Load(IContentLoader loader) { base.Props.Texture = loader.Load <Texture2D>(ContentPaths.SPRITE_COIN); sfxCollect = loader.Load <SoundEffect>(ContentPaths.SFX_COIN_COLLECT); }
public void SoundEffectFromStream_Unsupported_Formats(string filename) { using (var stream = File.OpenRead(filename)) Assert.Throws <ArgumentException>(() => SoundEffect.FromStream(stream)); }
public sound(theGame reference, String name) { this.reference = reference; soundEffect = reference.Content.Load <SoundEffect>(name); }
protected override void PlaySoundEffect(SoundEffect soundEffect) { SoundManager.Play3DSoundOnece(soundEffect, PositionInWorld - Globals.ListenerPosition); }
void Awake() { FireSound = DadaAudio.GetSoundEffect(FireSound); }
/// <summary> /// Loads the sound into the dictionary and in turn the memory. /// </summary> /// <param name="key"></param> /// <param name="sound"></param> public static void LoadSound(string key, SoundEffect sound) { _sounds[key] = sound; }
public override void Initialize() { base.Initialize(); this.sBlink = this.CMProvider.Global.Load <SoundEffect>("Sounds/Gomez/Blink"); }
public T Load <T>(string assetName) { string originalAssetName = assetName; object result = null; if (this.graphicsDeviceService == null) { this.graphicsDeviceService = serviceProvider.GetService(typeof(IGraphicsDeviceService)) as IGraphicsDeviceService; if (this.graphicsDeviceService == null) { throw new InvalidOperationException("No Graphics Device Service"); } } assetName = Path.Combine(_rootDirectory, assetName.Replace('\\', Path.DirectorySeparatorChar)); // Get the real file name if ((typeof(T) == typeof(Texture2D))) { assetName = Texture2DReader.Normalize(assetName); } else if ((typeof(T) == typeof(SpriteFont))) { assetName = SpriteFontReader.Normalize(assetName); } else if ((typeof(T) == typeof(Effect))) { assetName = Effect.Normalize(assetName); } else if ((typeof(T) == typeof(Song))) { assetName = SongReader.Normalize(assetName); } else if ((typeof(T) == typeof(SoundEffect))) { assetName = SoundEffectReader.Normalize(assetName); } else if ((typeof(T) == typeof(Video))) { assetName = Video.Normalize(assetName); } else { throw new NotSupportedException("Format not supported"); } if (string.IsNullOrEmpty(assetName)) { throw new ContentLoadException("Could not load " + originalAssetName + " asset!"); } if (Path.GetExtension(assetName).ToUpper() != ".XNB") { if ((typeof(T) == typeof(Texture2D))) { //Basically the same as Texture2D.FromFile but loading from the assets instead of a filePath Stream assetStream = Game.contextInstance.Assets.Open(assetName); Bitmap image = BitmapFactory.DecodeStream(assetStream); //Bitmap image = BitmapFactory.DecodeFileDescriptor(Game.contextInstance.Assets.OpenFd(assetName).FileDescriptor); ESImage theTexture; if (GraphicsDevice.openGLESVersion == OpenTK.Graphics.GLContextVersion.Gles2_0) { theTexture = new ESImage(image, graphicsDeviceService.GraphicsDevice.PreferedFilterGL20); } else { theTexture = new ESImage(image, graphicsDeviceService.GraphicsDevice.PreferedFilterGL11); } result = new Texture2D(theTexture) { Name = Path.GetFileNameWithoutExtension(assetName) }; } if ((typeof(T) == typeof(SpriteFont))) { //result = new SpriteFont(Texture2D.FromFile(graphicsDeviceService.GraphicsDevice,assetName), null, null, null, 0, 0.0f, null, null); throw new NotImplementedException(); } if ((typeof(T) == typeof(Song))) { result = new Song(assetName); } if ((typeof(T) == typeof(SoundEffect))) { result = new SoundEffect(assetName); } if ((typeof(T) == typeof(Video))) { result = new Video(assetName); } } else { // Load a XNB file //Loads from Assets directory + /assetName Stream assetStream = Game.contextInstance.Assets.Open(assetName); ContentReader reader = new ContentReader(this, assetStream, this.graphicsDeviceService.GraphicsDevice); ContentTypeReaderManager typeManager = new ContentTypeReaderManager(reader); reader.TypeReaders = typeManager.LoadAssetReaders(reader); foreach (ContentTypeReader r in reader.TypeReaders) { r.Initialize(typeManager); } // we need to read a byte here for things to work out, not sure why reader.ReadByte(); // Get the 1-based index of the typereader we should use to start decoding with int index = reader.ReadByte(); ContentTypeReader contentReader = reader.TypeReaders[index - 1]; result = reader.ReadObject <T>(contentReader); reader.Close(); assetStream.Close(); } if (result == null) { throw new ContentLoadException("Could not load " + originalAssetName + " asset!"); } return((T)result); }
private void CustomiseSetttings_Load(object sender, EventArgs e) { SoundEffect.Play(ESounds.windowslides); }
private void StartGame_Click(object sender, EventArgs e) { SoundEffect.Play(ESounds.mousedown); }
public void LoadContent(ContentManager content) { player = content.Load <Texture2D>("newPlayer"); playerHit = content.Load <SoundEffect>("paddle_hit"); }
private void InvokeSoundEffect(SoundEffect packet) { packetListener.OnSoundEffect(packet); }
/// <summary> /// Stops a sound that is playing. /// </summary> /// <param name="sound"> /// The sound. /// </param> private void StopSound(ushort sound) { if (this.musicEffect.Sound == sound) { this.musicEffect = null; this.FrontEnd.StopSound(sound); return; } if (this.soundEffects != null && this.soundEffects.Front.Sound == sound) { this.FrontEnd.StopSound(this.soundEffects.Front.Sound); this.soundEffects = this.soundEffects.Tail; this.PlayNextSound(); } }
void Start() { ExplosionSound = DadaAudio.GetSoundEffect(ExplosionSound); }
protected void Initialize(string filename) { sound = GameEnvironment.AssetManager.Content.Load<SoundEffect>("Music\\" + filename); iSound = sound.CreateInstance(); }
//Returns a reference to the soundeffect in the dictionary structure public SoundEffect GetSoundEffectByKey(string key) { SoundEffect sfx = SoundEffectDictionary[key]; return(sfx); }
private static void ShowLoadingScreen() { _Background = SwinGame.LoadBitmap(SwinGame.PathToResource("SplashBack.png", ResourceKind.BitmapResource)); SwinGame.DrawBitmap(_Background, 0, 0); SwinGame.RefreshScreen(); SwinGame.ProcessEvents(); _Animation = SwinGame.LoadBitmap(SwinGame.PathToResource("SwinGameAni.jpg", ResourceKind.BitmapResource)); _LoadingFont = SwinGame.LoadFont(SwinGame.PathToResource("arial.ttf", ResourceKind.FontResource), 12); _StartSound = Audio.LoadSoundEffect(SwinGame.PathToResource("SwinGameStart.ogg", ResourceKind.SoundResource)); _LoaderFull = SwinGame.LoadBitmap(SwinGame.PathToResource("loader_full.png", ResourceKind.BitmapResource)); _LoaderEmpty = SwinGame.LoadBitmap(SwinGame.PathToResource("loader_empty.png", ResourceKind.BitmapResource)); PlaySwinGameIntro(); }
public void PlayOneShot(SoundEffect sound, float volumescale = 1) { soundEffectSource.PlayOneShot(SoundEffects[sound], volumescale); }
public Theme(string themeName) { intro = ContentManager.Load<SoundEffect>(themeName + "_intro"); loop = ContentManager.Load<SoundEffect>(themeName + "_loop"); }
public override void Load() { _pickupSound = Layout.Content.Load <SoundEffect>("audio/pickup_key"); }