当前位置: 首页>>代码示例>>C#>>正文


C# MusicPlayer.Play方法代码示例

本文整理汇总了C#中MusicPlayer.Play方法的典型用法代码示例。如果您正苦于以下问题:C# MusicPlayer.Play方法的具体用法?C# MusicPlayer.Play怎么用?C# MusicPlayer.Play使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MusicPlayer的用法示例。


在下文中一共展示了MusicPlayer.Play方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnMouseDown

	void OnMouseDown()
	{
		GameObject audio = GameObject.Find ("audio(Clone)");
		music = (MusicPlayer)audio.GetComponent (typeof(MusicPlayer));
		if (isplay == true) 
		{
			music.Stop ();
			isplay = false;
		}
		else
		{
			music.Play();
			isplay = true;
		}

	}
开发者ID:weirwood,项目名称:maze-storm,代码行数:16,代码来源:musiccontroller.cs

示例2: Start

  void Start()
  {
    var start = System.DateTime.UtcNow;

    GameStatus.Level = GameStatus.LevelsCompleted;
    GameStatus.Root = this;
    GameStatus.RitualPointsRemaining = Level1RitualPointCount + RitualPointIncreasePerLevel * GameStatus.Level;
    GameStatus.TileSetIndex = GameStatus.Level % TileSets.Length;

    var size = Level1Size + SizeIncreasePerLevel * GameStatus.Level;
    Tiles = new Tile[size, size];
    var numPickups = Mathf.RoundToInt(Random.Range(GameStatus.RitualPointsRemaining * 0.33f, GameStatus.RitualPointsRemaining * 0.66f));
    var tileSet = TileSets[GameStatus.TileSetIndex];

    // Map generation: Place the outermost wall, obstacles, and passable ground.
    for (int x = 0; x < size; x++)
    {
      for (int y = 0; y < size; y++)
      {
        if (ShouldPlaceOuterWall(x, y, size))
        {
          Tiles[x, y] = MakeOuterWall(x, y, tileSet);
        }
        else if (ShouldPlaceObstacle(x, y, size, CorridorWidth))
        {
          Tiles[x, y] = MakeObstacle(x, y, tileSet);
        }
        else
        {
          Tiles[x, y] = MakeGroundTile(x, y, tileSet, Random.value < FractionOfDecoratedTiles);
        }
      }
    }

    // Map generation: Place ritual points at random coordinates which are clear in all four directions.
    for (int i = 0; i < GameStatus.RitualPointsRemaining; i++)
    {
      GetRandomClearTile(size, ClearTilesNearCenter, Tiles).AddRitualPoint(RitualPointAnimation);
    }

    // Map generation: Place pickups at random coordinates which are clear in all four directions.
    for (int i = 0; i < numPickups; i++)
    {
      GetRandomClearTile(size, ClearTilesNearCenter, Tiles).AddPickup(Random.value < PercentageOfSuperCarrots ? SuperCarrot : Carrot);
    }

    // Place all tiles in a single container.
    var tilesRoot = new GameObject("Tiles");
    foreach (var tile in Tiles)
    {
      tile.transform.SetParent(tilesRoot.transform);
    }

    MusicPlayer = gameObject.AddComponent<MusicPlayer>();
    Player = ((GameObject)Instantiate(PlayerPrefab, new Vector3((size - 1) / 2, (size - 1) / 2, 0f), Quaternion.identity)).GetComponent<Player>();
    PlayerCamera = GameObject.Find("Camera").AddComponent<PlayerCamera>();
    SoundPlayer = gameObject.AddComponent<SoundPlayer>();

    MusicPlayer.Play(tileSet.Music);

    Debug.Log("Level Generation: " + (System.DateTime.UtcNow - start).TotalMilliseconds.ToString("N0") + "ms");
  }
开发者ID:chainsaw-bunnies,项目名称:elementail,代码行数:62,代码来源:Root.cs

示例3: LoadContent

        /// <summary>
        /// LoadContent will be called once per game and is the place to load 
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            songify = new MusicPlayer(Content);
            intro = new IntroScreen(Content, this);
            main = new ControlConsole(Content);
            activePage = intro;
            allPages = new List<IPage>();
            allPages.Add(intro);
            allPages.Add(main);

            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            spriteFont = Content.Load<SpriteFont>("whatEverIWant");//I added this
            songify.Play(0);
        }
开发者ID:Evangielis,项目名称:TheAssembler,代码行数:19,代码来源:Game1.cs

示例4: Start

 // Use this for initialization
 void Start()
 {
     _label = this.gameObject.GetComponent<UILabel>();
     _musicPlayer = new MusicPlayer(this.gameObject.audio);
     _musicPlayer.Play();
 }
开发者ID:novendraap,项目名称:beats2,代码行数:7,代码来源:MusicTimeScript.cs


注:本文中的MusicPlayer.Play方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。