예제 #1
0
        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();
        }
예제 #2
0
        protected override IEnumerator OnDeath(Object killer)
        {
            yield return(base.OnDeath(killer));

            StartCoroutine(Bgm.Stop(0.5f));
            Sfx.Play(DeathSfxId);
            ChangeSprite("entity.player.drown");
            var targetY = transform.position.y + 300;


            charaGravityScale = 0;

            UpdateUI();

            for (int y = (int)transform.position.y; y < targetY; y += 4)
            {
                transform.Rotate(Vector3.forward * 180 * Time.deltaTime);
                transform.position = new Vector3(transform.position.x, y, transform.position.z);

                yield return(null);
            }
            yield return(new WaitForSeconds(2.5f));

            Wyte.Initalize();
        }
예제 #3
0
 public static void PlayBGM(Bgm bgm)
 {
     //StopBGM();//BGMとSEは基本的に分けておく
     instance.audioSource.clip = instance.bgmList[(int)bgm];
     //リストのbgmを、audioSourceに持ってくる
     instance.audioSource.Play();//BGMを流す
 }
예제 #4
0
        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();
        }
예제 #5
0
        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);
        }
예제 #6
0
 public MainWindow()
 {
     // Creates the window.
     InitializeComponent();
     // Plays the background music when the window is launched.
     Bgm.Play();
 }
예제 #7
0
 /// <summary>
 /// 建立音乐播放器
 /// </summary>
 public void CreatMusicPlayer(Bgm music)
 {
     MusicPlayer        = music.CreatePlayer();
     MusicPlayer.Volume = 0;
     MusicPlayer.Loop   = musicLoop;
     MusicPlayer.Play();
 }
예제 #8
0
        //Resets the game in order to make a fresh, new game
        public static void NewGame()
        {
            //Disposes of menu music, and plays game music
            bgmplay.Dispose();
            Bgm bgm2 = new Bgm("/Application/Sounds/RomanticFall.mp3");

            bgmplay2      = bgm2.CreatePlayer();
            bgmplay2.Loop = true;
            bgmplay2.Play();
            background       = new Background(graphics, backTex);
            backplanets      = new BackgroundPlanets(graphics);
            enemyTimeCounter = 0;
            weapons          = new List <Weapon> ();
            enemies          = new List <Enemy> ();
            pickups          = new List <Pickup> ();
            ebullets         = new List <EnemyBullet> ();
            p             = new Player(graphics, 100, 100, pTex);
            counter       = -1;
            currentWeapon = GameWeapons.Missles;
            enemyCounter  = enemies.Count;
            timeDelta     = 0;
            hasLaser      = false;
            hasMissle     = true;
            hasSpread     = false;
            p1            = new Pickup(graphics, powTex, gen.Next(100, 700), gen.Next(100, 500));
            pickups.Add(p1);
            p2 = new Pickup(graphics, powTex, gen.Next(100, 700), gen.Next(100, 500));
            pickups.Add(p2);
            spreadNext   = false;
            laserNext    = false;
            playerScore  = 0;
            enterName    = "";
            newHighScore = false;
        }
        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();
        }
예제 #10
0
        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();
        }
예제 #11
0
        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();
        }
예제 #12
0
    /// <summary>
    /// 解析XML
    /// </summary>
    private void AnalysisXml()
    {
        XmlDocument document = new XmlDocument();                 //实例化一个xml文档

        document.Load(Application.dataPath + "/Data/Dialog.xml"); //加载 XML 内容
        XmlElement rootEle = document.LastChild as XmlElement;    //根节点

        foreach (XmlElement ele in rootEle.ChildNodes)            //遍历根节点的所有子节点
        {
            if (ele.Name == "bgm")                                //如果元素的名字是XML文档中的节点"bgm"
            {
                Bgm bgm = new Bgm();
                bgm.AllType = CommandType.Bgm;
                bgm.Name    = ele.InnerText;
                Commands.Add(bgm);                 //添加到命令数组 Commands 中
            }
            else if (ele.Name == "bg")
            {
                Bg bg = new Bg();
                bg.AllType = CommandType.Bg;
                bg.Name    = ele.InnerText;
                Commands.Add(bg);
            }
            else if (ele.Name == "say")
            {
                Say say = new Say();
                say.AllType = CommandType.Say;
                say.Name    = ele.ChildNodes[0].InnerText;
                say.Image   = ele.ChildNodes[1].InnerText;
                say.Sound   = ele.ChildNodes[2].InnerText;
                say.Content = ele.ChildNodes[3].InnerText;
                Commands.Add(say);
            }
        }
    }
