⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 itemsqueue.cs

📁 本游戏是微软SMART PHONE平台下的手机游戏
💻 CS
字号:
using System;

namespace DiamondPet.LogicLayer.GameStateRunLogic
{
	/// <summary>
	/// ItemsQueue 的摘要说明。
	/// </summary>
	public class ItemsQueue : GameQueue
	{
		/// <summary>
		/// 游戏方块,将被送入队列中
		/// </summary>
		public GameObject[] GameItems;
        
		/// <summary>
		/// 
		/// </summary>
		private Random random;

		public ItemsQueue()
		{}

		public ItemsQueue(int lenth) : base(lenth)
		{
			GameItems = new GameItems[3];

			random = new Random(System.Environment.TickCount);
		}

		/// <summary>
		/// 产生新模块并加入队列
		/// </summary>
		/// <param name="NewBlockNumber"></param>
		public void ProduceBlockAddQueue(int NewBlockNumber)
		{
			for(int i = 0;i < NewBlockNumber;++i)
			{
				//得到新模块
				NewBlock();
				//加入队列
				this.AddElement(GameItems);
			}
		}

		/// <summary>
		/// 随机出新的模块
		/// </summary>
		private void NewBlock()
		{
			int i;
			//得到的块的数量
			int BlockNumber = this.random.Next(1,3);
			int tempPicNum; 

			for(i = 0;i < BlockNumber;++i)
			{
				tempPicNum = this.random.Next(GameConstResource.PetBlockStartIndex,GameConstResource.PropertyBlockEndIndex);
				GameItems[i] = new GameObject(tempPicNum);
			}

			for(int j = i;j < 3;++j)
			{
				GameItems[j] = null;
			}
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -