• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Maze类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Maze的典型用法代码示例。如果您正苦于以下问题:C# Maze类的具体用法?C# Maze怎么用?C# Maze使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Maze类属于命名空间,在下文中一共展示了Maze类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: MazePrototypeFactory

 public MazePrototypeFactory(Maze maze, Room room, Door door, Wall wall)
 {
     this.prototypeMaze = maze;
     this.prototypeRoom = room;
     this.prototypeDoor = door;
     this.prototypeWall = wall;
 }
开发者ID:TheoAndersen,项目名称:GoF.CreationalPatterns,代码行数:7,代码来源:MazePrototypeFactory.cs


示例2: Start

 // Use this for initialization
 void Start()
 {
     enragedGrowl = GetComponent<AudioSource>();
     maze = GameObject.Find("Maze").GetComponent<Maze>();
     player = GameObject.Find("Player");
     Orientate(col, row);
 }
开发者ID:eaho1,项目名称:Shut-Up-and-Escape-With-Me,代码行数:8,代码来源:Monster_Behavior.cs


示例3: Start

    // Use this for initialization
    void Start()
    {
        maze = new Maze (32, 32);
        maze.generate ();

        aTexture = maze.tiles;
    }
开发者ID:JoaoFranciscoNeto,项目名称:team_armadillo,代码行数:8,代码来源:MazeDebug.cs


示例4: Update

	// Update is called once per frame
	void Update () 
	{
		if(mGen == null)
			mGen = FindObjectOfType<MazeGenerator>();
		else if(m == null && mGen != null)
		{
			m = mGen.currentMaze();
			if(m != null)
			{
				Texture2D t = new Texture2D((int)m.Dimensions().x, (int)m.Dimensions().y, TextureFormat.ARGB4444, false);
				for(int x=0; x<t.width; x++)
				{
					for(int y=0; y<t.height; y++)
					{
						if(m.GetCell(x,y).isWall)
							t.SetPixel(x,y,Color.black);
						else
							t.SetPixel(x,y,Color.white);
					}
				}
				t.anisoLevel = 0;
				t.filterMode = FilterMode.Point;
				t.Apply();
				im.sprite = Sprite.Create(t, new Rect(0,0,t.width,t.height), Vector2.one/2);
			}
		}
	}
开发者ID:Blueteak,项目名称:MazeWar,代码行数:28,代码来源:MiniMap.cs


示例5: Start

    // Use this for initialization
    void Start()
    {
        m_TileList = new List<Transform> ();
        for (int x = 0; x < 8; x++) {
            for (int y = 0; y < 12; y++) {
                int flag = m_MapConfigArray [x, y];
                var tileTF = Instantiate (tile, new Vector3 (y * 0.3f, -x * 0.3f, 0), Quaternion.identity) as Transform;
                if (flag == 1) {
                    tileTF.GetComponent<SpriteRenderer> ().color = Color.red;
                }
                m_TileList.Add (tileTF);
            }
        }

        Maze maze = new Maze(m_MapConfigArray);
        Point start = new Point(1, 1);
        Point end = new Point(1, 10);

        //		Transform startTile = m_TileList [1 * 12 + 1];
        //		startTile.GetComponent<SpriteRenderer> ().color = Color.black;
        //
        //		Transform endTile = m_TileList [6 * 12 + 10];
        //		endTile.GetComponent<SpriteRenderer> ().color = Color.black;

        var parent = maze.FindPath(start, end, false);

        while (parent != null)
        {
            Debug.Log(parent.X + ", " + parent.Y);
            Transform targetTile = m_TileList [parent.X * 12 + parent.Y];
            targetTile.GetComponent<SpriteRenderer> ().color = Color.green;

            parent = parent.ParentPoint;
        }
    }
开发者ID:PlayApple,项目名称:2DTilemapStarterKit,代码行数:36,代码来源:Map.cs


示例6: Update

	void Update () 
	{
		if(mGen == null)
			mGen = FindObjectOfType<MazeGenerator>();
		else if(m == null)
		{
			m = mGen.currentMaze();
		}
		else if(pControl == null)
		{
			GameObject g = GameObject.FindGameObjectWithTag("MyPlayer");
			if(g != null)
				pControl = g.GetComponent<PlayerControl>();
		}
		else
		{
			pOffset = pixelOffset();
			cellDim = cellDimenstions();
			icon.rectTransform.sizeDelta = new Vector2(cellDimenstions().x, cellDimenstions().y);
			icon.transform.localEulerAngles = new Vector3(0,0,-pControl.transform.localEulerAngles.y + 90);
			Vector2 pPos = pControl.pos();
			float x = pixelOffset().x + (cellDimenstions().x*pPos.x) + (cellDimenstions().x/2);
			float y = pixelOffset().y + (cellDimenstions().y*pPos.y) + (cellDimenstions().x/2);
			Vector2 v = new Vector2(x,y);
			GetComponent<RectTransform>().anchoredPosition = v;
		}
	}
开发者ID:Blueteak,项目名称:MazeWar,代码行数:27,代码来源:PlayerIcon.cs


示例7: Update

	// Update is called once per frame
	void Update () 
	{
		if(m == null)
		{
			m = gen.currentMaze();
			RandomPlacement();
		}

		if(!setup && PlayerControl)
		{
			gameObject.tag = "MyPlayer";
			SpriteObj.SetActive(false);
			CamHolder.SetActive(true);
		}
		bool up = Input.GetKeyDown(KeyCode.UpArrow);
		bool down = Input.GetKeyDown(KeyCode.DownArrow);
		bool left = Input.GetKeyDown(KeyCode.LeftArrow);
		bool right = Input.GetKeyDown(KeyCode.RightArrow);
		if(!PlayerControl)
			return;
		if(up || down || left || right)
		{
			CmdDoMovement(up, down, left, right);
		}
		CheckSeen();

			
		if(Input.GetKeyDown(KeyCode.Space))
		{
			StopCoroutine("LineShow");
			StartCoroutine("LineShow");
			CmdShoot();
		}
	}
开发者ID:Blueteak,项目名称:MazeWar,代码行数:35,代码来源:SinglePlayerControl.cs


示例8: Start

	// Помещаем персонажа в центр лабиринта
	void Start() {
		var maze = GameObject.Find("Maze").GetComponent<Maze>();
		transform.position = new Vector2(maze.width / 2, maze.height / 2);
		dest = transform.position;

		mazeInstance = GameObject.Find("Maze").GetComponent<Maze>();
	}
开发者ID:ilyachase,项目名称:Limbo-Maze,代码行数:8,代码来源:Circle.cs


示例9: Neighbours

    public static List<Cell> Neighbours(Maze maze, Point point)
    {
        List<Cell> neighbours = new List<Cell>();

        if (point.y > 1)
        {
            neighbours.Add(maze.Grid[point.x, point.y-1]);
        }

        if (point.y < maze.height-2)
        {
            neighbours.Add(maze.Grid[point.x, point.y+1]);
        }

        if (point.x > 1)
        {
            neighbours.Add(maze.Grid[point.x-1, point.y]);
        }

        if (point.x < maze.width-2)
        {
            neighbours.Add(maze.Grid[point.x+1, point.y]);
        }

        return neighbours;
    }
开发者ID:Catchouli-old,项目名称:SuperShooterGuy3D,代码行数:26,代码来源:Maze.cs


示例10: afterFrame

	IEnumerator afterFrame()
	{
		yield return true;
		online = true;
		m = GameObject.FindObjectOfType<MazeGenerator>().currentMaze();
		wantPos = randomPos();
	}
开发者ID:Blueteak,项目名称:MazeWar,代码行数:7,代码来源:AIPlayer.cs


示例11: generateNewStage

    public void generateNewStage(GameObject floorTile,
		                         GameObject wallBlock,
	                             GameObject coin,
	                             GameObject player,
	                             GameObject targetSprite,
	                             GameObject door,
		                         int difficulty,
	                             int maxDifficulty)
    {
        // Grab prefabs from function call
        _floorTile = floorTile;
        _wallBlock = wallBlock;
        _coin = coin;
        _player = player;
        _targetSprite = Instantiate(targetSprite);
        _door = door;
        // Determine size and num coins for this stage
        determineParamsBasedOnDifficulty(difficulty, maxDifficulty);
        // Create our maze
        _maze = new Maze(_size, difficulty, maxDifficulty);
        _maze.generateMap();
        // Allocate our arrays
        _coins = new GameObject[_numCoins];
        _components = new GameObject[(int)_size.x,(int)_size.y];
        // Instantiate our prefabs
        placeComponentsFromMap();
    }
开发者ID:elsnehador,项目名称:Crust,代码行数:27,代码来源:Stage.cs


示例12: MazyPrototypeFactory

 public MazyPrototypeFactory(Maze maze, Wall wall, Room room, Door door)
 {
     _maze = maze;
     _wall = wall;
     _room = room;
     _door = door;
 }