예제 #13
0
 //Add music to musicList
 public static void AddMusic(string filename, string key)
 {
     if (!musicList.ContainsKey(key))
     {
         Bgm music = new Bgm(filename);
         musicList.Add(key, music);
     }
 }
예제 #14
0
 public bool SetBgm(TrackName name)
 {
     if (bgm == null || bgm.name != name)
     {
         bgm = new Bgm(name); bgm.Attach(gameObject); return(true);
     }
     return(false);
 }
예제 #15
0
 public MainScene()
 {
     InitializeWidget();
     InitializeButtonEvents();
     bgm = new Bgm("/Application/assets/GAME_BGM_01.mp3");
     bp = bgm.CreatePlayer();
     bp.Loop = true;
 }
예제 #16
0
        /// <summary>
        /// 播放音乐
        /// </summary>
        /// <param name='name'>
        /// 音乐名称
        /// </param>
        public void MusicPlay(string name, float volume, bool loop)
        {
            var music = new Bgm(MusicPath + name);

            musicLoop   = loop;
            musicVolume = volume;
            MusicList.Add(music);
            musicStatus = SoundComanndStatus.Play;
        }
예제 #17
0
        public BackgroundMusic(String resource)
        {
            lock (LOADED_MUSICS) {
                LOADED_MUSICS.Add(this);
            }

            this.backgroundMusic = new Bgm(resource);
            this.player          = this.backgroundMusic.CreatePlayer();
        }
예제 #18
0
    public void BgmApply(Bgm key)
    {
        Sound     sound = bgmDIctionary[key];
        AudioClip audio = sound.audioClip;

        bgmAudioSource.volume = sound.audioSize;
        bgmAudioSource.clip   = audio;
        bgmAudioSource.Play();
    }
예제 #19
0
 void Awake()
 {
     if (instance != null && instance != this) {
         Destroy(this.gameObject); return;
     } else {
         instance = this;
     }
     DontDestroyOnLoad(this.gameObject);
 }
예제 #20
0
 public override void OnExit()
 {
     base.OnExit();
     this.titleSongPlayer.Stop();
     this.titleSongPlayer.Dispose();
     this.titleSongPlayer = null;
     this.titleSong.Dispose();
     this.titleSong = null;
 }
예제 #21
0
 public BgmModel(Bgm bgm)
 {
     Item   = bgm;
     Loops  = new ObservableCollection <BgmLoop>(Item.Loops ?? new List <BgmLoop>());
     Starts = new ObservableCollection <BgmStart>(Item.Starts ?? new List <BgmStart>()
     {
         new BgmStart()
     });
 }
예제 #22
0
        private void PlatformInitialize(string fileName)
        {
            // PSM can only load MP3 files, but XNA XNBs use always WMA.
            if (fileName != null && Path.GetExtension(fileName).ToLower() == ".wma")
            {
                fileName = Path.ChangeExtension(fileName, "mp3");
            }

            _bgm = new Bgm(fileName);
        }
예제 #23
0
 private void Awake()
 {
     if (Instance != null)
     {
         Destroy(gameObject);
         return;
     }
     Instance = this;
     DontDestroyOnLoad(gameObject);
 }
예제 #24
0
        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>();
        }
예제 #25
0
 public virtual int StopMusic()
 {
     if (_musicPlayer != null)
     {
         _musicPlayer.Stop();
         _musicPlayer.Dispose();
         _musicPlayer = null;
         _music       = null;
     }
     return(0);
 }
예제 #26
0
        public void Dispose()
        {
            lock (LOADED_MUSICS) {
                LOADED_MUSICS.Remove(this);
            }

            this.backgroundMusic.Dispose();
            this.player.Dispose();

            this.backgroundMusic = null;
            this.player          = null;
        }
예제 #27
0
        private void BtnClosePlay_Click(object sender, EventArgs e)
        {
            countClose++;

            if ((countClose % 2) != 0)
            {
                Bgm.Close();
            }
            else
            {
                Bgm.Play();
            }
        }
