private void AddDestroySprite(LinkedList <Sprite> list, Vector2 positionInWorld, Asf image, SoundEffect sound) { if (image != null) { var sprite = new Sprite(positionInWorld, 0f, image); sprite.PlayFrames(sprite.FrameCountsPerDirection); list.AddLast(sprite); } SoundManager.Play3DSoundOnece(sound, positionInWorld - Globals.ListenerPosition); UseMagic(BelongMagic.ExplodeMagicFile); }
public void Destroy() { if (IsInDestroy) { return; } _isInDestroy = true; if (BelongMagic.MoveKind == 15) { Texture = null; _superModeDestroySprites = new LinkedList <Sprite>(); List <Character> targets; if (BelongCharacter.IsPlayer || BelongCharacter.IsFighterFriend) { targets = NpcManager.NpcsInView.Where(npc => npc.IsEnemy).Cast <Character>().ToList(); } else { targets = NpcManager.NpcsInView.Where(npc => npc.IsFighterFriend).Cast <Character>().ToList(); targets.Add(Globals.ThePlayer); } foreach (var character in targets) { AddDestroySprite(_superModeDestroySprites, character.PositionInWorld, BelongMagic.VanishImage, BelongMagic.VanishSound); CharacterHited(character); character.NotifyEnemyAndAllNeighbor(BelongCharacter); } if (_superModeDestroySprites.Count == 0) { _isDestroyed = true; } } else if (BelongMagic.MoveKind == 23) { //Time stop if (Globals.TheGame.TimeStoperMagicSprite == this) { Globals.TheGame.TimeStoperMagicSprite = null; } } else { switch (BelongMagic.MoveKind) { case 20: { BelongCharacter.IsInTransport = false; var tilePosition = MapBase.ToTilePosition(_destnationPixelPosition); var finded = PathFinder.FindNonobstacleNeighborOrItself(BelongCharacter, ref tilePosition); if (finded) { //Destination has no obstacle, transport magic user. TilePosition = tilePosition; BelongCharacter.SetTilePosition(tilePosition); } } break; case 21: { var player = BelongCharacter as Player; if (player == null) { throw new Exception("Magic kind 21 internal error."); } player.EndControlCharacter(); } break; case 22: { PositionInWorld = _summonedNpc.PositionInWorld; if (_summonedNpc != null) { _summonedNpc.Death(); } } break; } if (BelongMagic.VanishImage != null) { Texture = BelongMagic.VanishImage; PlayFrames(FrameCountsPerDirection); } else { if (_parasitiferCharacter == null) { _isDestroyed = true; } } if (_parasitiferCharacter != null) { PlayFrames(int.MaxValue); } SoundManager.Play3DSoundOnece(BelongMagic.VanishSound, PositionInWorld - Globals.ListenerPosition); UseMagic(BelongMagic.ExplodeMagicFile); if (BelongMagic.VibratingScreen > 0) { Globals.TheCarmera.VibaratingScreen(BelongMagic.VibratingScreen); } } }
protected override void PlaySoundEffect(SoundEffect soundEffect) { SoundManager.Play3DSoundOnece(soundEffect, PositionInWorld - Globals.ListenerPosition); }