public void Stop_GameMusic() { if (GameMusic != null && GameMusic.isPlaying) { GameMusic.Stop(); } }
/// <summary> /// Odtwarzanie muzyki i odglosow jedzenia /// </summary> private void PlayGameMusic() { GameMusic.Open(new Uri(System.IO.Path.GetFullPath("../../" + "Sounds/gameMusic.wav"), UriKind.RelativeOrAbsolute)); GameMusic.Volume = PlayerData.VolumeGame / 100; GameMusic.MediaEnded += new EventHandler(Media_Repeat); GameMusic.Play(); }
void Start() { if ((mTesting && !Application.isEditor)) { GameObject.Destroy(this.gameObject); Debug.Log("Destroyed Test Game Instance"); return; } if (mInstance != null && mInstance != this) { GameObject.Destroy(this); return; } mInstance = this; DontDestroyOnLoad(this); InitLogicImplementation(); gameLogicImplementation.Start(); mGameLicense = Helpers.CreateComponentIfNotExists <GameLicense>(this); mGameOptions = Helpers.CreateComponentIfNotExists <GameOptions>(this); mGameState = Helpers.CreateComponentIfNotExists <GameStateManager>(this); mGamePlayer = Helpers.CreateComponentIfNotExists <GamePlayer>(this); mGameMusic = Helpers.CreateComponentIfNotExists <GameMusic>(this); mGameLoca = Helpers.CreateComponentIfNotExists <GameLocalization>(this); mGameLoca.Initialize(); mGamePause = Helpers.CreateComponentIfNotExists <GamePause>(this); mGameInput = Helpers.CreateComponentIfNotExists <GameInput>(this); mSceneTransition = Helpers.CreateComponentIfNotExists <SceneTransition>(this); mGameData = Helpers.CreateComponentIfNotExists <GameData>(this); mFirstFrame = true; }
// Use this for initialization void Start() { waitTime = 0.02f; scene = Singleton_Service.GetSingleton <SceneController>(); player = Singleton_Service.GetSingleton <Player>(); rightHand = Singleton_Service.GetSingleton <RightHand>(); leftHand = Singleton_Service.GetSingleton <LeftHand>(); music = Singleton_Service.GetSingleton <GameMusic>(); swordSource = rightHand.GetSword().GetComponent <AudioSource>(); swordAud = rightHand.GetSword().GetComponent <SwordAudio>(); shieldSource = leftHand.GetShield().GetComponent <AudioSource>(); shieldAud = leftHand.GetShield().GetComponent <ShieldAudio>(); playerHitSource = player.GetComponent <AudioSource>(); playerHitAud = player.GetComponent <PlayerHitAudio>(); playerAttack = player.GetAttack(); playerDefense = player.GetDefense(); anim = GetComponent <Animator>(); UpdateEnemyUI(); EnemyInit(); StartCoroutine("Updating"); currentState = idleState; currentState.StartState(); }
private void InitializeGameObjects() { #region initialize game music gameMusic = new GameMusic(musicGenerator); #endregion #region initialize Hero player = new Human(generateSprites.GetSpriteHuman(12), Vector2.Zero, fontGenerator.SpriteFonts, heroHearts, heroAttackDamage); #endregion #region initialize level1 level1 = new Level(Content, levelsWorld1, player, fontGenerator.SpriteFonts, new EnemyEffects(musicGenerator)); level1.CreateLevels(); #endregion #region initialize hero movements moveHero = new MoveCommandHero(player, level1, keyBoardReader, new HumanEffect(musicGenerator)); #endregion #region initialize camera animation _cameraAnimation = new CameraAnimatie((IInputSecredKeys)keyBoardReader); #endregion #region initialize menus startMenu = new StartMenu(fontGenerator.SpriteFonts, (IInputMenu)keyBoardReader, new Vector2(12, 2), startMenuItems); pauseMenu = new PauseMenu(fontGenerator.SpriteFonts, (IInputMenu)keyBoardReader, new Vector2(2, 2), pauseMenuItems); deadMenu = new EndingGameMenu(fontGenerator.SpriteFonts, (IInputMenu)keyBoardReader, new Vector2(2, 2), deadMenuItems); endMenu = new EndingGameMenu(fontGenerator.SpriteFonts, (IInputMenu)keyBoardReader, new Vector2((levelsWorld1[levelsWorld1.Count - 1].Warp1.X / 32) - 2, (levelsWorld1[levelsWorld1.Count - 1].Warp1.Y / 32) - 4), endMenuItems); #endregion #region initialize gameloop currGameState = GameLoop.Menu; #endregion }
IEnumerator InitializeInternal() { initialized = true; Instance = this; DontDestroyOnLoad(this); ThreadingBridge.Initialize(); // for webgl we cannot use custom attributes to find classes, so we rely on a delegate to create the logic instance for us. Initialize(); #if UNITY_WEBGL webGLHelper = this.AddComponentIfNotExists <WebGLPlatformHelper>(); #endif gameOptions = this.AddComponentIfNotExists <GameOptions>(); gameMusic = this.AddComponentIfNotExists <GameMusic>(); gameLoca = this.AddComponentIfNotExists <GameLocalization>(); gameLoca.Initialize(); gameInput = this.AddComponentIfNotExists <GameInput>(); sceneTransition = this.AddComponentIfNotExists <SceneTransition>(); objectPool = new ObjectPool(); yield return(new WaitForEndOfFrame()); GameSetupReady(); }
public static void Create(MainWindow WND_Owner, GameType GameType) { Owner = WND_Owner; RandomGenerator = new Random(); gameType = GameType; CreateSettingsWindow(); mediaContainer = new GameMediaContainer(); Owner.DataContext = new MainWindowVM((SettingsWindowVM)SettingsWindow.DataContext); Player Snd = new PlayerWpf("PlayerSound", mediaContainer, Owner.MediaElementSound); Player Msc = new PlayerWpf("PlayerMusic", mediaContainer, Owner.MediaElementSound); Sound = new GameSound(ref Snd); Music = new GameMusic(ref Msc); Music.MediaGUI.Add(Owner.MusicVolumeSlider); Game.Owner.MusicVolumeSlider.DataContext = Music.volume; Music.MediaGUI.UIMediaHide(); if (Settings.GetInstance().VideoPlayerType == VideoPlayerType.wpf) { Player Vdowpf = new PlayerWpf("PlayerVideoWpf", mediaContainer, Owner.MediaElementVideo); VideoWpf = new GameVideo(ref Vdowpf); CurVideo = new GameVideo(ref Vdowpf); VideoPlayerSet(VideoWpf); } }
protected override void InitLevelSpecific() { Music = new GameMusic(); Add(Music); SubtitleText t = new SubtitleText(); t.AddText("QUEST FOR THE\nPIXEL PRINCESS", 6f); t.AddText("You, The Golden Knight, must\nrescue the princess...", 5f); t.AddText("...from the clutches of\nthe evil Red Guard.", 5f); //t.AddText("...from the clutches of\nthe evil Red Guard.", 5f); Subtitles.Show(0, t); t = new SubtitleText("My ears! Hark the drums\nof the Red Guard!"); t.StartTime = 64.0f; t.Duration = 10.0f; Subtitles.Show(0, t); t = new SubtitleText(); t.AddText("Music 'The Never Ending Quest For The\nPrincess II' by Producer Snafu!\nCC-BY-NC producersnafu.bandcamp.com", 10f); t.AddText("FMOD Audio engine\n(c) Firelight Technologies Pty, Ltd. 2004-2009.", 6f); //t.Duration = 10f; Parent.Add(t); t.ScaleVector = new Vector2(1f, 1f); t.Motion.Scale = 0.35f;/// DEFAULT_SCALE; t.Motion.Position = new Vector2(0.35f, 0.25f); //t.DrawInfo.Center = Vector2.Zero; t.StartTime = 17f; }
public void PlayMusic(GameMusic music) { if (audio != null) { audio.PlayMusic(music); } }
// Use this for initialization void Start() { //temporary testing PlayerPrefs.SetInt("currentLevel", 14); player = Singleton_Service.GetSingleton <Player>(); music = Singleton_Service.GetSingleton <GameMusic>(); buildingLevels.Add(level1); for (int i = 1; i < 10; i++) { buildingLevels.Add(Instantiate(level, new Vector3(0, i * floorHeight, 0), Quaternion.identity, levels)); } for (int i = 11; i <= 13; i++) { buildingLevels.Add(Instantiate(highLevel, new Vector3(0, (i - 1) * floorHeight, 0), Quaternion.identity, levels)); } buildingLevels.Add(Instantiate(topLevel, new Vector3(0, 52, 0), Quaternion.identity, levels)); foreach (int i in emptyLevels) { buildingLevels[i - 1].tag = "EmptyLevel"; buildingLevels[i - 1].transform.Find("EnemyScrollPos").gameObject.SetActive(false); buildingLevels[i - 1].transform.Find("EnemyScroll").gameObject.SetActive(false); buildingLevels[i - 2].transform.Find("Ceiling").gameObject.SetActive(false); } currentMovableTile = Instantiate(movableTile, new Vector3(0, 0, -3f), Quaternion.identity); PutCrates(); music.PlayStartingMusic(); GetComponent <ScreenFader>().fadeIn = false; StartCoroutine(GetComponent <ScreenFader>().DoFade()); StartCoroutine("DelayFadeIn"); //currentPlayerScroll = Instantiate(playerScrollPos, Vector3.zero, Quaternion.identity); }
private void StartGame() { _gameHud.StartGame(); _loadScreen.HideLoadScreen(); GameMusic.PlaySound(GameMusicControl.GameTrack.Twinkly); ThePlayer.SetMovementMode(FlapComponent.MovementMode.VerticalOnly); }
private IEnumerator LoadSequence() { yield return(new WaitForSeconds(1f)); StartCoroutine("LevelStartAnimation"); GameMusic.PlaySound(GameMusicControl.GameTrack.Twinkly); }
void Start() { fadingTitleObject = GameObject.Find("FadingText"); fadingTitleText = fadingTitleObject.GetComponent <CanvasGroup>(); gameMusicObject = GameObject.Find("GameMusic"); source = gameMusicObject.GetComponent <AudioSource>(); charPanel = GameObject.Find("CharacterPanel"); currentCharacter = charPanel.GetComponent <Image>(); textBoxCanvasGroup = GameObject.Find("DialogBG").GetComponent <CanvasGroup>(); charPanelCanvasGroup = charPanel.GetComponent <CanvasGroup>(); bossHealthCG = BossHealthBar.GetComponent <CanvasGroup>(); Drew = GameObject.Find("DrewCoolActionGuy"); bradBullet = GameObject.Instantiate(jeffBullet); bradBullet.SetActive(false); musicScript = gameMusicObject.GetComponent <GameMusic>(); fadeImageImage = fadeImage.GetComponent <Image>(); thanksForPlaying = GameObject.Find("ThanksForPlaying"); thanksCG = thanksForPlaying.GetComponent <CanvasGroup>(); }
// KOLIZJE: // W przypadku kolizji sprawdzamy tryb gry (single/multi) i odpowiednio zarzadzamy HP oraz konczymy gre // w przypadku utraty wszystkich zyc: /// <summary> /// Wykrywanie kolizji /// </summary> void LifeVsCollision() { _lifes--; if (PlayerData.MultiOnOff == true && _gameMode == 0) { Rectangle a = (Rectangle)PlayerData.Item.Items[_indexOfHearts]; a.Opacity = 0; _indexOfHearts--; } if (_lifes > 0) { snake = new Snake(100, 100); _directionX = 10; _directionY = 0; InitSnake(); Thread.Sleep(1000); } if (_lifes == 0) { Timer.Stop(); GameMusic.Stop(); var messageBoxResult = WpfMessageBox.Show("Game Over", "Your result is: " + _score.ToString(), MessageBoxButton.YesNo, WpfMessageBox.MessageBoxImage.GameOver); } }
public void Play_GameMusic() { if (GameMusic != null && !GameMusic.isPlaying) { GameMusic.Play(); } }
/// <summary> /// Interakcja - ladowanie okna + zdarzenia (sygnaly od wciskanych przyciskow) /// </summary> private void UserControl_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Up && _directionY != 10) { _directionX = 0; _directionY = -10; } if (e.Key == Key.Down && _directionY != -10) { _directionX = 0; _directionY = 10; } if (e.Key == Key.Left && _directionX != 10) { _directionX = -10; _directionY = 0; } if (e.Key == Key.Right && _directionX != -10) { _directionX = 10; _directionY = 0; } if (e.Key == Key.P) { Timer.Stop(); GameMusic.Pause(); var messageBoxResult = WpfMessageBox.Show("Pause!", "Game paused", MessageBoxButton.OKCancel, WpfMessageBox.MessageBoxImage.Pause); } // ten if jest dla testow: if (e.Key == Key.G) { _tmpForTest = true; } }
public void SetPreset(int index) { m_GameMusicIndex = index; GameMusic mz = AudioManager.m_Instance.GetGameMusic(m_GameMusicIndex); SetButtonTexture(mz.iconImage); SetDescriptionText(mz.description); }
public void PlayMusic(GameMusic music) { if (music != currentMusic) { musics[(int)music].PlayFade(1000); currentMusic = music; } }
public void StopMusic() { if (currentMusic == GameMusic.None) { return; } Sound.FadeMusic(250); currentMusic = GameMusic.None; }
void Start() { _image = GetComponent <Image>(); _gameMusic = FindObjectOfType <GameMusic>(); isGameMusicMuted = _gameMusic.isMuted; UpdateButtonImage(); }
private void Awake() { GameMusic gameMusic = FindObjectOfType <GameMusic>(); if (gameMusic != null) { gameMusic.GetComponent <AudioSource>().Stop(); } }
void Awake() { if (instance != null && instance != this) { Destroy (this.gameObject); return; } else instance = this; DontDestroyOnLoad (this.gameObject); }
private void Awake() { if (_instance != null && _instance != this) { Destroy(this.gameObject); } else { _instance = this; } }
// Make GameMusic DontDestroyOnLoad void Awake() { if (gameMusic == null) { DontDestroyOnLoad(gameObject); gameMusic = this; } else if (gameMusic != this) { Destroy(gameObject); } }
public override void Startup() { //Registering assemblies needed for scripts ScriptAssembly.Assemblies.Add(Assembly.GetExecutingAssembly()); ScriptAssembly.Assemblies.Add(typeof(Microsoft.Xna.Framework.Vector2).Assembly); ScriptAssembly.Assemblies.Add(typeof(FarseerPhysics.Dynamics.Body).Assembly); ScriptAssembly.Assemblies.Add(typeof(LBE.Gameplay.GameObject).Assembly); //Loading configuration m_configParameters = Engine.AssetManager.GetAsset <ConfigParameters>("Game/Config.lua::Config"); Engine.Renderer.SetResolution( m_configParameters.Content.ResolutionX, m_configParameters.Content.ResolutionY); //Loading starting infos m_startInfo = Engine.AssetManager.Get <GameStartInfo>("Game/GameStart.lua::GameStart"); if (m_startInfo.Release) { m_startInfo = new GameStartInfo() { Release = true } } ; Engine.Debug.Flags.EnableAI = m_startInfo.EnableAI; Engine.Debug.Flags.RenderDebug = m_startInfo.RenderDebug; Engine.Debug.Flags.EnableCommands = !m_startInfo.Release; //Loading player profil m_gameProfil = GameProfile.Load(); if (m_gameProfil == null) { m_gameProfil = GameProfile.NewProfile(); } GameProfile.Save(m_gameProfil); //Create game session m_gameSession = new Ball.GameSession(); //Creating managers m_statManager = new StatManager(); m_gameManager = new GameManager(); m_optionMgr = new OptionManager(); m_menuManager = new MenuManager(); m_gameMusic = new GameMusic(); //Reset control m_resetCtrl = new KeyControl(Keys.Home); //Start the game!!! StartGame(); }
private void Awake() { if (!instance) { instance = this; } else { Destroy(this.gameObject); } DontDestroyOnLoad(transform.gameObject); }
/// <summary> /// Kolizja miedzy wezami /// </summary> void KilledBySnake() { Timer.Stop(); GameMusic.Stop(); SendDataToServer("?"); serverStream.Close(); Multi.clientSocket.Close(); var messageBoxResult = WpfMessageBox.Show("Game Over", "Your result is: " + _score.ToString(), MessageBoxButton.YesNoCancel, WpfMessageBox.MessageBoxImage.GameOver); _isKilled = true; }
protected override void InitLevelSpecific() { Music = new GameMusic(); Sound = new GameSound(); Add(Music); Add(Sound); // pink arthur king = new PinkArthur(); king.PositionAndTarget = PINKARTHUR_POSITION; //king.PositionAndTarget = new Vector2(90f,158f); // debug Add(king); // graphic title/logo Spritelet logo = new PixieLogo("title-logo.png"); logo.Duration = 8f; logo.StartTime = 13f; logo.DrawInfo.LayerDepth = 0.1f; Parent.AddNextUpdate(logo); SubtitleText t = new SubtitleText(); t.AddText("Knights of honor!", 4f); t.AddText("Follow me! Together we will\nrescue Arthur, our King.", 4f); t.AddText("(Knights:)\nFOR JUSTICE! FOR THE KING!!", 4f).DrawInfo.DrawColor = Color.RoyalBlue; Subtitles.Show(0, t); t.StartTime = 1f; t = new SubtitleText(); t.IsAutoPosition = true; t.ScaleVector = new Vector2(1f, 1f); t.ShadowVector = new Vector2(1f, 1f); t.Motion.Scale = 0.5f; t.StartTime = logo.StartTime + logo.Duration + 0.6f; t.AddText("Galad the Golden, you must rescue Pink Arthur...", 5f); t.AddText("...from the clutches of the evil Red Guard.", 5f); t.AddText("The Fourteen Kobalt Knights will aid you!", 5f); t.AddText("Arthur was taken deep into Red's Keep...", 5f); t.AddText("...where rumors say the Giant Red Sorceress lives.", 5f); t.AddText("Get him out and take him back, chivalrous knight!", 5f); t.AddText("", 1f); t.AddText("Press F1 for controls help", 6f); t.AddText("", 1f); t.AddText("Coding & art by Indiegame Garden", 4f); t.AddText("Sounds by Jute and artisticdude (opengameart.org)", 3f); t.AddText("Music by John the Luteist", 3f); t.AddText("Sprite by Charles Gabriel (opengameart.org)", 3f); t.AddText("Press F1 for controls help", 3f); Parent.Add(t); t.Motion.Position = new Vector2(Screen.Center.X, 0.08f); }
private void Awake() { if (_gameMusicInstance == null) { _gameMusicInstance = this; } else { Destroy(this); } DontDestroyOnLoad(this.gameObject); }
private void ImageSoundIcon_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { if (GameMusic.CurrentState == MediaElementState.Stopped) { ImageSoundIcon.Source = sound_on; GameMusic.Play(); } else { ImageSoundIcon.Source = mute; GameMusic.Stop(); } }
void Awake() { if (beat != null && beat != this) { Destroy(this.gameObject); return; } else { beat = this; } DontDestroyOnLoad(this.gameObject); }
private void OnDisable() { _music = null; }
void Awake() { musicPrefab = GetComponent<GameMusic>(); }
public AudioDevice() { LoadSounds(); LoadMusics(); currentMusic = GameMusic.None; }
void Init() { mGameMusic = GameObject.Find ("GameMusic").GetComponent<GameMusic>(); mLevelList = new List<States> (); mRnd = new System.Random (); mLevelList.Add(States.GAME_LEVEL_1); mLevelList.Add(States.GAME_LEVEL_2); mLevelList.Add(States.GAME_LEVEL_3); mlevelIndex = mRnd.Next(-1, 2); mIsPaused = false; }
private void OnEnable() { _music = this; }
void Start() { fadingTitleObject = GameObject.Find("FadingText"); fadingTitleText = fadingTitleObject.GetComponent<CanvasGroup>(); gameMusicObject = GameObject.Find("GameMusic"); source = gameMusicObject.GetComponent<AudioSource>(); charPanel = GameObject.Find("CharacterPanel"); currentCharacter = charPanel.GetComponent<Image>(); textBoxCanvasGroup = GameObject.Find("DialogBG").GetComponent<CanvasGroup>(); charPanelCanvasGroup = charPanel.GetComponent<CanvasGroup>(); bossHealthCG = BossHealthBar.GetComponent<CanvasGroup>(); Drew = GameObject.Find("DrewCoolActionGuy"); bradBullet = GameObject.Instantiate(jeffBullet); bradBullet.SetActive(false); musicScript = gameMusicObject.GetComponent<GameMusic>(); fadeImageImage = fadeImage.GetComponent<Image>(); thanksForPlaying = GameObject.Find("ThanksForPlaying"); thanksCG = thanksForPlaying.GetComponent<CanvasGroup>(); }
void Init() { mGameFlow = GameObject.Find ("GameFlow").GetComponent<GameFlow>(); mGameMusic = GameObject.Find("GameMusic").GetComponent<GameMusic>(); mSoundOn = true; }
// Init all the variables that needs to be private void Init() { mGameFlow = GameObject.Find ("GameFlow").GetComponent<GameFlow>(); mGameFlow.PauseSmoke (false); mRenderer = GetComponent<SpriteRenderer>(); mRenderer.color = BASE_COLOR; mBody = GetComponent<Rigidbody2D>(); mToxicity = 0.3f; mPrevToxicity = 0.0f; mOpacity = 1; mTmpOpacity = mOpacity; mCurrentSpeed = mSpeed; mTmpMaxSpeed = mMaxSpeed; mCollectablesCount = 0; mInAir = false; mIsdead = false; mCurrentDirection = DIRECTION_LEFT; mGameMusic = GameObject.Find ("GameMusic").GetComponent<GameMusic>(); mAnimator = GetComponent<Animator>(); mGameMusic.PlayMusic(GameMusic.Songs.LEVEL); mTimerOn = true; mTimer = MAX_TIMER; mToxicTimerOn = false; mToxicTimer = 0.0f; mFolder1.enabled = true; mFolder2.enabled = true; mFolder3.enabled = true; mRight = Vector2.right; mLeft = -Vector2.right; }