예제 #28
0
        private void BtnBgmPause_Click(object sender, EventArgs e)
        {
            countPause++;

            if ((countPause % 2) != 0)
            {
                Bgm.Pause();
            }
            else
            {
                Bgm.Play();
            }
        }
예제 #29
0
        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();
        }
예제 #30
0
        public void Play(string name)
        {
            StopAll();

            var music  = new Bgm(AssetsPrefix + name);
            var player = music.CreatePlayer();

            MusicDatabase [name] = player;

            MusicDatabase [name].Play();
            MusicDatabase [name].Loop   = true;
            MusicDatabase [name].Volume = 0.5f;
        }
예제 #31
0
    //ループギミックの音
    public void GimmckSoundBgmPlay(Bgm str, out AudioSource audio)
    {
        string path = BGM_PATH + File(str.ToString());

        clip = Resources.Load <AudioClip>(path);

        GameObject go = Instantiate(Resources.Load <GameObject>("GameObject/AudioChild"));

        go.transform.parent = transform;
        audio      = go.GetComponent <AudioSource>();
        audio.loop = true;
        audio.clip = clip;
    }
예제 #32
0
        public void StartMusic(Bgm bgm, bool loop)
        {
            if (bgm == this.current)
            {
                return;
            }

            var decoder = this.ReadData(DoomApplication.Instance.FileSystem.Read("D_" + DoomInfo.BgmNames[(int)bgm]), loop);

            this.stream.SetDecoder(decoder);

            this.current = bgm;
        }
예제 #33
0
        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 ();
        }
예제 #34
0
        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();
        }
예제 #35
0
    private void OnGUI()
    {
        FinalScore finalScore = FindObjectOfType <FinalScore>();

        if (finalScore == null || finalScore.isGameOver)
        {
            return;
        }

        foreach (FloatingScore floatingScore in floatingScores)
        {
            Vector3 screenPoint = Camera.main.WorldToScreenPoint(new Vector2(floatingScore.pos.x, -floatingScore.pos.y));
            Color   textColor   = new Color(1.0f, 0.9f, 0.3f);
            int     fontHeight  = Mathf.RoundToInt(Mathf.Lerp(60.0f, 100.0f, Mathf.Clamp01((floatingScore.score - 10.0f) / 60.0f)));
            Bgm.shadedText(new Rect(screenPoint.x - 500.0f, screenPoint.y - 50.0f, 1000.0f, 100.0f), "" + floatingScore.score + "€", fontHeight, textColor);
        }

        {
            GUIStyle style = GUIStyle.none;
            style.normal.textColor = new Color(1.0f, 1.0f, 0.5f, 0.8f);
            style.fontStyle        = FontStyle.Bold;
            style.fontSize         = 45;
            style.fontSize         = scaleFont(style.fontSize);
            style.alignment        = TextAnchor.MiddleCenter;

            Rect pixelRect = Camera.main.pixelRect;
            Rect iconRect  = pixelRect;
            iconRect.height *= 0.1f;
            iconRect.width   = iconRect.height;
            iconRect.x       = pixelRect.width * 0.5f - iconRect.width;
            iconRect.y      += pixelRect.height * 0.02f;
            GUI.DrawTexture(iconRect, moneyTexture);

            Rect textRect = iconRect;
            textRect.y -= iconRect.height * 0.02f;
            Bgm.shadedText(textRect, "" + money, 45, style.normal.textColor);

            style.normal.textColor = new Color(0.0f, 0.0f, 0.0f, 0.5f);
            iconRect.x            += iconRect.width;
            GUI.DrawTexture(iconRect, filmTexture);

            style.fontSize = 60;
            style.fontSize = scaleFont(style.fontSize);

            textRect    = iconRect;
            textRect.y -= iconRect.height * 0.02f;
            textRect.x -= iconRect.height * 0.01f;
            GUI.Label(textRect, "" + filmLeft, style);
        }
    }
예제 #36
0
        //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();
        }
예제 #37
0
파일: Bgm.cs 프로젝트: Iilun/IC06
    private void Awake()
    {
        if (instance != null && instance != this)
        {
            Destroy(this.gameObject);
            return;
        }
        else
        {
            instance = this;
        }

        DontDestroyOnLoad(this.gameObject);
    }