开发者ID:trupak,项目名称:DesignPatternsViaC,代码行数:7,代码来源:MazyPrototypeFactory.cs


示例13: BeginGame

 private void BeginGame()
 {
     mazeInstance = Instantiate(mazePrefab) as Maze;
     //StartCoroutine(mazeInstance.Generate());
     mazeInstance.Generate();
     timeLimit = mazeInstance.difficulty *1.5f;
     timerText.color = new Color(0,1,213.0f/255.0f);
 }
开发者ID:Choices-We-Make,项目名称:Game,代码行数:8,代码来源:GameManager.cs


示例14: BotFactory

 public BotFactory(Maze maze, EngineSettings settings, WallGrid walls, BrainFactory brainFactory, EyeFactory eyeFactory)
 {
     _maze = maze;
     _settings = settings;
     _walls = walls;
     _brainFactory = brainFactory;
     _eyeFactory = eyeFactory;
 }
开发者ID:PeterGerrard,项目名称:Maze-Machine-Learning-Demo,代码行数:8,代码来源:BotFactory.cs


示例15: render

        public override void render(Maze pmaze)
        {
            base.render(pmaze);

            statX.Text = pmaze.Width.ToString();
            statY.Text = pmaze.Height.ToString();
            statRendered.Text = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
        }
开发者ID:stwalkerster,项目名称:beebmaze,代码行数:8,代码来源:NullMazeRenderScreen.cs


示例16: BeginGame

 private IEnumerator BeginGame()
 {
     mazeInstance = Instantiate(mazePrefab) as Maze;
     yield return StartCoroutine (mazeInstance.Generate());
     playerInstance = Instantiate(playerPrefab) as Player;
     playerInstance.SetLocation(mazeInstance.GetCell(mazeInstance.RandomCoordinates));
     StartCoroutine(mazeInstance.Generate());
 }
开发者ID:northtwilight,项目名称:UnityMazeDemo,代码行数:8,代码来源:GameManager.cs


示例17: SquareForm

		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="maze">Maze handle</param>
		/// <param name="square">Square handle</param>
		public SquareForm(Maze maze, Square square)
		{
			InitializeComponent();


			SquareControlBox.Maze = maze;
			SquareControlBox.SetSquare(square);
		}
开发者ID:melkor54248,项目名称:dungeoneye,代码行数:13,代码来源:SquareForm.cs


示例18: Generate

        /// <summary>
        /// Generate a Maze
        /// </summary>
        /// <param name="width">Width of the maze</param>
        /// <param name="height">Height of the maze</param>
        /// <param name="innerMapType">The type which is used to store a map</param>
        /// <param name="seed">The seed that is used to generate a maze</param>
        /// <param name="pixelChangedCallback">When a pixel is changed you can define a callback here to for example draw the maze while its being generated, add null if you don't want this. Last 2 longs are for the current step and the total steps (can be used to calculate how far the maze is done being generated)</param>
        /// <returns>A maze</returns>
        public Maze Generate(int width, int height, InnerMapType innerMapType, int seed, Action<int, int, long, long> pixelChangedCallback)
        {
            var map = GoGenerate(new FastRandom(seed), width, height);

            InnerMap innerMap = new BooleanInnerMap(width, height, map);
            var maze = new Maze(innerMap);
            return maze;
        }
开发者ID:OctoOsmo,项目名称:DeveMazeGenerator,代码行数:17,代码来源:AlgorithmBacktrackFastWithoutActionAndMazeAndFastRandomFastStackArray.cs


示例19: NewMaze

	public void NewMaze()
	{
		ClearOld();
		WallObjects = new List<GameObject>();
		cMaze = new Maze(Width, Height, 100-SparsePercent, MazeSeed);
		Cell[,] cells = cMaze.GetCells();
		MakeMaze(cells);
	}
开发者ID:Blueteak,项目名称:MazeWar,代码行数:8,代码来源:MazeGenerator.cs


示例20: render

        public virtual void render(Maze pmaze)
        {
            if (pmaze == null)
                pmaze = lastKnownMaze;
            else
                lastKnownMaze = pmaze;

            this.maze = pmaze;
        }
开发者ID:stwalkerster,项目名称:beebmaze,代码行数:9,代码来源:MazeRenderScreen.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# MazeCell类代码示例发布时间:2022-05-24
下一篇:
C# Maybe类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap