public override void Enter(StateMario previousState) { base.Enter(previousState); this.StateMachine.Mario.SetSheetState(SpriteStates.Sheets.NORMAL); this.StateMachine.Mario.SetSpriteState(SpriteStates.Sprites.DEAD); this.StateMachine.Mario.Info.velocity = new Vector2(0f, -8f); MediaPlayer.Stop(); SoundEffect dying = SoundFactory.Death(); SoundFactory.PlaySoundEffect(dying); Task.Factory.StartNew(delegate() { Console.WriteLine("Waiting {0}ms before resetting", dying.Duration.Milliseconds * 10); Thread.Sleep(dying.Duration.Milliseconds * 10); this.StateMachine.Mario.lives--; if (this.StateMachine.Mario.lives > 0) { Console.WriteLine("Resetting after next update loop"); this.StateMachine.Mario.SetSpriteState(SpriteStates.Sprites.IDLE); this.StateMachine.Mario.game.RunAfterUpdate = this.StateMachine.Mario.game.Reset; } //else, mediaplayer remains stopped }); }
public void PlayIncorrectPlacementSound() { if (incorrectPlacementTone) { SoundFactory.PlayAnySFX(incorrectPlacementTone); } }
void PlayLevelCompleteSound() { if (playCompletionTone && completeTone != null) { SoundFactory.PlayAnySFX(completeTone); } }
private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { Logger.Log("Closing application"); FSUIPCConnection.Close(); SoundFactory.Dispose(); notifyIcon.Dispose(); }
public void CheckCondition() { IDoor.DoorState doorState = IDoor.DoorState.Open; foreach (IBlock block in RoomBlocks.Instance.ListRef) { if (!block.IsMoved()) { doorState = IDoor.DoorState.Closed; break; } } List <IDoor> doors = RoomDoors.Instance.ListRef as List <IDoor>; foreach (int doornum in conditionVariables) { doors[doornum].State = doorState; } if (doorState != prevState) { SoundFactory.PlaySound(SoundFactory.Instance.doorUnlock); } prevState = doorState; }
private void Initialize() { if (uoInstallationComboBox1.SelectedInstallation == null) { return; } if (_artFactory != null) { _artFactory.Dispose(); _artFactory = null; } if (_gumpFactory != null) { _gumpFactory.Dispose(); _gumpFactory = null; } if (_soundFactory != null) { _soundFactory.Dispose(); _soundFactory = null; } _gumpFactory = new GumpFactory(uoInstallationComboBox1.SelectedInstallation, _container); _artFactory = new ArtworkFactory(uoInstallationComboBox1.SelectedInstallation, _container); _soundFactory = new SoundFactory(uoInstallationComboBox1.SelectedInstallation, _container); artworkControl1.Factory = _artFactory; //artworkControl2.Factory = _artFactory; //gumpControl.Factory = _gumpFactory; //soundControl.Factory = _soundFactory; }
public void RevealItem() { if (this.item != null && this.SheetState != SpriteStates.Sheets.USED) { this.SetSpriteState(SpriteStates.Sprites.IDLE); if (!(this.item is SpriteCoin)) { SoundFactory.PlaySoundEffect(SoundFactory.PowerUpAppear()); } Thread t = new Thread(new ThreadStart( delegate() { this.item.Info.position = this.Info.position; this.itemCount--; (this.item as IRevealable).Reveal(); if (this.itemCount <= 0) { this.item = null; this.SetSheetState(SpriteStates.Sheets.USED); } Console.WriteLine("Reveal finished"); } )); t.IsBackground = true; t.Start(); } }
private void OnCollisionStay(Collision collision) { if (collision.gameObject.layer == LayerMask.NameToLayer("Hazard")) { List <SoundStruct> temporary_list = new List <SoundStruct>() { parameter_test }; SoundFactory.DeleteSound(ref temporary_list, "event:/enginetest"); Application.LoadLevel(Application.loadedLevel + 2); } else if (collision.gameObject.layer == LayerMask.NameToLayer("Goal")) { List <SoundStruct> temporary_list = new List <SoundStruct>() { parameter_test }; SoundFactory.DeleteSound(ref temporary_list, "event:/enginetest"); Application.LoadLevel(Application.loadedLevel + 1); } else if (collision.gameObject.layer == LayerMask.NameToLayer("Navigation")) { NavigationPath pathfinding = collision.gameObject.GetComponent <NavigationPath>(); if (pathfinding != null) { next_navigation = pathfinding; } } }
public PlayerSpaceInvaders(GameScreen i_GameScreen, string i_PlayerNickname, eSpaceShipType i_SpaceShipType) : base(i_GameScreen.Game, i_PlayerNickname) { m_LoseLifeSound = SoundFactory.CreateSound(this.Game, SoundFactory.eSoundType.LifeDie) as Sound; m_Nickname = i_PlayerNickname; m_SpaceShipType = i_SpaceShipType; m_ScoreText = SpritesFactory.CreateSprite(i_GameScreen, SpritesFactory.eSpriteType.SmallText) as Text; SpritesFactory.eSpriteType lifeType = SpritesFactory.eSpriteType.LifeBlueSpaceShip; switch (m_SpaceShipType) { case eSpaceShipType.Blue: m_SpaceShip = SpritesFactory.CreateSprite(i_GameScreen, SpritesFactory.eSpriteType.BlueSpaceShip) as SpaceShip; m_ScoreText.TintColor = Color.Blue; lifeType = SpritesFactory.eSpriteType.LifeBlueSpaceShip; break; case eSpaceShipType.Green: m_SpaceShip = SpritesFactory.CreateSprite(i_GameScreen, SpritesFactory.eSpriteType.GreenSpaceShip) as SpaceShip; m_ScoreText.TintColor = Color.Green; lifeType = SpritesFactory.eSpriteType.LifeGreenSpaceShip; break; } for (int i = 0; i < this.Lifes; i++) { Life life = SpritesFactory.CreateSprite(i_GameScreen, lifeType) as Life; life.Initialize(); this.LifesSprites.Add(life); } }
public override void Enter(StatePowerup previousState) { base.Enter(previousState); this.StateMachine.Mario.SetSheetState(SpriteStates.Sheets.SUPER); SoundFactory.PlaySoundEffect(SoundFactory.PowerUp()); }
public MotherShip(GameScreen i_GameScreen, string i_AssetName) : base(i_AssetName, i_GameScreen) { this.Points = m_PointsToBeEarned; this.Velocity = new Vector2(r_MotherShipVelocity, 0); m_SoundWhenKilled = SoundFactory.CreateSound(this.GameScreen, SoundFactory.eSoundType.MotherShipKill) as Sound; }
public void Interact() { switch (doorState) { case IDoor.DoorState.Open: connectedDoor.State = IDoor.DoorState.Open; game.RoomHandler.LoadNewRoom(game.RoomHandler.currentRoom + roomTranslationVector, connectedDoor); break; case IDoor.DoorState.Bombed: game.RoomHandler.LoadNewRoom(game.RoomHandler.currentRoom + roomTranslationVector, connectedDoor); break; case IDoor.DoorState.Closed: break; case IDoor.DoorState.Locked: if (InventoryManager.Instance.inventory[InventoryManager.ItemType.Key] > 0) { InventoryManager.Instance.inventory[InventoryManager.ItemType.Key]--; State = IDoor.DoorState.Open; connectedDoor.State = IDoor.DoorState.Open; SoundFactory.PlaySound(SoundFactory.Instance.doorUnlock); } break; case IDoor.DoorState.Wall: //do nothing break; default: //this should never happen break; } }
public void Attack() { if ((mode != LinkMode.Moving && mode != LinkMode.Still) || pauseMovement) { return; } mode = LinkMode.Attack; SoundFactory.PlaySound(SoundFactory.Instance.swordSlash); Vector2 startingPosition = getItemLocation(currDirection); linkInventory.CreateWeapon(startingPosition, currDirection); int minHealth = SettingsValues.Instance.GetValue(SettingsValues.Variable.MinProjectileSwordHealth); if (minHealth < 0) { minHealth += totalHealth + 1; } if (minHealth <= health) { linkInventory.CreateSwordProjectile(startingPosition, currDirection); } SetAttackAnimation(); }
public override void Enter(StateMario previousState) { base.Enter(previousState); this.StateMachine.Mario.SetSpriteState(SpriteStates.Sprites.JUMPING); this.StateMachine.Mario.Info.velocity.Y = -8.5f; SoundFactory.PlaySoundEffect(SoundFactory.Jump()); }
private void LoadFireballs() { //the direction the fireballs will travel Vector2 direction1; Vector2 direction2; Vector2 direction3; //all fireballs originate in the mouth Vector2 location; location.X = this.center.X; location.X -= MovementConstants.AquamentusFireballChangeX; if (aquamentusSprite.StartingFrameIndex == (int)AquamentusSprite.FrameIndex.RightFacing) { location.X += 2 * MovementConstants.AquamentusFireballChangeX; } location.Y = this.center.Y - 10; direction2 = player.Center - location; direction2.Normalize(); double angle2 = Math.Atan2(direction2.Y, direction2.X); double angle1 = angle2 + MovementConstants.AquamentusFireballSpreadAngle; double angle3 = angle2 - MovementConstants.AquamentusFireballSpreadAngle; direction1 = new Vector2((float)Math.Cos(angle1), (float)Math.Sin(angle1)); direction3 = new Vector2((float)Math.Cos(angle3), (float)Math.Sin(angle3)); ProjectileHandler projectileHandler = ProjectileHandler.Instance; projectileHandler.CreateFireballObject(spriteBatch, location, direction1); projectileHandler.CreateFireballObject(spriteBatch, location, direction2); projectileHandler.CreateFireballObject(spriteBatch, location, direction3); SoundFactory.PlaySound(SoundFactory.Instance.bossScream); }
public void CheckCondition() { IDoor.DoorState doorState = IDoor.DoorState.Open; if (RoomEnemies.Instance.ListRef.Count == 0) { List <ISpawner> spawners = RoomSpawners.Instance.ListRef as List <ISpawner>; foreach (ISpawner spawner in spawners) { if (spawner.CurrentCount > 0) { doorState = IDoor.DoorState.Closed; break; } } } else { doorState = IDoor.DoorState.Closed; } List <IDoor> doors = RoomDoors.Instance.ListRef as List <IDoor>; foreach (int doornum in conditionVariables) { doors[doornum].State = doorState; } if (doorState != prevState) { SoundFactory.PlaySound(SoundFactory.Instance.doorUnlock); } prevState = doorState; }
//Gets killed by fireball or shell public void Die() { SoundFactory.PlaySoundEffect(SoundFactory.Kick()); this.Info.spriteEffects = SpriteEffects.FlipVertically; this.Info.bounce = false; this.Info.manual = true; Thread t = new Thread(new ThreadStart(delegate() { this.Info.velocity.Y = -30; Thread.Sleep(200); this.Info.velocity.Y = -10; Thread.Sleep(50); this.Info.velocity.Y = 10; Thread.Sleep(50); this.Info.velocity.Y = 30; Thread.Sleep(200); this.Info.velocity.Y = 50; Thread.Sleep(1000); SpriteLayer.CollisionLayer.RemoveSprite(this); })); t.IsBackground = true; t.Start(); }
public void LandOnKoopa() { SoundFactory.PlaySoundEffect(SoundFactory.Kick()); if (this.SpriteState == SpriteStates.Sprites.JUMPING) { this.SetSheetState(SpriteStates.Sheets.NORMAL); this.SetSpriteState(SpriteStates.Sprites.WALKING); this.Move(); } else if (this.SpriteState == SpriteStates.Sprites.WALKING) { int walkingSpriteHeight = this.Info.spriteHeight; this.SetSpriteState(SpriteStates.Sprites.SHELLED); this.SetSheetState(SpriteStates.Sheets.SHELL); this.Info.velocity.X = 0; } else { if (this.Info.velocity.X < 3) { this.Info.velocity.X = 3; } else { this.Info.velocity.X = 0; } } }
public override void Update(GameTime gametime) { base.Update(gametime); if (this.game.Mario.lives == 0 && !this.Sprites.Contains(this.gameOver)) { SoundFactory.PlaySoundEffect(SoundFactory.GameOver()); this.AddSprite(this.gameOver); int dy = 250; this.gameOver.Info.bounds = new Rectangle(this.gameOver.Info.x - 2, this.gameOver.Info.y - dy, this.gameOver.Info.spriteWidth + 2, this.gameOver.Info.spriteHeight + dy); this.gameOver.SetPosition(this.gameOver.Info.x, this.gameOver.Info.y - dy); this.gameOver.Info.acceleration.Y = 0.15f; foreach (InputController ic in SpriteLayer.CollisionLayer.InputControllers) { ic.Paused = true; } } else if (this.game.Mario.lives > 0 && this.Sprites.Contains(this.gameOver)) { this.RemoveSprite(this.gameOver); foreach (InputController ic in SpriteLayer.CollisionLayer.InputControllers) { ic.Paused = false; } } }
private void Initialize() { if (uoInstallationComboBox1.SelectedInstallation == null) return; if (_artFactory != null) { _artFactory.Dispose(); _artFactory = null; } if(_gumpFactory != null){ _gumpFactory.Dispose(); _gumpFactory = null; } if (_soundFactory != null) { _soundFactory.Dispose(); _soundFactory = null; } _gumpFactory = new GumpFactory(uoInstallationComboBox1.SelectedInstallation, _container); _artFactory = new ArtworkFactory(uoInstallationComboBox1.SelectedInstallation, _container); _soundFactory = new SoundFactory(uoInstallationComboBox1.SelectedInstallation, _container); artworkControl1.Factory = _artFactory; artworkControl2.Factory = _artFactory; gumpControl.Factory = _gumpFactory; soundControl.Factory = _soundFactory; }
public void CheckCondition() { if (conditionVariables[3] == 0 && RoomEnemies.Instance.ListRef.Count == 0) { conditionVariables[3] = 1; Vector2 startPos = new Vector2(conditionVariables[0], conditionVariables[1]); switch (conditionVariables[2]) { case 0: ItemSpriteFactory.Instance.CreateKeyItem(startPos, true, false); SoundFactory.PlaySound(SoundFactory.Instance.keyAppear); break; case 1: ItemSpriteFactory.Instance.CreateBoomerangItem(startPos, true, false); break; case 2: ItemSpriteFactory.Instance.CreateHeartContainerItem(startPos, true, false); break; case 3: ItemSpriteFactory.Instance.CreateHeartItem(startPos, true, false); break; default: //this should never happen break; } } }
public OpenUOSDK(string path = "") { if (_ClientData == null && (path != "" || path != null)) { if (Directory.Exists(path)) { _ClientData = path; } } IoCContainer container = new IoCContainer(); container.RegisterModule <UltimaSDKCoreModule>(); container.RegisterModule <UltimaSDKBitmapModule>(); InstallLocation location = (_ClientData == null ? InstallationLocator.Locate().FirstOrDefault() : (InstallLocation)_ClientData); if (!Directory.Exists(location.ToString())) { Utility.PushColor(ConsoleColor.Red); Console.WriteLine("OpenUO Error: Client files not found."); Utility.PopColor(); } _animationDataFactory = new AnimationDataFactory(location, container); _animationFactory = new AnimationFactory(location, container); _artworkFactory = new ArtworkFactory(location, container); _asciiFontFactory = new ASCIIFontFactory(location, container); _clilocFactory = new ClilocFactory(location, container); _gumpFactory = new GumpFactory(location, container); _skillsFactory = new SkillsFactory(location, container); _soundFactory = new SoundFactory(location, container); _texmapFactory = new TexmapFactory(location, container); _unicodeFontFactory = new UnicodeFontFactory(location, container); }
/// <summary> /// Plays the sound that signals the start of a trial. /// </summary> internal void PlayStartSound() { if (startSoundPlayer != null) { SoundFactory.dimAllVolumes(true, startSoundPlayer); startSoundPlayer.Play(PlaybackCompleted); } }
/// <summary> /// Plays the sound that signals the beginning of a move to the starting location. /// </summary> internal void PlayMoveSound() { if (moveSoundPlayer != null) { SoundFactory.dimAllVolumes(true, moveSoundPlayer); moveSoundPlayer.Play(PlaybackCompleted); } }
/// <summary> /// Plays the sound that signals the end of a trial. /// </summary> internal void PlayEndSound() { if (endSoundPlayer != null) { SoundFactory.dimAllVolumes(true, endSoundPlayer); endSoundPlayer.Play(PlaybackCompleted); } }
/// <summary> /// Plays the sound that signals the end of a move to the direction of balance location. /// </summary> internal void PlayResetEndSound() { if (resetEndSoundPlayer != null) { SoundFactory.dimAllVolumes(true, resetEndSoundPlayer); resetEndSoundPlayer.Play(PlaybackCompleted); } }
public void TestSoundFactory() { SoundFactory factory = new SoundFactory(Install, Container); Sound sound = factory.GetSound <Sound>(1); Guard.AssertIsNotNull(sound, "Sound was not created."); sound.Play(); }
// Update is called once per frame void Update() { // Select repair items with mouse if (selected == '\0' && Input.GetMouseButtonDown(0)) { RaycastHit hit; Ray ray = main_camera.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit, 1000, 1 << LayerMask.NameToLayer("UI"))) { Transform objectHit = hit.transform; // Do something with the object that was hit by the raycast. SelectableRepairNode ui_element = objectHit.GetComponent <SelectableRepairNode>(); selected = ui_element.hotkey; mouse_selected = true; SoundFactory.AddSound("event:/menuselect", null, null); } } else if ((mouse_selected && Input.GetMouseButtonUp(0)) || (!mouse_selected && selected != '\0' && Input.GetMouseButtonDown(0))) { RaycastHit hit; Ray ray = main_camera.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit, 1000, 1 << LayerMask.NameToLayer("Build"))) { Transform objectHit = hit.transform; // Do something with the object that was hit by the raycast. ConstructionNode construction_site = objectHit.GetComponentInChildren <ConstructionNode>(); construction_site.construct(buildings[selected]); SoundFactory.AddSound("event:/menuselect", null, null); } selected = '\0'; mouse_selected = false; } KeyCode[] hotkeys = new KeyCode[] { KeyCode.Q, KeyCode.W, KeyCode.E, KeyCode.R }; // Select repair items with hotkeys (priority) foreach (KeyCode key in hotkeys) { if (Input.GetKeyDown(key)) { selected = (char)key; mouse_selected = false; SoundFactory.AddSound("event:/menuselect", null, null); } else if (Input.GetKeyUp(key) && (char)key == selected) { selected = '\0'; mouse_selected = false; } } }
public void TestSoundFactory() { SoundFactory factory = new SoundFactory(Install, Container); Sound sound = factory.GetSound<Sound>(1); Guard.AssertIsNotNull(sound, "Sound was not created."); sound.Play(); }
public void TestSoundFactory() { var factory = new SoundFactory(Install, Container); var sound = factory.GetSound<Sound>(1); Guard.RequireIsNotNull(sound, "Sound was not created."); sound.Play(); }
public override void ReceiveMushroom() { SoundFactory.PlaySoundEffect(SoundFactory.PowerUp()); if (this.PreviousState is StatePowerupNormal) { this.StateMachine.Mario.SetSheetState(SpriteStates.Sheets.STAR_SUPER); this.PreviousState = this.StateMachine.Super; } }
public void TestSoundFactory() { var factory = new SoundFactory(Install, Container); var sound = factory.GetSound <Sound>(1); Guard.RequireIsNotNull(sound, "Sound was not created."); sound.Play(); }
public Enemy(GameScreen i_GameScreen, Color i_EnemyColor, int i_TextureStartIndex, int i_TextureEndIndex, string i_AssetName) : base(i_GameScreen, i_AssetName) { m_TintColor = i_EnemyColor; this.isDying = false; m_SpriteJump = new SpriteJump(this); r_TextureStartIndex = i_TextureStartIndex; r_TextureEndIndex = i_TextureEndIndex; m_ShootSound = SoundFactory.CreateSound(this.GameScreen, SoundFactory.eSoundType.EnemyGunShot) as Sound; }
public OpenUOSDK(string path = "") { if (ClientDataPath == null && !String.IsNullOrWhiteSpace(path)) { if (Directory.Exists(path)) { ClientDataPath = path; } } Container container = new Container(); container.RegisterModule<UltimaSDKCoreModule>(); container.RegisterModule<UltimaSDKBitmapModule>(); InstallLocation location = (ClientDataPath == null ? InstallationLocator.Locate().FirstOrDefault() : (InstallLocation)ClientDataPath); if (location == null || String.IsNullOrWhiteSpace(location) || !Directory.Exists(location.ToString())) { Utility.PushColor(ConsoleColor.Red); Console.WriteLine("OpenUO Error: Client files not found."); Utility.PopColor(); } AnimationDataFactory = new AnimationDataFactory(location, container); AnimationFactory = new AnimationFactory(location, container); ArtFactory = new ArtworkFactory(location, container); AsciiFontFactory = new ASCIIFontFactory(location, container); ClilocFactory = new ClilocFactory(location, container); GumpFactory = new GumpFactory(location, container); SkillsFactory = new SkillsFactory(location, container); SoundFactory = new SoundFactory(location, container); TexmapFactory = new TexmapFactory(location, container); UnicodeFontFactory = new UnicodeFontFactory(location, container); }
public OpenUOSDK(string path = "") { if (_ClientData == null && (path != "" || path != null)) { if (Directory.Exists(path)) _ClientData = path; } IoCContainer container = new IoCContainer(); container.RegisterModule<UltimaSDKCoreModule>(); container.RegisterModule<UltimaSDKBitmapModule>(); InstallLocation location = (_ClientData == null ? InstallationLocator.Locate().FirstOrDefault() : (InstallLocation)_ClientData); if (!Directory.Exists(location.ToString())) { Utility.PushColor(ConsoleColor.Red); Console.WriteLine("OpenUO Error: Client files not found."); Utility.PopColor(); } _animationDataFactory = new AnimationDataFactory(location, container); _animationFactory = new AnimationFactory(location, container); _artworkFactory = new ArtworkFactory(location, container); _asciiFontFactory = new ASCIIFontFactory(location, container); _clilocFactory = new ClilocFactory(location, container); _gumpFactory = new GumpFactory(location, container); _skillsFactory = new SkillsFactory(location, container); _soundFactory = new SoundFactory(location, container); _texmapFactory = new TexmapFactory(location, container); _unicodeFontFactory = new UnicodeFontFactory(location, container); }