예제 #38
0
    void Awake()
    {
        if(current != null)
        {
            Destroy(this.gameObject);
        }
        else
        {
            current = this;
        }
        DontDestroyOnLoad(this);

        src = GetComponent<AudioSource>();
    }
예제 #39
0
        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();
        }
예제 #40
0
 /// <summary>
 /// 播放音乐
 /// </summary>
 /// <param name='name'>
 /// 音乐名称
 /// </param>
 public void MusicPlay(string name,float volume,bool loop)
 {
     var music = new Bgm(MusicPath + name);
     musicLoop = loop;
     musicVolume = volume;
     MusicList.Add(music);
     musicStatus = SoundComanndStatus.Play;
 }
예제 #41
0
 /// <summary>
 /// 建立音乐播放器
 /// </summary>
 public void CreatMusicPlayer(Bgm music)
 {
     MusicPlayer = music.CreatePlayer();
     MusicPlayer.Volume = 0;
     MusicPlayer.Loop = musicLoop;
     MusicPlayer.Play();
 }
예제 #42
0
 public void AudioPlay()
 {
     bgm = new Bgm(OutputDir + "/" + fileName + ".mp3");
     bgmPlayer = bgm.CreatePlayer();
     bgmPlayer.Volume = 1.0F;
     bgmPlayer.Play();
 }
예제 #43
0
        // 初期化
        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> ();
        }
예제 #44
0
        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);
        }
예제 #45
0
 internal PSSuiteSong(string fileName)
 {
     _bgm = new Bgm(fileName);
 }
예제 #46
0
            public void Play(string name)
            {
                StopAll();

                using (var music = new Bgm(AssetsPrefix + name) )
                {
                    var player = music.CreatePlayer();
                    MusicDatabase[name] = player;
                    MusicDatabase[name].Play();
                    MusicDatabase[name].Loop = true;
                    MusicDatabase[name].Volume = 0.5f;
                }
            }
예제 #47
0
파일: AppMain.cs 프로젝트: skyvalve/Nebilu
        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);
        }
예제 #48
0
 private void setBackgroundMusic()
 {
     this.titleSong = new Bgm(backgroundMusicPath);
     if(this.titleSongPlayer != null)
     {
         this.titleSongPlayer.Dispose ();
     }
         this.titleSongPlayer = this.titleSong.CreatePlayer();
 }
예제 #49
0
        public void setup()
        {
            Camera.SetViewFromViewport();

              Bgm bgm = new Bgm("/Application/assets/sounds/KIDSFUN.mp3");
              BgmPlayer bgmPlayer = bgm.CreatePlayer();
              bgmPlayer.Loop = true;
              bgmPlayer.Play();

              isRaining = false;
              itime = 0;
              rain = new List<SpriteTile>();

              var bg = Support.TiledSpriteFromFile("/Application/assets/Background_Object.png", 1, 1);
              bg.Position = new Vector2((Camera.CalcBounds().Max.X)/2,(Camera.CalcBounds().Max.Y)/2);
              bg.CenterSprite();
              bg.VertexZ = 0;
              this.AddChild(bg,0);

              rng = new Random();

              player = new Player(new Vector2(40,10));
              AddChild(player.sprite);
              Collider.Instance.add(player);

              var fencefront = Support.TiledSpriteFromFile("/Application/assets/Fence_Front.png", 1, 1);
              fencefront.Position = new Vector2((Camera.CalcBounds().Max.X)/2,(Camera.CalcBounds().Min.Y+50)/2);
              fencefront.CenterSprite();
              fencefront.VertexZ = 1;
              this.AddChild(fencefront,0);
              Console.WriteLine(fencefront.Position);

              var goal = new WinSection(new Vector2(Camera.CalcBounds().Max.X-100,Camera.CalcBounds().Max.Y-100));

              Collider.Instance.add(goal);
              goal.startNewGoal();

              var trash = new TrashCan(new Vector2(GameScene.Instance.Camera.CalcBounds().Min.X+90,GameScene.Instance.Camera.CalcBounds().Max.Y-100));
              GameScene.Instance.AddChild(trash.sprite);
              Collider.Instance.add(trash);
        }
예제 #50
0
        /// <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();
        }
예제 #51
0
 public bool SetBgm(TrackName name)
 {
     if (bgm == null || bgm.name != name) { bgm = new Bgm(name); bgm.Attach(gameObject); return true; }
     return false;
 }