#pragma warning restore 618 public void TestFixtureSetUp() { BossManager = MockRepository.GenerateStub <IBossManager>(); BulletManager = MockRepository.GenerateStub <IBulletManager>(); CollisionManager = MockRepository.GenerateStub <ICollisionManager>(); CommandManager = MockRepository.GenerateStub <ICommandManager>(); ConfigManager = MockRepository.GenerateStub <IConfigManager>(); ContentManager = MockRepository.GenerateStub <IContentManager>(); ControlManager = MockRepository.GenerateStub <IControlManager>(); DebugManager = MockRepository.GenerateStub <IDebugManager>(); DelayManager = MockRepository.GenerateStub <IDelayManager>(); DeviceManager = MockRepository.GenerateStub <IDeviceManager>(); EnemyManager = MockRepository.GenerateStub <IEnemyManager>(); EventManager = MockRepository.GenerateStub <IEventManager>(); ExplosionManager = MockRepository.GenerateStub <IExplosionManager>(); IconManager = MockRepository.GenerateStub <IIconManager>(); ImageManager = MockRepository.GenerateStub <IImageManager>(); InputManager = MockRepository.GenerateStub <IInputManager>(); LevelManager = MockRepository.GenerateStub <ILevelManager>(); MoverManager = MockRepository.GenerateStub <IMoverManager>(); RandomManager = MockRepository.GenerateStub <IRandomManager>(); RenderManager = MockRepository.GenerateStub <IRenderManager>(); ResolutionManager = MockRepository.GenerateStub <IResolutionManager>(); ScoreManager = MockRepository.GenerateStub <IScoreManager>(); ScreenManager = MockRepository.GenerateStub <IScreenManager>(); SoundManager = MockRepository.GenerateStub <ISoundManager>(); SpriteManager = MockRepository.GenerateStub <ISpriteManager>(); StateManager = MockRepository.GenerateStub <IStateManager>(); StopwatchManager = MockRepository.GenerateStub <IStopwatchManager>(); StorageManager = MockRepository.GenerateStub <IStorageManager>(); TextManager = MockRepository.GenerateStub <ITextManager>(); ThreadManager = MockRepository.GenerateStub <IThreadManager>(); FileManager = MockRepository.GenerateStub <IFileManager>(); Logger = MockRepository.GenerateStub <ILogger>(); }
public void Init() { _uiManager = GameClient.Get <IUIManager>(); _loadObjectsManager = GameClient.Get <ILoadObjectsManager>(); _dataManager = GameClient.Get <IDataManager>(); _gameplayManager = GameClient.Get <IGameplayManager>(); _soundManager = GameClient.Get <ISoundManager>(); _tutorialManager = GameClient.Get <ITutorialManager>(); _backendDataControlMediator = GameClient.Get <BackendDataControlMediator>(); _gameplayManager.GameInitialized += GameInitializedHandler; _gameplayManager.GameEnded += GameEndedHandler; _deckStatus = new List <CardZoneOnBoardStatus>(); _deckStatus.Add(new CardZoneOnBoardStatus(null, 0)); _deckStatus.Add(new CardZoneOnBoardStatus( _loadObjectsManager.GetObjectByPath <Sprite>("Images/BoardCardsStatuses/deck_single"), 15)); _deckStatus.Add(new CardZoneOnBoardStatus( _loadObjectsManager.GetObjectByPath <Sprite>("Images/BoardCardsStatuses/deck_couple"), 40)); _deckStatus.Add(new CardZoneOnBoardStatus( _loadObjectsManager.GetObjectByPath <Sprite>("Images/BoardCardsStatuses/deck_bunch"), 60)); _deckStatus.Add(new CardZoneOnBoardStatus( _loadObjectsManager.GetObjectByPath <Sprite>("Images/BoardCardsStatuses/deck_full"), 80)); _graveyardStatus = new List <CardZoneOnBoardStatus>(); _graveyardStatus.Add(new CardZoneOnBoardStatus(null, 0)); _graveyardStatus.Add(new CardZoneOnBoardStatus( _loadObjectsManager.GetObjectByPath <Sprite>("Images/BoardCardsStatuses/graveyard_single"), 10)); _graveyardStatus.Add(new CardZoneOnBoardStatus( _loadObjectsManager.GetObjectByPath <Sprite>("Images/BoardCardsStatuses/graveyard_couple"), 40)); _graveyardStatus.Add(new CardZoneOnBoardStatus( _loadObjectsManager.GetObjectByPath <Sprite>("Images/BoardCardsStatuses/graveyard_bunch"), 75)); _graveyardStatus.Add(new CardZoneOnBoardStatus( _loadObjectsManager.GetObjectByPath <Sprite>("Images/BoardCardsStatuses/graveyard_full"), 100)); }
#pragma warning restore 618 public void TestFixtureTearDown() { BossManager = null; BulletManager = null; CollisionManager = null; CommandManager = null; ConfigManager = null; ContentManager = null; ControlManager = null; DebugManager = null; DelayManager = null; DeviceManager = null; EnemyManager = null; EventManager = null; ExplosionManager = null; IconManager = null; ImageManager = null; InputManager = null; LevelManager = null; MoverManager = null; RandomManager = null; RenderManager = null; ResolutionManager = null; ScoreManager = null; ScreenManager = null; SoundManager = null; SpriteManager = null; StateManager = null; StopwatchManager = null; StorageManager = null; TextManager = null; ThreadManager = null; FileManager = null; Logger = null; }
protected ShooterEnemy(string i_AssetName, Rectangle i_SourceRectangle, GameScreen i_GameScreen) : base(i_AssetName, i_GameScreen) { r_SourceRectangle = i_SourceRectangle; r_CollisionsManager = this.Game.Services.GetService(typeof(ICollisionsManager)) as ICollisionsManager; r_SoundManager = this.Game.Services.GetService(typeof(SoundManager)) as ISoundManager; }
public void Init() { _gameplayManager = GameClient.Get <IGameplayManager>(); _timerManager = GameClient.Get <ITimerManager>(); _loadObjectsManager = GameClient.Get <ILoadObjectsManager>(); _dataManager = GameClient.Get <IDataManager>(); _soundManager = GameClient.Get <ISoundManager>(); _tutorialManager = GameClient.Get <ITutorialManager>(); _uiManager = GameClient.Get <IUIManager>(); _battlegroundController = _gameplayManager.GetController <BattlegroundController>(); _vfxController = _gameplayManager.GetController <VfxController>(); _abilitiesController = _gameplayManager.GetController <AbilitiesController>(); _actionsQueueController = _gameplayManager.GetController <ActionsQueueController>(); _animationsController = _gameplayManager.GetController <AnimationsController>(); _ranksController = _gameplayManager.GetController <RanksController>(); CreatureCardViewPrefab = _loadObjectsManager.GetObjectByPath <GameObject>("Prefabs/Gameplay/Cards/CreatureCard"); SpellCardViewPrefab = _loadObjectsManager.GetObjectByPath <GameObject>("Prefabs/Gameplay/Cards/SpellCard"); OpponentCardPrefab = _loadObjectsManager.GetObjectByPath <GameObject>("Prefabs/Gameplay/Cards/OpponentCard"); _gameplayManager.GameStarted += GameStartedHandler; _gameplayManager.GameEnded += GameEndedHandler; _indexOfCard = -1; }
public Missile( ISoundManager soundManager, World world, Collection<IDoodad> doodads, int numberOfBounces, Team team, Vector2 position, float rotation, DoodadFactory doodadFactory) { this.soundManager = soundManager; this.doodadFactory = doodadFactory; this.world = world; this.doodads = doodads; this.numberOfBounces = numberOfBounces; this.body = BodyFactory.CreateBody(world, position, this); this.body.BodyType = BodyType.Dynamic; this.body.FixedRotation = true; CircleShape shape = new CircleShape(5 / Constants.PixelsPerMeter, 0.1f); Fixture fixture = body.CreateFixture(shape); fixture.Restitution = 1; fixture.Friction = 0; fixture.CollisionCategories = PhysicsConstants.MissileCategory; fixture.CollidesWith = PhysicsConstants.EnemyCategory | PhysicsConstants.PlayerCategory | PhysicsConstants.ObstacleCategory | PhysicsConstants.MissileCategory | PhysicsConstants.SensorCategory; obstacleCollisionCtr = 0; Vector2 force = new Vector2((float)Math.Cos(rotation), (float)Math.Sin(rotation)) * 3; this.body.ApplyForce(force); }
public TimerDefaultSettingsForm(WurmTimer wurmTimer, [NotNull] ISoundManager soundManager) { if (soundManager == null) { throw new ArgumentNullException("soundManager"); } parentTimer = wurmTimer; this.soundManager = soundManager; InitializeComponent(); if (wurmTimer.MoreOptionsAvailable) { buttonMoreOptions.Visible = true; } this.Text = wurmTimer.Name; //set all options values this.checkBoxPopup.Checked = parentTimer.PopupNotify; this.checkBoxSound.Checked = parentTimer.SoundNotify; this.checkBoxPopupPersistent.Checked = parentTimer.PersistentPopup; this.textBoxSoundName.Text = soundManager.GetSoundById(parentTimer.SoundId).Name; this.checkBoxOnAssistantLaunch.Checked = parentTimer.PopupOnWaLaunch; int popupDurationMillis = parentTimer.PopupDurationMillis; this.numericUpDownPopupDuration.Value = (popupDurationMillis / 1000).ConstrainToRange((int)numericUpDownPopupDuration.Minimum, (int)numericUpDownPopupDuration.Maximum); isInited = true; }
public IEnumerator SetDelayTest() { // Arrange ISoundManager manager = GetManager(); float delay = 0.2f; // Act var command = manager.GetSlot(SoundDataKey.sound1.ToString()) .SetDelayResource(delay) .PlayResource(); Assert.IsFalse(command.IsPlayingResource()); float waitSeconds = 0f; while (waitSeconds < delay) { waitSeconds += Time.deltaTime; yield return(null); } yield return(null); // Act & Assert Stop Assert.IsTrue(command.IsPlayingResource()); command.Stop(); Assert.IsFalse(command.IsPlayingResource()); }
public SoundManagerForm([NotNull] ISoundManager soundManager, [NotNull] ISoundsLibrary soundsLibrary, IProcessStarter processStarter) { if (soundManager == null) { throw new ArgumentNullException("soundManager"); } if (soundsLibrary == null) { throw new ArgumentNullException("soundsLibrary"); } if (processStarter == null) { throw new ArgumentNullException("processStarter"); } this.soundManager = soundManager; this.soundsLibrary = soundsLibrary; this.processStarter = processStarter; InitializeComponent(); trackBarAdjustedVolume.Enabled = false; RefreshSoundsList(); soundsLibrary.SoundsChanged += SoundsLibraryOnSoundsChanged; this.Closed += (sender, args) => soundsLibrary.SoundsChanged -= SoundsLibraryOnSoundsChanged; }
protected Tank( ISoundManager soundManager, World world, Collection<IDoodad> doodads, Team team, Vector2 position, float rotation, DoodadFactory doodadFactory) { this.soundManager = soundManager; this.world = world; this.doodadFactory = doodadFactory; this.doodads = doodads; this.body = BodyFactory.CreateBody(world, position, this); this.body.Rotation = rotation; this.body.BodyType = BodyType.Dynamic; this.Team = team; this.Heading = rotation; this.activeMissiles = new List<Missile>(); this.powerup = PowerUpType.None; var shape = new PolygonShape(0); shape.SetAsBox(15 / Constants.PixelsPerMeter, 15 / Constants.PixelsPerMeter); var fixture = this.body.CreateFixture(shape); fixture.CollisionCategories = this.CollisionCategory; fixture.CollidesWith = PhysicsConstants.MissileCategory; if (this is PlayerControlledTank) { fixture.CollidesWith |= PhysicsConstants.ObstacleCategory | PhysicsConstants.PitCategory | PhysicsConstants.SensorCategory; } }
public AbilityBase(Enumerators.CardKind cardKind, AbilityData ability) { LoadObjectsManager = GameClient.Get <ILoadObjectsManager>(); GameplayManager = GameClient.Get <IGameplayManager>(); DataManager = GameClient.Get <IDataManager>(); TimerManager = GameClient.Get <ITimerManager>(); SoundManager = GameClient.Get <ISoundManager>(); AbilitiesController = GameplayManager.GetController <AbilitiesController>(); ParticlesController = GameplayManager.GetController <ParticlesController>(); BattleController = GameplayManager.GetController <BattleController>(); ActionsQueueController = GameplayManager.GetController <ActionsQueueController>(); BattlegroundController = GameplayManager.GetController <BattlegroundController>(); CardsController = GameplayManager.GetController <CardsController>(); AbilityData = ability; CardKind = cardKind; AbilityActivityType = ability.AbilityActivityType; AbilityCallType = ability.AbilityCallType; AbilityTargetTypes = ability.AbilityTargetTypes; AbilityEffectType = ability.AbilityEffectType; _playerAvatar = GameplayManager.CurrentPlayer; _opponenentAvatar = GameplayManager.OpponentPlayer; PermanentInputEndEvent += InputEndedHandler; ParticleIds = new List <ulong>(); }
public ComputerControlledTank( ISoundManager soundManager, World world, Collection<IDoodad> doodads, Team team, Vector2 position, float rotation, Random random, DoodadFactory doodadFactory, IEnumerable<Waypoint> waypoints) : base(soundManager, world, doodads, team, position, rotation, doodadFactory) { this.world = world; this.random = random; this.states = new Dictionary<Type, ITankState>(); this.states.Add(typeof(MovingState), new MovingState(world, this.Body, this, waypoints, random)); this.states.Add(typeof(AttackingState), new AttackingState(world, this.Body, this)); this.states.Add(typeof(TurningState), new TurningState(this.Body, this)); this.currentState = this.states[typeof(MovingState)]; this.currentState.StateChanged += this.OnStateChanged; this.currentState.NavigateTo(); this.sensor = BodyFactory.CreateBody(world, this.Position); var shape = new CircleShape(6, 0); Fixture sensorFixture = this.sensor.CreateFixture(shape); sensorFixture.Friction = 1f; sensorFixture.IsSensor = true; sensorFixture.CollisionCategories = PhysicsConstants.SensorCategory; sensorFixture.CollidesWith = PhysicsConstants.PlayerCategory | PhysicsConstants.ObstacleCategory | PhysicsConstants.MissileCategory; }
/// <summary> /// 游戏框架组件初始化。 /// </summary> public SoundComponent() { m_SoundManager = GameFrameworkEntry.GetModule <ISoundManager>(); if (m_SoundManager == null) { Log.Fatal("Sound manager is invalid."); return; } m_SoundManager.PlaySoundSuccess += OnPlaySoundSuccess; m_SoundManager.PlaySoundFailure += OnPlaySoundFailure; m_SoundManager.PlaySoundUpdate += OnPlaySoundUpdate; m_SoundManager.PlaySoundDependencyAsset += OnPlaySoundDependencyAsset; // m_AudioListener = gameObject.GetOrAddComponent<AudioListener>(); m_AudioListener = new GameObject("AudioListener").GetOrAddComponent <AudioListener>(); SceneManager.sceneLoaded += OnSceneLoaded; SceneManager.sceneUnloaded += OnSceneUnloaded; ISceneManager sceneManager = GameFrameworkEntry.GetModule <ISceneManager>(); if (sceneManager == null) { Log.Fatal("Scene manager is invalid."); return; } sceneManager.LoadSceneSuccess += OnLoadSceneSuccess; sceneManager.LoadSceneFailure += OnLoadSceneFailure; sceneManager.UnloadSceneSuccess += OnUnloadSceneSuccess; sceneManager.UnloadSceneFailure += OnUnloadSceneFailure; }
public CooldownHandler([NotNull] ILogger logger, [NotNull] ISoundManager soundManager, [NotNull] ITrayPopups trayPopups, Guid?soundId = null, string messageTitle = null, string messageContent = null, bool messagePersist = false) { if (logger == null) { throw new ArgumentNullException("logger"); } if (soundManager == null) { throw new ArgumentNullException("soundManager"); } if (trayPopups == null) { throw new ArgumentNullException("trayPopups"); } handler = new NotifyHandler(logger, soundManager, trayPopups) { SoundId = (soundId ?? Guid.Empty), Title = (messageTitle ?? string.Empty), Message = (messageContent ?? string.Empty) }; if (messagePersist) { handler.PopupPersistent = true; } }
public BuildingBoardState(Game game) : base(game) { game.Services.AddService(typeof(IBuildingBoardState), this); scrollingBackgroundManager = new ScrollingBackgroundManager(game, "Textures\\"); game.Components.Add(scrollingBackgroundManager); scrollingBackgroundManager.ScrollRate = -1f; celAnimationManager = (ICelAnimationManager)game.Services.GetService(typeof(ICelAnimationManager)); startMenuState = (StartMenuState)game.Services.GetService(typeof(IStartMenuState)); allHidenPoints = SetHidenTiles(); // set all the allHidenPoints player = new Player(game) { myTurn = true }; enemy = new Player(game); player.pawns = new Pawn[player.army_size]; enemy.pawns = new Pawn[player.army_size]; remainShapesToPutOnBigEmptyBoard = 5; // set the number of shapes we exepted on board as 5 soundEffect = (ISoundManager)game.Services.GetService(typeof(ISoundManager)); isPlayBadPlaceSoundEffect = true; // for the algorithm about activate the badPlace sound // we dont see any shape: dragingShape = null; hideShape = true; }
public BaseExerciseController(IExerciseModel exerciseModel, IExerciseView exerciseView, IExerciseBackgroundView exerciseBackgroundView, IExerciseHUD hud, ITimerFactory timerFactory, IExerciseTerminator terminator, ILogger logger, ISoundManager soundManager) : base(logger, terminator, exerciseView) { _soundManager = soundManager; _model = exerciseModel; _backgroundView = exerciseBackgroundView; _hud = hud; _timeoutTimer = timerFactory.CreateTimer(); _exerciseTimer = timerFactory.CreateTimer(); _botTimer = timerFactory.CreateTimer(); _botTimer.OnComplete += ProcessBotAnswer; _tutorialManager = new TutorialManager(_model, _view, _model.ExerciseConfiguration); _tutorialManager.OnUpdate += OnTutorialUpdate; _tutorialActivityManager = new TutorialActivityManager(logger, 3, 2, exerciseModel.ExerciseInitVO.StartWithTutorial, exerciseModel.ExerciseInitVO.TutorialSystemEnabled); var exerciseSettings = _model.ExerciseSettings; _view.Settings = exerciseSettings; _soundManager.Mute = exerciseSettings.ContainsKey(ExerciseSettingsEnum.SoundsEnabled) && !exerciseSettings[ExerciseSettingsEnum.SoundsEnabled]; MapState(BaseStates.INIT, OnStateInit, AfterStateInit); _botActived = false; _stopped = false; }
public BoardUnit(Transform parent) { _gameplayManager = GameClient.Get <IGameplayManager>(); _loadObjectsManager = GameClient.Get <ILoadObjectsManager>(); _soundManager = GameClient.Get <ISoundManager>(); _tutorialManager = GameClient.Get <ITutorialManager>(); _timerManager = GameClient.Get <ITimerManager>(); _battlegroundController = _gameplayManager.GetController <BattlegroundController>(); _playerController = _gameplayManager.GetController <PlayerController>(); _animationsController = _gameplayManager.GetController <AnimationsController>(); _battleController = _gameplayManager.GetController <BattleController>(); _actionsQueueController = _gameplayManager.GetController <ActionsQueueController>(); _vfxController = _gameplayManager.GetController <VfxController>(); _ranksController = _gameplayManager.GetController <RanksController>(); _abilitiesController = _gameplayManager.GetController <AbilitiesController>(); _cardsController = _gameplayManager.GetController <CardsController>(); _inputController = _gameplayManager.GetController <InputController>(); _boardArrowController = _gameplayManager.GetController <BoardArrowController>(); GameObject = Object.Instantiate(_loadObjectsManager.GetObjectByPath <GameObject>("Prefabs/Gameplay/BoardCreature")); GameObject.transform.SetParent(parent, false); _fightTargetingArrowPrefab = _loadObjectsManager.GetObjectByPath <GameObject>("Prefabs/Gameplay/Arrow/AttackArrowVFX_Object"); _pictureSprite = GameObject.transform.Find("CreaturePicture").GetComponent <SpriteRenderer>(); _frozenSprite = GameObject.transform.Find("Other/Frozen").GetComponent <SpriteRenderer>(); _glowSprite = GameObject.transform.Find("Other/Glow").GetComponent <SpriteRenderer>(); _shieldSprite = GameObject.transform.Find("Other/Shield").gameObject; _glowSelectedObjectSprite = GameObject.transform.Find("Other/GlowSelectedObject").gameObject; _attackText = GameObject.transform.Find("Other/AttackAndDefence/AttackText").GetComponent <TextMeshPro>(); _healthText = GameObject.transform.Find("Other/AttackAndDefence/DefenceText").GetComponent <TextMeshPro>(); _sleepingParticles = GameObject.transform.Find("Other/SleepingParticles").GetComponent <ParticleSystem>(); _unitContentObject = GameObject.transform.Find("Other").gameObject; _unitContentObject.SetActive(false); _inputController.UnitSelectedEvent += UnitSelectedEventHandler; _inputController.UnitDeselectedEvent += UnitDeselectedEventHandler; BuffsOnUnit = new List <Enumerators.BuffType>(); AttackedBoardObjectsThisTurn = new List <object>(); _glowSprite.gameObject.SetActive(true); _glowSprite.enabled = false; IsCreatedThisTurn = true; UnitStatus = Enumerators.UnitStatusType.NONE; IsAllAbilitiesResolvedAtStart = true; _gameplayManager.CanDoDragActions = false; }
/// <summary> /// 游戏框架组件初始化。 /// </summary> protected override void Awake() { base.Awake(); m_SoundManager = GameFrameworkEntry.GetModule <ISoundManager>(); if (m_SoundManager == null) { Log.Fatal("Sound manager is invalid."); return; } m_SoundManager.PlaySoundSuccess += OnPlaySoundSuccess; m_SoundManager.PlaySoundFailure += OnPlaySoundFailure; m_SoundManager.PlaySoundUpdate += OnPlaySoundUpdate; m_SoundManager.PlaySoundDependencyAsset += OnPlaySoundDependencyAsset; m_AudioListener = gameObject.GetOrAddComponent <AudioListener>(); #if UNITY_5_4_OR_NEWER SceneManager.sceneLoaded += OnSceneLoaded; SceneManager.sceneUnloaded += OnSceneUnloaded; #else ISceneManager sceneManager = GameFrameworkEntry.GetModule <ISceneManager>(); if (sceneManager == null) { Log.Fatal("Scene manager is invalid."); return; } sceneManager.LoadSceneSuccess += OnLoadSceneSuccess; sceneManager.LoadSceneFailure += OnLoadSceneFailure; sceneManager.UnloadSceneSuccess += OnUnloadSceneSuccess; sceneManager.UnloadSceneFailure += OnUnloadSceneFailure; #endif }
public void Construct(IPlayer player, ICowArea area, GameData gameData, ISoundManager soundManager) { _player = player; _area = area; _gameData = gameData; _soundManager = soundManager; }
protected override void OnInitElement() { soundManager = (ISoundManager)GameManager.GetManager("SoundManager"); ButtonText = transform.Find("Text").gameObject.GetComponent <Text>(); UISmallButtonNoText = transform.Find("UISmallButtonNo/Text").gameObject.GetComponent <Text>(); UISmallButtonYesText = transform.Find("UISmallButtonYes/Text").gameObject.GetComponent <Text>(); UISmallButtonNo = transform.Find("UISmallButtonNo").gameObject.GetComponent <Button>(); UISmallButtonYes = transform.Find("UISmallButtonYes").gameObject.GetComponent <Button>(); UISmallButtonNoImage = transform.Find("UISmallButtonNo").gameObject.GetComponent <Image>(); UISmallButtonYesImage = transform.Find("UISmallButtonYes").gameObject.GetComponent <Image>(); UISmallButtonNoImage.sprite = _Checked ? normalSprite : selectedSprite; UISmallButtonYesImage.sprite = _Checked ? selectedSprite : normalSprite; clickEventHandler = new GameHandlerList(); checkChangedEventHandler = new GameHandlerList(); UISmallButtonNo.onClick.AddListener(() => { Checked = false; OnClick(gameObject); }); UISmallButtonYes.onClick.AddListener(() => { Checked = true; OnClick(gameObject); }); EventTriggerListener eventTriggerListener = EventTriggerListener.Get(gameObject); eventTriggerListener.onClick = OnClick; base.OnInitElement(); }
public void SetMute() { // Arrange ISoundManager manager = GetManager(); float localVolume = Random.Range(0.1f, 1f); string soundKey = SoundDataKey.sound1.ToString(); float calculateVolume = localVolume * manager.GetGlobalVolume(); var command = manager.GetSlot(soundKey) .PlayResource() .SetLocalVolume(localVolume); // Act & Assert MuteAll true manager.SetMuteAll(true); Assert.AreEqual(command.GetCurrentVolume(), 0f); // Act & Assert MuteAll false manager.SetMuteAll(false); Assert.AreEqual(command.GetCurrentVolume(), calculateVolume); // Act & Assert MuteBy soundKey true manager.SetMuteBySoundKey(soundKey, true); Assert.AreEqual(command.GetCurrentVolume(), 0f); // Act & Assert MuteBy soundKey false manager.SetMuteBySoundKey(soundKey, false); Assert.AreEqual(command.GetCurrentVolume(), calculateVolume); // Act & Assert MuteBy soundCategory true manager.SetMuteBySoundCategory(string.Empty, true); Assert.AreEqual(command.GetCurrentVolume(), 0f); // Act & Assert MuteBy soundCategory false manager.SetMuteBySoundCategory(string.Empty, false); Assert.AreEqual(command.GetCurrentVolume(), calculateVolume); }
/// <summary> /// 游戏框架组件初始化。 /// </summary> protected internal override void Awake() { base.Awake(); m_SoundManager = GameFrameworkEntry.GetModule <ISoundManager>(); if (m_SoundManager == null) { Log.Fatal("Sound manager is invalid."); return; } m_SoundManager.PlaySoundSuccess += OnPlaySoundSuccess; m_SoundManager.PlaySoundFailure += OnPlaySoundFailure; m_SoundManager.PlaySoundUpdate += OnPlaySoundUpdate; m_SoundManager.PlaySoundDependencyAsset += OnPlaySoundDependencyAsset; m_SceneManager = GameFrameworkEntry.GetModule <ISceneManager>(); if (m_SceneManager == null) { Log.Fatal("Scene manager is invalid."); return; } m_SceneManager.LoadSceneSuccess += OnLoadSceneSuccess; m_SceneManager.LoadSceneFailure += OnLoadSceneFailure; m_SceneManager.UnloadSceneSuccess += OnUnloadSceneSuccess; m_SceneManager.UnloadSceneFailure += OnUnloadSceneFailure; }
public WurmTimer( string persistentObjectId, [NotNull] ITrayPopups trayPopups, [NotNull] ILogger logger, [NotNull] IWurmApi wurmApi, [NotNull] ISoundManager soundManager, [NotNull] ITelemetry telemetry) : base(persistentObjectId) { Id = Guid.Parse(persistentObjectId); if (trayPopups == null) { throw new ArgumentNullException("trayPopups"); } if (logger == null) { throw new ArgumentNullException("logger"); } if (wurmApi == null) { throw new ArgumentNullException("wurmApi"); } if (soundManager == null) { throw new ArgumentNullException("soundManager"); } this.TrayPopups = trayPopups; this.Logger = logger; this.WurmApi = wurmApi; this.SoundManager = soundManager; this.telemetry = telemetry ?? throw new ArgumentNullException(nameof(telemetry)); }
public void Init() { _loadObjectsManager = GameClient.Get <ILoadObjectsManager>(); _uiManager = GameClient.Get <IUIManager>(); _gameplayManager = GameClient.Get <IGameplayManager>(); _timerManager = GameClient.Get <ITimerManager>(); _soundManager = GameClient.Get <ISoundManager>(); }
protected override void LoadContent() { base.LoadContent(); ISoundManager soundManager = Game.Services.GetService(typeof(ISoundManager)) as ISoundManager; soundManager.AddSoundEffect(k_MenuMoveSoundAsset); }
// Start is called before the first frame update void Start() { sound = SoundManager.Instance; CasingSource = GetComponent <AudioSource>(); GetComponent <Rigidbody>().AddRelativeForce(ForceVector * ForceSpeed); transform.rotation = Random.rotation; Destroy(gameObject, DestroyTime); }
public static SoundEmitter Emit(this SoundEffect soundEffect) { if (SoundEffectExtensions.SoundManager == null) { SoundEffectExtensions.SoundManager = ServiceHelper.Get <ISoundManager>(); } return(SoundEffectExtensions.SoundManager.AddEmitter(new SoundEmitter(soundEffect, false, 0.0f, 1f, false, new Vector3?()))); }
public static SoundEmitter EmitAt(this SoundEffect soundEffect, Vector3 position, float pitch) { if (SoundEffectExtensions.SoundManager == null) { SoundEffectExtensions.SoundManager = ServiceHelper.Get <ISoundManager>(); } return(SoundEffectExtensions.SoundManager.AddEmitter(new SoundEmitter(soundEffect, false, pitch, 1f, false, new Vector3?(position)))); }
public SoundManagerFeature([NotNull] ISoundManager soundManager) { if (soundManager == null) { throw new ArgumentNullException(nameof(soundManager)); } this.soundManager = soundManager; }
public static SoundEmitter EmitAt(this SoundEffect soundEffect, Vector3 position, bool loop, float pitch, float volume, bool paused) { if (SoundEffectExtensions.SoundManager == null) { SoundEffectExtensions.SoundManager = ServiceHelper.Get <ISoundManager>(); } return(SoundEffectExtensions.SoundManager.AddEmitter(new SoundEmitter(soundEffect, loop, pitch, volume, paused, new Vector3?(position)))); }
public DoodadFactory(World world, Collection<IDoodad> doodads, Random random, Collection<Waypoint> waypoints, ISoundManager soundManager) { this.world = world; this.soundManager = soundManager; this.waypoints = waypoints; this.random = random; this.doodads = doodads; }
public static SoundEmitter Emit(this SoundEffect soundEffect, float pitch, bool paused) { if (SoundEffectExtensions.SoundManager == null) { SoundEffectExtensions.SoundManager = ServiceHelper.Get <ISoundManager>(); } return(SoundEffectExtensions.SoundManager.AddEmitter(new SoundEmitter(soundEffect, false, pitch, 1f, paused, new Vector3?()))); }
public Barrier(Game i_Game, Color i_TintColor) : base(i_Game, k_AssetName) { m_SoundManager = this.Game.Services.GetService(typeof(ISoundManager)) as ISoundManager; this.Direction = new Vector2(1, 0); this.TintColor = i_TintColor; calculateVelocityPerLevel(); }
public static SoundEmitter Emit(this SoundEffect soundEffect, bool loop, float pitch, float volume) { if (SoundEffectExtensions.SoundManager == null) { SoundEffectExtensions.SoundManager = ServiceHelper.Get <ISoundManager>(); } return(SoundEffectExtensions.SoundManager.AddEmitter(new SoundEmitter(soundEffect, loop, pitch, volume, false, new Vector3?()))); }
public SoundManagerView(ISoundManager soundManager, Random random) { this.sounds = new Dictionary<string, List<SoundEffectInstance>>(); this.soundManager = soundManager; this.soundManager.SoundPlayed += this.OnSoundPlayed; this.soundManager.MusicStarted += this.OnMusicStarted; this.soundManager.MusicStopped += this.OnMusicStopped; this.random = random; }
AudioManager(IContentManager contentManager) { // Create the music and sound managers _soundManager = CreateSoundManager(contentManager); if (_soundManager == null) throw new AudioException("SoundManager is somehow null."); _musicManager = CreateMusicManager(contentManager); if (_soundManager == null) throw new AudioException("MusicManager is somehow null."); }
public SpaceInvadersGame() { Content.RootDirectory = "Content"; r_GraphicsMgr = new GraphicsDeviceManager(this); r_InputManager = new InputManager(this); r_SoundManager = new SoundManager(this); r_FontManager = new FontManager(this, @"Fonts\Arial"); r_SettingsManager = new SettingsManager(this); r_CollisionsManager = new CollisionsManager(this); r_ScreensMananger = new ScreensMananger(this); r_ScreensMananger.SetCurrentScreen(new WelcomeScreen(this)); }
public ButtonView( IInputManager inputManager, string textureName, Vector2 position, ISoundManager soundManager) { this.inputManager = inputManager; this.textureName = textureName; this.position = position; this.soundManager = soundManager; this.scaleTween = TweenFactory.Tween(1, 0.9f, TimeSpan.FromSeconds(.1)); this.scaleTween.IsPaused = true; }
public Game(IInput input, IOutput output, ISoundManager soundManager, Stream defaultsStream, Stream audioStream, Stream commandsStream, Stream storyStepsStream) { Input = input; Input.OnTextReceived += InputOnOnTextReceived; Output = output; SoundManager = soundManager; DefaultsContainer = new ConfigurationContainer<Defaults>(defaultsStream); DefaultsContainer.ReadFromStream(); AudioListContainer = new ConfigurationListContainer<Sound>(audioStream); AudioListContainer.ReadFromStream(); CommandListContainer = new ConfigurationListContainer<Command>(commandsStream); CommandListContainer.ReadFromStream(); DefaultCommands = CommandListContainer.Get(c => c.IsDefault); StoryStepListContainer = new ConfigurationListContainer<StoryStep>(storyStepsStream); StoryStepListContainer.ReadFromStream(); }
public PlayerControlledTank( ISoundManager soundManager, DoodadFactory doodadFactory, World world, Collection<IDoodad> doodads, Team team, Random random, Vector2 position, float rotation) : base(soundManager, world, doodads, team, position, rotation, doodadFactory) { this.random = random; this.FireMissileCommand = new RelayCommand<Vector2>(this.FireMissile, this.CanFireMissile); this.PointTurretCommand = new RelayCommand<Vector2>(this.PointTurret); speed = DEFAULT_SPEED; powerUpTime = DateTime.Now; }
public PlayingView( SpriteBatch spriteBatch, ContentManager content, IInputManager inputManager, PlayingViewModel viewModel, ISoundManager soundManager) { this.spriteBatch = spriteBatch; this.content = content; this.viewModel = viewModel; this.doodadViews = new List<DoodadView>(); this.rotateClockwiseButton = new ButtonView( inputManager, "Images/Playing/RotateClockwise", new Vector2(Constants.ScreenWidth - 127, 428), soundManager); this.rotateClockwiseButton.Command = new RelayCommand(() => this.viewModel.Rotate(true)); this.rotateCounterClockwiseButton = new ButtonView( inputManager, "Images/Playing/RotateCounterClockwise", new Vector2(127, 428), soundManager); this.rotateCounterClockwiseButton.Command = new RelayCommand(() => this.viewModel.Rotate(false)); this.translateOutTween = TweenFactory.Tween(0, Constants.ScreenHeight, TimeSpan.FromSeconds(0.75f)); this.translateOutTween.IsPaused = true; this.translateInTween = TweenFactory.Tween(Constants.ScreenHeight, 0, TimeSpan.FromSeconds(0.75f)); this.translateInTween.IsPaused = true; this.textTween = TweenFactory.Tween(0, 1, TimeSpan.FromSeconds(0.3f)); this.textTween.Reverse(); this.textTween.IsPaused = true; this.spottedZebraButton = new ButtonView( inputManager, "Images/Playing/SpottedZebraLogo", new Vector2(Constants.ScreenWidth - 78, 36), soundManager); this.spottedZebraButton.Command = this.viewModel.OpenCompanyUrlCommand; }
protected override void Initialize() { base.Initialize(); Bootstrapper bootstrapper = new Bootstrapper(this.Content, this.spriteBatch); this.conductorView = bootstrapper.GetInstance<ConductorView>(); this.inputManager = bootstrapper.GetInstance<MouseInputManager>(); this.sessionManager = bootstrapper.GetInstance<SessionManager>(); this.sessionManager.ReadSession(); this.soundManager = bootstrapper.GetInstance<ISoundManager>(); this.soundManagerView = bootstrapper.GetInstance<SoundManagerView>(); this.soundManagerView.LoadContent(this.Content); this.soundManagerView.Activate(); this.soundManager.PlayMusic(); IConductorViewModel conductorViewModel = bootstrapper.GetInstance<IConductorViewModel>(); conductorViewModel.Push(typeof(PlayingViewModel)); }
public PowerUp( ISoundManager soundManager, World world, Random random, Collection<IDoodad> doodads, Vector2 position, DoodadFactory doodadFactory) { this.soundManager = soundManager; this.doodadFactory = doodadFactory; this.world = world; this.doodads = doodads; this.body = BodyFactory.CreateBody(world, position, this); this.body.BodyType = BodyType.Dynamic; this.body.FixedRotation = true; PowerUpType powerUpType = PowerUpType.None; switch (random.Next(3)) { case 0: powerUpType = PowerUpType.Speed; break; case 1: powerUpType = PowerUpType.UnlimitedAmmo; break; case 2: powerUpType = PowerUpType.ExtraBounce; break; } this.powerUp = powerUpType; CircleShape shape = new CircleShape(5 / Constants.PixelsPerMeter, 0.1f); Fixture fixture = body.CreateFixture(shape); fixture.IsSensor = true; fixture.CollisionCategories = PhysicsConstants.SensorCategory; fixture.CollidesWith = PhysicsConstants.PlayerCategory; }
public static SoundEmitter EmitAt(this SoundEffect soundEffect, Vector3 position, bool loop, float pitch, float volume) { if (SoundEffectExtensions.SoundManager == null) SoundEffectExtensions.SoundManager = ServiceHelper.Get<ISoundManager>(); return SoundEffectExtensions.SoundManager.AddEmitter(new SoundEmitter(soundEffect, loop, pitch, volume, false, new Vector3?(position))); }
public static SoundEmitter Emit(this SoundEffect soundEffect, float pitch) { if (SoundEffectExtensions.SoundManager == null) SoundEffectExtensions.SoundManager = ServiceHelper.Get<ISoundManager>(); return SoundEffectExtensions.SoundManager.AddEmitter(new SoundEmitter(soundEffect, false, pitch, 1f, false, new Vector3?())); }
public void Load(ISceneProvider draw, IEventProvider events, INetworkProvider network, ISoundProvider sound, IModuleProvider modules, IMovementProvider movement, ICollisionProvider collision, IVoiceChatProvider voicechat, IWorldManager world, ITextureManager texture, ISoundManager soundmanager) { this.drawprovider = draw; this.eventprovider = events; this.networkprovider = network; this.soundprovider = sound; this.moduleprovider = modules; this.movementprovider = movement; this.collisionprovider = collision; this.voicechatprovider = voicechat; this.texturemanager = texture; this.worldmanager = world; this.soundmanager = soundmanager; this.LoadContexts (drawprovider, eventprovider, networkprovider, soundprovider, moduleprovider, movementprovider, collisionprovider, voicechatprovider, texturemanager, worldmanager, soundmanager); }
public static SoundEmitter Emit(this SoundEffect soundEffect, bool loop, float pitch, float volume, bool paused) { if (SoundEffectExtensions.SoundManager == null) SoundEffectExtensions.SoundManager = ServiceHelper.Get<ISoundManager>(); return SoundEffectExtensions.SoundManager.AddEmitter(new SoundEmitter(soundEffect, loop, pitch, volume, paused, new Vector3?())); }
public PhraseComposer(ISoundManager soundManager) { CodeContract.Requires(soundManager != null); _soundManager = soundManager; }
public override void Initialize() { base.Initialize(); InputManager = Game.Services.GetService(typeof(IInputManager)) as IInputManager; m_SoundManager = Game.Services.GetService(typeof(ISoundManager)) as ISoundManager; initAnimations(); }
public MainWindow() { InitializeComponent(); SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true); soundManager = new SoundManager(new AudioDevice(), ManagerGlue.FMOD, 1, 40) { ContentPath = "Data/Sound/" }; soundManager.LoadSounds(true); timer = new Timer(); timer.Tick += new EventHandler(timer_Tick); timer.Interval = 1000 / 60; Vector3 middle = new Vector3(Size.Width / 2f, Size.Height / 2f, 0); position = middle; floatingPoint = middle; InsertUnit(middle, soundManager.GetSFX(SFX.DogBite1)); //IPlayable ipSound = soundManager.GetSoundResourceGroup(soundManager.GetSFX(SFX.DogBite1), soundManager.GetSFX(SFX.HitBySword1)); //intervalChannel = ipSound.PlayLoopedWithIntervals(0.1f, 5f, 2f, GetFloatingPoint, () => { return Vector3.Zero; }); //movingUnitBasePosition = middle; //movingUnit = new Unit { Position = movingUnitBasePosition, Sound = soundManager.GetSFX(SFX.HumanDeath1) }; ////var channel = movingUnit.Sound.Play(() => { return movingUnit.Position; }, () => { return Vector3.Zero; }); //movingUnitChannel = movingUnit.Sound.Play(); //movingUnitChannel.Looping = true; //var u1 = InsertUnit(middle + new Vector3(30, 0, 0), soundManager.GetSFX(SFX.DogBite1)); //var u2 = InsertUnit(middle - new Vector3(30, 0, 0), soundManager.GetSFX(SFX.PiranhaAttack1)); //panChannel1 = (SoundChannel)u1.Sound.Play(u1.Position, Vector3.Zero); //panChannel1.Looping = true; //panChannel2 = (SoundChannel)u2.Sound.Play(u2.Position, Vector3.Zero); //panChannel2.Looping = true; //InsertUnit(middle + new Vector3(30, 30, 0), soundManager.GetSFX(SFX.DogBite1)); //InsertUnit(middle - new Vector3(30, -30, 0), soundManager.GetSFX(SFX.PiranhaAttack1)); //InsertUnit(middle - new Vector3(30, 30, 0), soundManager.GetSFX(SFX.Charge1)); //InsertUnit(middle + new Vector3(30, 30, 0), soundManager.GetSoundResourceGroup(soundManager.GetSFX(SFX.FireBreath1), soundManager.GetSFX(SFX.RottenTreeHitBySword1))); //InsertUnit(middle - new Vector3(30, 30, 0), soundManager.GetSFX(SFX.RifleFire1)); //InsertUnit(middle - new Vector3(30, -30, 0), soundManager.GetSFX(SFX.HumanDeath1)); //InsertUnit(middle + new Vector3(30, 30, 0), new SoundInstanceGroup(soundEffects[Sounds.SFX.HitsFlesh1], soundEffects[Sounds.SFX.SwordHitWood1])); //InsertUnit(middle - new Vector3(30, 30, 0), soundEffects[Sounds.SFX.SwordRing3]); //InsertUnit(middle - new Vector3(30, -30, 0), soundEffects[Sounds.SFX.MonsterSqueal1]); //volumeTestChannel = SoundManager.Instance.GetStream(Stream.InGameMusic4).Play(); //volumeTestResource = volumeTestChannel.CurrentSoundResource; //volumeTestSoundGroup = SoundManager.Instance.GetSoundGroup(SoundGroups.Music); //volumeTestChannelVolume = volumeTestChannel.Volume; //volumeTestResourceVolume = volumeTestResource.Volume; //volumeTestSoundGroupVolume = volumeTestSoundGroup.Volume; //volumeTestChannel = SoundManager.Instance.GetSoundResourceGroup(SoundManager.Instance.GetStream(Graphics.Sound.Stream.InGameMusic1), // SoundManager.Instance.GetStream(Graphics.Sound.Stream.MainMenuMusic1)).PlayLoopedWithIntervals(0.5f, 0.5f, 0.2f); //volumeTestChannel = SoundManager.Instance.GetSoundResourceGroup(SoundManager.Instance.GetStream(Graphics.Sound.Stream.InGameMusic2), // SoundManager.Instance.GetStream(Graphics.Sound.Stream.InGameMusic3)).Play(); //volumeTestChannel = SoundManager.Instance.GetStream(Stream.InGameMusic3).PlayLoopedWithIntervals(0.5f, 0.5f, 0.2f); //volumeTestResource = volumeTestChannel.CurrentSoundResource; //volumeTestChannelVolume = volumeTestChannel.Volume; //uint bufferLength = 0; //int numBuffers = 0; //((SoundManager)soundManager).FMODSystem.getDSPBufferSize(ref bufferLength, ref numBuffers); //var asdf = (SoundResource)soundManager.GetStream(Stream.TestSong); //float frequency = 0, dummy = 0; //int dummyI = 0; //asdf.Sound.getDefaults(ref frequency, ref dummy, ref dummy, ref dummyI); timer.Enabled = true; }
protected override void Initialize(WorkflowExecutionContext context) { base.Initialize(context); var app = CoreApplication.Instance; _workflowManager = app.GetSubsystemOrThrow<IWorkflowManager>(); _scannerManager = app.GetSubsystemOrThrow<IScannerManager>(); _electionManager = app.GetSubsystemOrThrow<IElectionManager>(); _votingResultManager = app.GetSubsystemOrThrow<IVotingResultManager>(); _syncManager = app.GetSubsystemOrThrow<ISynchronizationManager>(); _soundManager = app.GetSubsystemOrThrow<ISoundManager>(); _keyboard = app.GetSubsystemOrThrow<UnionKeyboard>(); _configManager = app.GetSubsystemOrThrow<IConfigurationManager>(); _fileSystemManager = app.GetSubsystemOrThrow<IFileSystemManager>(); _printingManager = app.GetSubsystemOrThrow<IPrintingManager>(); _recognitionManager = app.GetSubsystemOrThrow<IRecognitionManager>(); _logger = _workflowManager.Logger; }
public override void Initialize() { base.Initialize(); initAnimations(); m_SoundManager = Game.Services.GetService<ISoundManager>(); }
public SoundManagerView(ISoundManager soundManager, Random random) { this.sounds = new Dictionary<string, List<SoundEffectInstance>>(); this.soundManager = soundManager; this.random = random; }
public override void Initialize() { base.Initialize(); m_RangeToMove = (float)Bounds.Width / 4; RightBarrier = (int)(Bounds.Right + Bounds.Width + m_RangeToMove); LeftBarrier = (int)(Bounds.Left - m_RangeToMove); m_SoundManager = Game.Services.GetService<ISoundManager>(); m_SettingsManager = Game.Services.GetService<ISettingsManager>(); if (!m_SettingsManager.GetGameLevelSettings().BarrierShouldMove) { Velocity = Vector2.Zero; } Velocity += m_SettingsManager.GetGameLevelSettings().AdditionalBarrierSpeedPercent * Velocity; }
public static SoundEmitter EmitAt(this SoundEffect soundEffect, Vector3 position, float pitch, bool paused) { if (SoundEffectExtensions.SoundManager == null) SoundEffectExtensions.SoundManager = ServiceHelper.Get<ISoundManager>(); return SoundEffectExtensions.SoundManager.AddEmitter(new SoundEmitter(soundEffect, false, pitch, 1f, paused, new Vector3?(position))); }
public TestState() { soundManager = new SoundManager(new AudioDevice(), ManagerGlue.JMOD, 5, 200) { ContentPath = "Data/Sound/" }; soundManager.LoadSounds(true); }
public static SoundEmitter EmitAt(this SoundEffect soundEffect, Vector3 position) { if (SoundEffectExtensions.SoundManager == null) SoundEffectExtensions.SoundManager = ServiceHelper.Get<ISoundManager>(); return SoundEffectExtensions.SoundManager.AddEmitter(new SoundEmitter(soundEffect, false, 0.0f, 1f, false, new Vector3?(position))); }