public override void OnExit() { base.OnExit(); m_songPlayer.Stop(); m_songPlayer.Dispose(); m_songPlayer = null; }
public TitleScene() { this.Camera.SetViewFromViewport(); m_texture = new Texture2D("Application/images/title.png", false); m_ti = new TextureInfo(m_texture); SpriteUV titleScreen = new SpriteUV(m_ti); titleScreen.Scale = m_ti.TextureSizef; titleScreen.Pivot = new Vector2(0.5f, 0.5f); titleScreen.Position = new Vector2(Director.Instance.GL.Context.GetViewport().Width / 2.0f, Director.Instance.GL.Context.GetViewport().Height / 2.0f); this.AddChild(titleScreen); Vector4 origColor = titleScreen.Color; titleScreen.Color = new Vector4(0, 0, 0, 0); var tintAction = new TintTo(origColor, 10.0f); ActionManager.Instance.AddAction(tintAction, titleScreen); tintAction.Run(); m_titleSong = new Bgm("/Application/audio/titlesong.mp3"); if (m_songPlayer != null) { m_songPlayer.Dispose(); } m_songPlayer = m_titleSong.CreatePlayer(); Scheduler.Instance.ScheduleUpdateForTarget(this, 0, false); // Clear any queued clicks so we dont immediately exit if coming in from the menu Touch.GetData(0).Clear(); }
public InGameScene() { InitializeUI(); scene = new Sce.PlayStation.HighLevel.GameEngine2D.Scene(); scene.Camera.SetViewFromViewport(); textureInfo = new TextureInfo("/Application/Assets/stone2.png"); background = new SpriteUV(textureInfo); background.Quad.S = textureInfo.TextureSizef; scene.AddChild(background); numTanks = 5; //tank = new Tank(scene); //tankSpawner = new Spawner(tank); tankList = new Tank[numTanks]; for (int i = 0; i < numTanks; i++) { tankList[i] = new Tank(scene); } player = new Player(scene); ScoreManager.Instance.startTime(); alive = true; bgSound = new Bgm("/Application/Audio/BenHill.mp3"); bgSoundPlayer = bgSound.CreatePlayer(); //Fix when it plays //bgSoundPlayer.Dispose(); }
public static void InitSound() { stage1 = new Bgm("/Application/resourses/stage1.mp3"); stage1boss = new Bgm("/Application/resourses/stage1boss.mp3"); title = new Bgm("/Application/resourses/title.mp3"); gameover = new Bgm("/Application/resourses/gameover.mp3"); bgmPlayer = stage1.CreatePlayer(); sound = new Sound("/Application/resourses/shot.wav"); shot = sound.CreatePlayer(); sound = new Sound("/Application/resourses/hidan.wav"); hidan = sound.CreatePlayer(); sound = new Sound("/Application/resourses/siren.wav"); siren = sound.CreatePlayer(); sound = new Sound("/Application/resourses/stageClear.wav"); stageClear = sound.CreatePlayer(); sound = new Sound("/Application/resourses/system1.wav"); ok = sound.CreatePlayer(); sound = new Sound("/Application/resourses/system2.wav"); cancel = sound.CreatePlayer(); sound = new Sound("/Application/resourses/damage.wav"); tekihidan = sound.CreatePlayer(); sound = new Sound("/Application/resourses/skillSE1.wav"); skill1 = sound.CreatePlayer(); sound = new Sound("/Application/resourses/skillSE2.wav"); skill2 = sound.CreatePlayer(); sound = new Sound("/Application/resourses/stageClear.wav"); stageClear = sound.CreatePlayer(); sound = new Sound("/Application/resourses/tick.wav"); ticktuck = sound.CreatePlayer(); }
private void ScaleSplat(float dT) { if (speed < 9.0f) { speed += 0.5f; } if (splatScale.X > 1.0f) { splatScale.X -= speed * dT; } if (splatScale.Y > 1.0f) { splatScale.Y -= speed * dT; } if (splatScale.X <= 1.8f && !playing) { SoundPlayer.Play(); playing = true; } if (SoundPlayer.Status != BgmStatus.Playing && playing) { SoundPlayer.Stop(); SoundPlayer.Dispose(); SoundPlayer = metalSound.CreatePlayer(); } splat.Scale = splatScale; }
/// <summary> /// 建立音乐播放器 /// </summary> public void CreatMusicPlayer(Bgm music) { MusicPlayer = music.CreatePlayer(); MusicPlayer.Volume = 0; MusicPlayer.Loop = musicLoop; MusicPlayer.Play(); }
public void Terminate() { BgmPlayer.Stop(); SEPlayer.PlayOneShot(DoolAudioClip); DefaultCamera.gameObject.SetActive(false); Shakable.gameObject.SetActive(true); Shakable.Shake(CameraShakeDuration, CameraShakeMagnitude); EnemySpawner1.gameObject.SetActive(false); EnemySpawner2.gameObject.SetActive(false); EnemySpawner3.gameObject.SetActive(false); Movable.enabled = false; var dollPosition = Doll.position; dollPosition.y = DollYPosition; if (GameCache.Scores[PotInfo] > GameCache.Scores[RougeInfo]) { dollPosition.x = Rouge.position.x; Rouge.gameObject.SetActive(false); } else { dollPosition.x = Pot.position.x; Pot.gameObject.SetActive(false); } Doll.position = dollPosition; StartCoroutine(SceneChangeCoroutine()); }
public void Init(IBootConfig bootConfig = null) { if (bootConfig == null) { bootConfig = new DefaultBootConfig(); } _gameObject = new GameObject("GameContext"); resourceStore = new ResourceStore(); sceneDirector = _gameObject.AddComponent <SceneDirectorMock>(); sceneDirector.Init(_gameObject, bootConfig, resourceStore); timeKeeper = new TimeKeeper(sceneDirector); bgmPlayer = new BgmPlayer(); bgmPlayer.Init(_gameObject, bootConfig.numBgmSourcePool, sceneDirector, resourceStore); sePlayer = new SePlayer(); sePlayer.Init(_gameObject, bootConfig.numSeSourcePool, sceneDirector, resourceStore); signalHub = new SignalHub(sceneDirector); tweenerHub = new TweenerHub(sceneDirector, timeKeeper); objectPoolHub = new ObjectPoolHub(sceneDirector); bootConfig.OnGameBoot(); }
public EndGameScene() { scene = new Sce.PlayStation.HighLevel.GameEngine2D.Scene(); scene.Camera.SetViewFromViewport(); textureInfo = new TextureInfo("/Application/Assets/endBackground.png"); background = new SpriteUV(textureInfo); background.Quad.S = textureInfo.TextureSizef; scene.AddChild(background); timer = 0.0f; scoreTxt = new Label(); scoreTxt.Text = "Score: " + ScoreManager.Instance.getScore(); scoreTxt.Scale = new Vector2(5.0f, 5.0f); scoreTxt.Position = new Vector2(Director.Instance.GL.Context.GetViewport().Width / 2 - 150, Director.Instance.GL.Context.GetViewport().Height *0.1f); scoreTxt.Color = new Vector4(0.0f, 1.0f, 0.0f, 1.0f); Bgm hahaSound = new Bgm("/Application/Audio/Haha.mp3"); hahaSoundPlayer = hahaSound.CreatePlayer(); //Fix when it plays hahaSoundPlayer.Play(); scene.AddChild(scoreTxt); ScoreManager.Instance.reset(); }
protected override void Awake() { base.Awake(); if (bgm == null) { var bgmPlayer = new GameObject("BgmPlayer"); bgmPlayer.transform.SetParent(transform); bgm = bgmPlayer.AddComponent <BgmPlayer>(); } if (se == null) { var sePlayer = new GameObject("SePlayer"); sePlayer.transform.SetParent(transform); se = sePlayer.AddComponent <SePlayer>(); } if (mixer == null) { var audiomixer = new GameObject("MixerController"); audiomixer.transform.SetParent(transform); mixer = audiomixer.AddComponent <MixerController>(); } }
public static bool Init() { graphics = new GraphicsContext(); SampleDraw.Init(graphics); int sx = (graphics.Screen.Width / 2) - ((96 * 2) + (16 * 2)); int sy = (graphics.Screen.Height / 2) - (96 / 2); playButton = new SampleButton(sx + 0, sy - 24, 96, 48); stopButton = new SampleButton(sx + 112, sy - 24, 96, 48); pauseButton = new SampleButton(sx + 224, sy - 24, 96, 48); resumeButton = new SampleButton(sx + 336, sy - 24, 96, 48); volumeSlider = new SampleSlider(sx + 88, sy + 96, 256, 48); volTextPosX = (sx + 88) - 96; volTextPosY = (sy + 96) + 12; playButton.SetText("Play"); stopButton.SetText("Stop"); pauseButton.SetText("Pause"); resumeButton.SetText("Resume"); bgm = new Bgm("/Application/Sample/Audio/BgmPlayerSample/GAME_BGM_01.mp3"); bgmPlayer = bgm.CreatePlayer(); return(true); }
public static void PlayGameover() { bgmPlayer.Dispose(); bgmPlayer = gameover.CreatePlayer(); bgmPlayer.Loop = true; bgmPlayer.Play(); }
public override void OnExit() { base.OnExit (); _songPlayer.Stop(); _songPlayer.Dispose(); _songPlayer = null; }
/// public メソッド ///--------------------------------------------------------------------------- /// 初期化 public bool Init() { bgmList = new Bgm[(int)BgmId.Max]; bgmList[(int)BgmId.Main] = new Bgm("/Application/res/data/Sound/bgm.mp3"); bgmList[(int)BgmId.Clear] = new Bgm("/Application/res/data/Sound/jingle_clear.mp3"); bgmList[(int)BgmId.Gameover] = new Bgm("/Application/res/data/Sound/jingle_gameover.mp3"); seList = new Sound[(int)SeId.Max]; seList[(int)SeId.Anous] = new Sound("/Application/res/data/Sound/Anous.wav"); seList[(int)SeId.Eat] = new Sound("/Application/res/data/Sound/eatSound.wav"); seList[(int)SeId.MakeTower1] = new Sound("/Application/res/data/Sound/glowTower.wav"); seList[(int)SeId.MakeTower2] = new Sound("/Application/res/data/Sound/glowTower2.wav"); seList[(int)SeId.MakeMo] = new Sound("/Application/res/data/Sound/MakeMonument.wav"); seList[(int)SeId.CharVo1] = new Sound("/Application/res/data/Sound/CharVo.wav"); seList[(int)SeId.CharVo2] = new Sound("/Application/res/data/Sound/CharVo2.wav"); seList[(int)SeId.CharVo3] = new Sound("/Application/res/data/Sound/CharVo3.wav"); seList[(int)SeId.ZonbiVo3] = new Sound("/Application/res/data/Sound/ZonbiVoice.wav"); seList[(int)SeId.PlDamage] = new Sound("/Application/res/data/Sound/player_damage.wav"); seList[(int)SeId.PlFoot] = new Sound("/Application/res/data/Sound/TitanWalk.wav"); seList[(int)SeId.ObjBreak] = new Sound("/Application/res/data/Sound/obj_break.wav"); sePlayer = new SoundPlayer[(int)SeId.Max]; for (int i = 0; i < (int)SeId.Max; i++) { sePlayer[i] = seList[i].CreatePlayer(); } bgmPlayer = null; return(true); }
public TitleScene() { this.Camera.SetViewFromViewport(); _texture = new Texture2D("Application/images/title.png",false); _ti = new TextureInfo(_texture); SpriteUV titleScreen = new SpriteUV(_ti); titleScreen.Scale = _ti.TextureSizef; titleScreen.Pivot = new Vector2(0.5f,0.5f); titleScreen.Position = new Vector2(Director.Instance.GL.Context.GetViewport().Width/2, Director.Instance.GL.Context.GetViewport().Height/2); this.AddChild(titleScreen); Vector4 origColor = titleScreen.Color; titleScreen.Color = new Vector4(0,0,0,0); var tintAction = new TintTo(origColor,10.0f); ActionManager.Instance.AddAction(tintAction,titleScreen); tintAction.Run(); _titleSong = new Bgm("/Application/audio/titlesong.mp3"); if(_songPlayer != null) _songPlayer.Dispose(); _songPlayer = _titleSong.CreatePlayer(); Scheduler.Instance.ScheduleUpdateForTarget(this,0,false); // Clear any queued clicks so we dont immediately exit if coming in from the menu Touch.GetData(0).Clear(); }
internal void Update() { if (this.updateBgm) { BgmPlayer.Update(); BgmManager.Update(); } }
public override void OnExit() { base.OnExit(); this.mainMenuSongPlayer.Stop(); this.mainMenuSongPlayer.Dispose(); this.mainMenuSong.Dispose(); this.mainMenuSongPlayer = null; }
public MainScene() { InitializeWidget(); InitializeButtonEvents(); bgm = new Bgm("/Application/assets/GAME_BGM_01.mp3"); bp = bgm.CreatePlayer(); bp.Loop = true; }
public static void updataMusicState(TeamType team) { bool flag = false; SysBattleSceneVo dataById = BaseDataMgr.instance.GetDataById <SysBattleSceneVo>(LevelManager.CurLevelId); string[] array = new string[] { "Play_Amb_1v1_map16", "Play_Amb_2v2_map11", "Play_Amb_2v2_map13", "Play_Amb_2v2_map14", "Play_Amb_5v5_map17" }; string text = dataById.scene_map_id; text = text.ToLower(); for (int i = 0; i < array.Length; i++) { if (array[i].Contains(text)) { if (array[i].Contains("1v1")) { text = "1v1"; } else if (array[i].Contains("5v5")) { text = "3v3"; } break; } } if (text.Contains("3v3")) { flag = true; } if (flag) { if (TeamManager.MyTeam == team) { if (team == TeamType.LM && AchieveData.TowerDestrouByLm == 1) { BgmPlayer.OnFirstTowerBePullbyUS(); } else if (team == TeamType.BL && AchieveData.TowerDestroyByBl == 1) { BgmPlayer.OnFirstTowerBePullbyUS(); } } if (AchieveData.TowerDestroyByBl == 2 || AchieveData.TowerDestrouByLm == 2) { BgmPlayer.OnFstOr2ndTowerBePullDown(); } } else if (AchieveData.TowerDestrouByLm == 1 || AchieveData.TowerDestroyByBl == 1) { BgmPlayer.OnFstOr2ndTowerBePullDown(); } }
public BackgroundMusic(String resource) { lock (LOADED_MUSICS) { LOADED_MUSICS.Add(this); } this.backgroundMusic = new Bgm(resource); this.player = this.backgroundMusic.CreatePlayer(); }
public override void OnExit() { base.OnExit(); this.titleSongPlayer.Stop(); this.titleSongPlayer.Dispose(); this.titleSongPlayer = null; this.titleSong.Dispose(); this.titleSong = null; }
public void CloseSingleton() { ViewAsync.ResetSignal(null); ViewString <long> .SetProvider(null); BgmManager.Stop(true); BgmManager.Reset(); BgmPlayer.Close(); }
public void BgmChange(object sender, RoutedEventArgs args) { string[] bgmFiles = Directory.GetFiles("bgm", "*.mp3"); if (bgmFiles.Length > 0) { BgmPlayer.Source = new Uri(bgmFiles[(++bgmIndex) % bgmFiles.Length], UriKind.RelativeOrAbsolute); BgmPlayer.Play(); } }
//Stops any music currently playing public static void StopMusic() { if (musicPlayer != null) { musicPlayer.Stop(); musicPlayer.Dispose(); musicPlayer = null; } }
/// BGMの再生 public void PlayBgm(BgmId id, bool loop) { StopBgm(); bgmPlayer = bgmList[(int)id].CreatePlayer(); bgmPlayer.Loop = loop; bgmPlayer.Play(); bgmPlayer.Volume = 0.1f; }
public static void init() { if(sounds != null) return; bgm = new Bgm("/Application/assets/music/music.mp3"); bgmPlayer = bgm.CreatePlayer(); bgmPlayer.Loop = true; sounds = new Dictionary<string, SoundTuple>(); }
public virtual int StopMusic() { if (_musicPlayer != null) { _musicPlayer.Stop(); _musicPlayer.Dispose(); _musicPlayer = null; _music = null; } return(0); }
public void Dispose() { lock (LOADED_MUSICS) { LOADED_MUSICS.Remove(this); } this.backgroundMusic.Dispose(); this.player.Dispose(); this.backgroundMusic = null; this.player = null; }
/// BGMの停止 public void StopBgm() { if (bgmPlayer != null) { if (bgmPlayer.Status == BgmStatus.Playing) { bgmPlayer.Stop(); } bgmPlayer.Dispose(); } bgmPlayer = null; }
private void BgmInitialize(object sender, EventArgs e) { bgmIndex = 0; isBgmMute = false; string[] bgmFiles = Directory.GetFiles("bgm", "*.mp3"); if (bgmFiles.Length > 0) { BgmPlayer.Source = new Uri(bgmFiles[bgmIndex], UriKind.RelativeOrAbsolute); BgmPlayer.Play(); } }
public AudioManager() { System.Diagnostics.Debug.WriteLine("Audio manager constructor"); _titleSong = new Bgm("/Application/audio/titlesong.mp3"); _mainSong = new Bgm("/Application/audio/wikistep.mp3"); if(_songPlayer != null) { _songPlayer.Dispose(); } _songPlayer = _titleSong.CreatePlayer(); _songPlayer.Loop = true; _songPlayer.Play (); }
public override void OnEnter() { BaseScene.SetUpScene(this, "assets/backdrop/dungeon-colour.png", ref sprite, 550f, new Vector2(0, 0), new Vector2i(1, 1)); music = new Bgm("assets/Music/creepyloop.mp3"); player = music.CreatePlayer(); player.Play(); base.OnEnter(); }
void Start() { if (instance == null) { instance = this; DontDestroyOnLoad(gameObject); } else if (instance != this || SceneManager.GetActiveScene().buildIndex == 0) { Destroy(gameObject); } DontDestroyOnLoad(this); }
public static void Dispose() { if (_bgmPlayer != null) { _bgmPlayer.Dispose(); _bgmPlayer = null; } if (_soundPlayer != null) { _soundPlayer.Dispose(); _soundPlayer = null; } }
public override void OnEnter() { BaseScene.SetUpScene(this, "assets/backdrop/good town.png", ref sprite, 550f, new Vector2(0, 0), new Vector2i(1, 1)); music = new Bgm("assets/Music/sappypianointerlude.mp3"); player = music.CreatePlayer(); player.Play(); base.OnEnter(); }
internal void Play() { if (_currentSong != this) //If needed switch up the current song { if (_bgmPlayer != null) { _bgmPlayer.Stop(); _bgmPlayer.Dispose(); } _bgmPlayer = _bgm.CreatePlayer(); _currentSong = this; } _bgmPlayer.Play(); }
//Background Music private static void MusicPlay(string music) { try { bgmp.Dispose(); } catch {} Bgm bgm = new Bgm(music); bgmp = bgm.CreatePlayer(); bgmp.Loop = true; bgmp.Play(); }
public void changeSong(bool playMainSong) { if(playMainSong) { if(_songPlayer != null) { _songPlayer.Dispose(); } _songPlayer = _mainSong.CreatePlayer(); } else { if(_songPlayer != null) { _songPlayer.Dispose(); } _songPlayer = _titleSong.CreatePlayer(); } _songPlayer.Play (); }
public override void OnEnter() { BaseScene.SetUpScene(this, "assets/Test/Black.png", ref sprite, 16f, new Vector2(0, 0), this.Camera2D.CalcBounds().Size, new Vector2i(1, 1)); music = new Bgm("assets/Music/dirgeloop.mp3"); player = music.CreatePlayer(); player.Play(); this.RegisterDisposeOnExitRecursive(); base.OnEnter(); }
public override void OnEnter() { BaseScene.SetUpScene(this, "assets/backdrop/fortress-01.png", ref sprite, 550f, new Vector2(0, 0), new Vector2i(1, 1)); music = new Bgm("assets/Music/dirgeloop.mp3"); player = music.CreatePlayer(); player.Play(); base.OnEnter(); }
public FireNode() { fireBgm = new Bgm ("/Application/Assets/sound/fire.mp3"); fireBgmPlayer = fireBgm.CreatePlayer(); this.RegisterDisposeOnExit (fireBgm); this.RegisterDisposeOnExit (fireBgmPlayer); fireBgmPlayer.Loop = true; fireBgmPlayer.Play (); generateFirewallSprite (); generateSprite(spriteWidth, 0); AddChild(sprite); ScheduleUpdate(); }
public EndScene() { _waitTimer = new Timer(); ScheduleUpdate(); _sceneCamera = (Camera2D)Camera; Vector2 ideal_screen_size = new Vector2(960.0f, 544.0f); _sceneCamera.SetViewFromHeightAndCenter(ideal_screen_size.Y, ideal_screen_size / 2.0f); _groundLayer = new Layer(_sceneCamera); Animations = new Dictionary<string, Animation>(); var texInfo = new TextureInfo(AssetManager.GetTexture("catanimation"), new Vector2i(5,1),TRS.Quad0_1); _currentAnimation = new Animation(0, 5, 0.1f, false); _currentAnimation.Play(); _cat = new SpriteTile(texInfo); _cat.TileIndex1D = _currentAnimation.CurrentFrame; _cat.Quad.S = new Vector2(258, 214); _cat.CenterSprite(); _cat.Position = new Vector2(_sceneCamera.CalcBounds().Point00.X, _sceneCamera.CalcBounds().Point00.Y + _cat.TextureInfo.TextureSizef.Y/2 +64 ); var background = new SpriteTile(new TextureInfo(AssetManager.GetTexture("background_paper"))); background.Quad.S = background.TextureInfo.TextureSizef; background.CenterSprite(); background.Position = _sceneCamera.CalcBounds().Center; for(var i = 0; i < 5; i++) { var _sprite = new GroundTile(new TextureInfo(AssetManager.GetTexture("ground_tile"))); _groundLayer.AddChild(_sprite); _sprite.Quad.S = _sprite.TextureInfo.TextureSizef; _sprite.Position = new Vector2(_sceneCamera.CalcBounds().Point00.X + i * _sprite.TextureInfo.TextureSizef.X, _sceneCamera.CalcBounds().Point00.Y - _sprite.TextureInfo.TextureSizef.Y / 2); } _musicPlayer = AssetManager.GetBGM("endscreen").CreatePlayer(); _musicPlayer.Play(); AddChild(background); AddChild (_cat); AddChild (_groundLayer); }
public TitleScene() { ScheduleUpdate(); _nextSequence = false; _sleepTimer = new Timer(); _sceneCamera = (Camera2D)Camera; Vector2 ideal_screen_size = new Vector2(960.0f, 544.0f); _titleBackground = new SpriteTile(new TextureInfo(AssetManager.GetTexture("titlescreen"))); _titleBackground.Quad.S = _titleBackground.TextureInfo.TextureSizef; _titleBackground.CenterSprite(); _sceneCamera.SetViewFromHeightAndCenter(ideal_screen_size.Y, ideal_screen_size / 2.0f); var kid = new SpriteTile(new TextureInfo(AssetManager.GetTexture("kid"))); kid.Quad.S = kid.TextureInfo.TextureSizef; kid.CenterSprite(); kid.Position = _sceneCamera.CalcBounds().Center; _musicPlayer = AssetManager.GetBGM("title").CreatePlayer(); _musicPlayer.Play(); _titleBackground.Position = _sceneCamera.CalcBounds().Center; AddChild(kid); AddChild(_titleBackground); }
/// <summary> /// Sets the bgm. /// BGMをPlayerにセットする。 /// BGMプレイヤーは同時に2つ以上存在できない /// </summary> /// <param name='bgmStr'> /// Bgm string. /// </param> public static void SetBgm(String bgmStr) { //BGMの初期化。 EndBgm(); Bgm = new Bgm(bgmStr); BgmPlayer = Bgm.CreatePlayer(); Bgm.Dispose(); Bgm=null; BgmPlayer.Loop = true; BgmOn = true; SetBgmMute(); }
/// BGMの再生 public void PlayBgm( BgmId id, bool loop ) { StopBgm(); bgmPlayer = bgmList[(int)id].CreatePlayer(); bgmPlayer.Loop = loop; bgmPlayer.Play(); bgmPlayer.Volume = 0.1f; }
/// BGMの停止 public void StopBgm() { if( bgmPlayer != null ){ if( bgmPlayer.Status == BgmStatus.Playing ){ bgmPlayer.Stop(); } bgmPlayer.Dispose(); } bgmPlayer = null; }
/// public メソッド ///--------------------------------------------------------------------------- /// 初期化 public bool Init() { bgmList = new Bgm[(int)BgmId.Max]; bgmList[(int)BgmId.Main] = new Bgm("/Application/res/data/Sound/bgm.mp3"); bgmList[(int)BgmId.Clear] = new Bgm("/Application/res/data/Sound/jingle_clear.mp3"); bgmList[(int)BgmId.Gameover] = new Bgm("/Application/res/data/Sound/jingle_gameover.mp3"); seList = new Sound[(int)SeId.Max]; seList[(int)SeId.Anous] = new Sound("/Application/res/data/Sound/Anous.wav"); seList[(int)SeId.Eat] = new Sound("/Application/res/data/Sound/eatSound.wav"); seList[(int)SeId.MakeTower1] = new Sound("/Application/res/data/Sound/glowTower.wav"); seList[(int)SeId.MakeTower2] = new Sound("/Application/res/data/Sound/glowTower2.wav"); seList[(int)SeId.MakeMo] = new Sound("/Application/res/data/Sound/MakeMonument.wav"); seList[(int)SeId.CharVo1] = new Sound("/Application/res/data/Sound/CharVo.wav"); seList[(int)SeId.CharVo2] = new Sound("/Application/res/data/Sound/CharVo2.wav"); seList[(int)SeId.CharVo3] = new Sound("/Application/res/data/Sound/CharVo3.wav"); seList[(int)SeId.ZonbiVo3] = new Sound("/Application/res/data/Sound/ZonbiVoice.wav"); seList[(int)SeId.PlDamage] = new Sound("/Application/res/data/Sound/player_damage.wav"); seList[(int)SeId.PlFoot] = new Sound("/Application/res/data/Sound/TitanWalk.wav"); seList[(int)SeId.ObjBreak] = new Sound("/Application/res/data/Sound/obj_break.wav"); sePlayer = new SoundPlayer[(int)SeId.Max]; for( int i=0; i<(int)SeId.Max; i++ ){ sePlayer[i] = seList[i].CreatePlayer(); } bgmPlayer = null; return true; }
public GamePlayScene() { this.ScheduleUpdate (); _garnishTimer = new Timer(); _groundTimer = new Timer(); _waterLevel = 272; _groundLevel = 120; _random = new Random(); _garnishDelay = _random.Next(0,5); Vector2 ideal_screen_size = new Vector2(960.0f, 544.0f); SceneCamera = (Camera2D)Camera; SceneCamera.SetViewFromHeightAndCenter(ideal_screen_size.Y, ideal_screen_size / 2.0f); _groundGarnish = new Layer(SceneCamera); _mainLayer = new Layer(SceneCamera); _playerCreature = new PlayerCreature (); _playerCreature.sprite.Position = Camera.CalcBounds ().Center; _mainLayer.AddChild (_playerCreature.sprite); _backgroundLayer = new Layer(SceneCamera, 0, 0); var background = new SpriteTile(new TextureInfo(AssetManager.GetTexture("background_paper"))); _backgroundLayer.AddChild(background); background.Quad.S = background.TextureInfo.TextureSizef; background.CenterSprite(); background.Position = SceneCamera.CalcBounds().Center; _water = new SpriteTile(new TextureInfo(AssetManager.GetTexture("water"))); _water.Quad.S = _water.TextureInfo.TextureSizef; _water.CenterSprite(); _water.Position = SceneCamera.CalcBounds().Center + new Vector2(0, -244); _waterTop = new WaterTile(new TextureInfo(AssetManager.GetTexture("waveline"))); _waterTop.Quad.S = _waterTop.TextureInfo.TextureSizef; _waterTop.CenterSprite(); _waterTop.Position = _water.Position + new Vector2(0 ,_water.TextureInfo.TextureSizef.Y /2 ); _waterTop.Position = SceneCamera.CalcBounds().Center + new Vector2(0, -244 + _water.TextureInfo.TextureSizef.Y/2f); _groundLayer = new Layer(SceneCamera, 1, 1); _groundGarnish = new Layer(SceneCamera, 1, 1); var texInfo = new TextureInfo(AssetManager.GetTexture ("ground_tile")); _ground = new SpriteList(texInfo); _sprite = new SpriteTile(texInfo); _ground.AddChild(_sprite); _sprite.Quad.S = texInfo.TextureSizef; _sprite.CenterSprite(); _sprite.TileIndex2D = new Vector2i(0,0); GenerateMap(); _enemies = new List<Enemy>(); _bullets = new List<Bullet>(); /* // enemy sprite test code var fish0 = new FishEnemy (new Vector2 (30.0f, 30.0f), _playerCreature); var fish1 = new FishEnemy (new Vector2 (15.0f, 15.0f), _playerCreature); var fish2 = new FishEnemy (new Vector2 (100.0f, 70.0f), _playerCreature); _enemies.Add (fish0); _enemies.Add (fish1); _enemies.Add (fish2); */ var dummyFish = new FishEnemy (new Vector2 (-25.0f, -25.0f), _playerCreature); dummyFish.sprite.UnscheduleAll(); _mainLayer.AddChild (FishEnemy.spriteList); var dummyBullet = new Bullet(new Vector2(-25.0f,-25.0f)); dummyBullet.sprite.UnscheduleAll(); //dummyBullet.sprite.Visible = false; _mainLayer.AddChild(Bullet.spriteList); _waterLayer = new Layer(SceneCamera); _waterLayer.AddChild(_water); _waterLayer.AddChild(_waterTop); _musicPlayer = AssetManager.GetBGM("gameplaymusic").CreatePlayer(); _musicPlayer.Loop = true; _musicPlayer.Play(); AddChild (_backgroundLayer); AddChild (_mainLayer); AddChild(_groundLayer); AddChild(_groundGarnish); AddChild(_waterLayer); _eventManager = new EventManager(_mainLayer,_playerCreature); }
/// <summary> /// 音乐淡入淡出管理器 /// </summary> public void MusicManager() { if(musicStatus == SoundComanndStatus.Play) { if(MusicList.Count == 1) { if(MusicPlayer == null) { CreatMusicPlayer(MusicList[0]); } else if(MusicPlayer.Status == BgmStatus.Playing && MusicPlayer.Volume < musicVolume) { if((MusicPlayer.Volume += musicVolume/(float)(musicSoundIn / 200)) <= musicVolume) { MusicPlayer.Volume += musicVolume/(float)(musicSoundIn / 200); } else MusicPlayer.Volume = musicVolume; } } else if(MusicList.Count >= 2) { musicStatus = SoundComanndStatus.Stop; } } else if(musicStatus == SoundComanndStatus.Stop) { if(MusicPlayer == null) { MusicList.RemoveAt(0); if(MusicList.Count == 1) { musicStatus = SoundComanndStatus.Play; } } else if(MusicPlayer.Status == BgmStatus.Playing && MusicPlayer.Volume>0) { if((MusicPlayer.Volume -= musicVolume/(float)(musicSoundOut / 200)) >= 0) { MusicPlayer.Volume -= musicVolume/(float)(musicSoundOut / 200); } else MusicPlayer.Volume = 0; } else if(MusicPlayer.Volume <= 0) { MusicPlayer.Stop(); MusicPlayer.Dispose(); MusicPlayer = null; MusicList.RemoveAt(0); if(MusicList.Count == 1) { musicStatus = SoundComanndStatus.Play; } } } }
public void AudioPlay() { bgm = new Bgm(OutputDir + "/" + fileName + ".mp3"); bgmPlayer = bgm.CreatePlayer(); bgmPlayer.Volume = 1.0F; bgmPlayer.Play(); }
public static void PlayStage1boss() { bgmPlayer.Dispose(); bgmPlayer = stage1boss.CreatePlayer(); bgmPlayer.Loop = true; bgmPlayer.Play(); }
public static void PlayTitle() { bgmPlayer.Dispose(); bgmPlayer = title.CreatePlayer(); bgmPlayer.Loop = true; bgmPlayer.Play(); }
/// <summary> /// Ends the bgm. /// </summary> private static void EndBgm() { if(BgmPlayer != null) { BgmPlayer.Dispose(); BgmPlayer = null; } }
public static void Initialize() { // Set up the graphics system graphics = new GraphicsContext (); // Background.cs initialization. background = new Background(graphics); // Fore ground foreground = new Foreground (graphics); // Create clock from System.Dianogstic clock = new Stopwatch(); clock.Start(); rand = new Random(); // rand.Next(-100, 230); this will perform random calculation. // Music. Bgm bgm = new Bgm("/Application/Resources/bgm.mp3"); // This will create a music based on the music file installed. bgmPlayer = bgm.CreatePlayer(); /* For this lines I experiencing problems is because * the sound file I manually import is not working well * with PSM sdk. It is there with some standard that will * that more time in configuring it. * **********************************************************/ Sound noise=new Sound("/Application/Resources/missile_shot.wav"); FireShots = noise.CreatePlayer(); Sound Explode=new Sound("/Application/Resources/explosion.wav"); Explosion = Explode.CreatePlayer(); /* Game start with game enumaration transition to states. * These lines below must be written after all of the initialization. * */ currentState = GameStates.Menu; // New games starts ^^ NewGame(); // Menu displays. Only once in initialize. Menus = new MenuDisplays(graphics); }
public static void Initialize() { clock = new Stopwatch(); clock.Start(); backgroundMusic = new Bgm("/Application/assets/music.mp3"); backgroundPlayer = backgroundMusic.CreatePlayer(); backgroundPlayer.Loop = true; backgroundPlayer.Play(); presentSound = new Sound("/Application/assets/jinglebell.wav"); presentSoundPlayer = presentSound.CreatePlayer(); isPlaying = true; // Set up the graphics system graphics = new GraphicsContext (); gen= new Random(); NewGame(0); currentGameState = GameState.Menu; menuDisplay = new MenuDisplay(graphics); }
// 初期化 public void Initialize() { // GameEngine2D 画面クリアー色の設定 Director.Instance.GL.Context.SetClearColor (Colors.Grey20); // 画面解像度情報 // ScreenSize = new Vector2i (854, 480); ScreenSize = new Vector2i (960, 544); // 効果音の設定 var soundObj = new Sound ("/Application/assets/se.wav"); Sound = soundObj.CreatePlayer (); // BGMの設定 bgm = new Bgm ("/Application/assets/bgm.mp3"); player = bgm.CreatePlayer (); player.Loop = true; // リピート再生する // BGMの再生 player.Play (); // シーン生成(ノードのルートになる) var scene = new Sce.PlayStation.HighLevel.GameEngine2D.Scene (); // 2Dゲーム向けにカメラを設定 scene.Camera.SetViewFromViewport (); // GameEngine2Dを実行 Director.Instance.RunWithScene (scene, true); Pause = false; World = new Node (); // Interface = new Node (); // シーンにWorldを追加する scene.AddChild (World); // シーンにInterface(UIで利用する)を追加する // scene.AddChild (Interface); // 背景登録 for (int y = 0; y < 7; y++) { for (int x = 0; x < 6; x++) { var backGround = new BackGround (new Vector2 (x * 192, y * 128)); World.AddChild (backGround); } } // 自機(プレイヤー)登録 Player = new Player (new Vector2 (Game.Instance.ScreenSize.X/2, 100)); World.AddChild (Player); // 敵機(ボス)登録 Boss = new Boss (new Vector2 (Game.Instance.ScreenSize.X/2, 250)); World.AddChild (Boss); // UI登録 UI = new UI (); //Interface.AddChild (UI); scene.AddChild (UI); // 当たり判定処理の生成 HitTest = new HitTest (); // 登録キュー AddQueue = new List<GameEntity> (); // 削除キュー RemoveQueue = new List<GameEntity> (); }
private void setBackgroundMusic() { this.titleSong = new Bgm(backgroundMusicPath); if(this.titleSongPlayer != null) { this.titleSongPlayer.Dispose (); } this.titleSongPlayer = this.titleSong.CreatePlayer(); }