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

C# Tile类代码示例

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

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



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

示例1: TileLayer

 public TileLayer(int width, int height, string name, Tile[,] data)
 {
     _width = width;
     _height = height;
     _name = name;
     _data = data;
 }
开发者ID:kjellski,项目名称:UnityFluidRTS,代码行数:7,代码来源:TileLayer.cs


示例2: Start

	void Start()
	{
		rank = UnitRank.Knight;
		//Debug.Log("Knight Start has been called");
		// Get current tile position
		CurrentTile = transform.GetComponentInParent<Tile>();
		//Debug.Log ("CurrentTile : "+CurrentTile);
		
		
		//this will find the village associated with this Knight, which will be the variable home.
		PathFind = transform.gameObject.GetComponentInParent<PathFinding>();
		List<Tile> tiles = PathFind.GetTiles(CurrentTile);
		//Debug.Log (tiles.Count);
		
		foreach (Tile t in tiles)
		{
			if (t.HasVillage)
			{
				Home = t.Village.transform.GetComponent<Village>();
			}
		}
		
		_neutral = false;
		_home = false;
		_enemy = false;
		_water = false;
		
		// TODO: Test purposes only
		CurrentTile.HasKnight = true;
		//Debug.Log(CurrentTile);
		
		Glow = transform.FindChild("Glow").gameObject;
	}
开发者ID:EmilioF,项目名称:UnityProjects,代码行数:33,代码来源:Knight.cs


示例3: LoadBasicTile

 private Tile LoadBasicTile(string name, TileType tileType, bool hot = false, bool ice = false)
 {
     Tile t = new Tile("Tiles/" + name, tileType);
     t.Hot = hot;
     t.Ice = ice;
     return t;
 }
开发者ID:MiloBuwalda,项目名称:ticktack,代码行数:7,代码来源:LevelLoading.cs


示例4: CoordinatesIn

		public void CoordinatesIn()
		{
			Tile<TileTests.Item> t0 = new Tile<TileTests.Item>(new Area(0, 0, 100, 100), new TileTests.Item(0, 0, Color.Red));
			t0.Fill(c => c.X > 25 && c.X < 75 && c.Y > 30 && c.Y < 60 ? new TileTests.Item(c.X, c.Y, c.X == c.Y ? Color.Yellow : Color.Green) : new TileTests.Item(c.X, c.Y, Color.Red));

			IQuantifiedTile<TileTests.Item> q0 = t0.AsQuantified(10, 10);

			string signature0 = q0.GetImage(1000, 1000, (z, s) =>
                z.ToBitmap(100, 50, z.X + "\n" + z.Y)).Item.GetSignature();

			foreach (ICoordinate c in q0.GetCoordinatesIn(250, 250, 600, 600))
			{
				t0.Find(c).Color = Color.Blue;
			}

			string signature1 = q0.GetImage(1000, 1000, (z, s) =>
                z.ToBitmap(100, 50, z.X + "\n" + z.Y)).Item.GetSignature();

			foreach (ICoordinate c in q0.GetCoordinatesIn(52, 52, 62, 62))
			{
				t0.Find(c).Color = Color.White;
			}

			string signature2 = q0.GetImage(1000, 1000, (z, s) =>
                z.ToBitmap(100, 50, z.X + "\n" + z.Y)).Item.GetSignature();

			foreach (ICoordinate c in q0.GetCoordinatesIn(12, 12, 13, 13))
			{
				t0.Find(c).Color = Color.Black;
			}

			string signature3 = q0.GetImage(1000, 1000, (z, s) =>
                z.ToBitmap(100, 50, z.X + "\n" + z.Y)).Item.GetSignature();
		}
开发者ID:tomgrv,项目名称:pa.toolbox,代码行数:34,代码来源:QuantifiedTests.cs


示例5: Activate

    /**
     * Activate function
     *
     * Arguments
     * - Tile targetTile - The tile being targetted
     */
    public override void Activate(Tile targetTile)
    {
        GameObject primaryAbilityButton; // The primary ability button

        primaryAbilityButton = ClassPanel.GetComponent<ClassPanelScript>().PrimaryAbilityButton;

        /* Count the number of traps we have */
        trapCount = MAX_TRAPS;
        foreach (Trap t in Object.FindObjectsOfType<Trap>()) {
            PhotonView pv = t.GetComponent<PhotonView>();
            if (pv != null && pv.isMine) // This is our trap
                trapCount--;
        }

        if (trapCount == 0) { // Don't do anything. Out of traps
            primaryAbilityButton.SetActive(false);
            return;
        }

        primaryAbilityButton.SetActive(true); // We still have traps
        SpawnTrap(Tile.TileMiddle(targetTile).x, 0, Tile.TileMiddle(targetTile).z);

        if ((trapCount - 1) == 0) // Out of traps
            primaryAbilityButton.SetActive(false);
    }
开发者ID:RandomTroll18,项目名称:deco3801-nodayoff,代码行数:31,代码来源:ScoutPrimaryAbility.cs


示例6: ColorizeText

        private static void ColorizeText(RichTextBox box, Tile<GSTToken<char>> tile)
        {
            TextRange tr ;

            if("A" == box.Name)
            {
                /*
                tr = new TextRange(box.Document.ContentStart.GetPositionAtOffset(tile.IndexOnA),
                                   box.Document.ContentStart.GetPositionAtOffset(tile.IndexOnA + tile.Tokens.Count()));
                /* */
                box.Selection.Select(box.Document.ContentStart.GetPositionAtOffset(tile.IndexOnA),
                                box.Document.ContentStart.GetPositionAtOffset(tile.IndexOnA + tile.Tokens.Count()));
            }
            else
            {
                box.Selection.Select(box.Document.ContentStart.GetPositionAtOffset(tile.IndexOnB),
                                box.Document.ContentStart.GetPositionAtOffset(tile.IndexOnB + tile.Tokens.Count()));
                /*
                tr = new TextRange(box.Document.ContentStart.GetPositionAtOffset(tile.IndexOnB),
                                   box.Document.ContentStart.GetPositionAtOffset(tile.IndexOnB + tile.Tokens.Count()));
                /* */
            }

            box.Selection.ApplyPropertyValue(TextElement.ForegroundProperty,
                                                 new SolidColorBrush(
                                                     _ltForeground[_indexColorLookup % _ltForeground.Length]));

            box.Selection.ApplyPropertyValue(TextElement.BackgroundProperty,
                                                 new SolidColorBrush(
                                                     _ltBackground[_indexColorLookup % _ltForeground.Length]));
        }
开发者ID:yas4891,项目名称:MUTEX,代码行数:31,代码来源:MainWindow.xaml.cs


示例7: Board

 public Board(){
    this.tile = new Tile[100];
    for(int i=0;i<tiles.length;i++){
       tiles[i]=new Tile();
    }
   generateBoard();
 }
开发者ID:hendrotanoto17,项目名称:Project_SnakeAndLadder,代码行数:7,代码来源:Board.cs


示例8: GetTiles

	// Get a list of all the tiles that are connected using BFS
	public List<Tile> GetTiles(Tile root)
	{
		List<Tile> tileList = new List<Tile>();
		
		Queue<Tile> q = new Queue<Tile>();
		
		q.Enqueue(root);
		
		while (q.Count > 0)
		{
			// pop the first item in the queue
			Tile current = q.Dequeue();
			tileList.Add(current);
			
			// if nothing pops, then all tiles have been found
			if (current == null)
				continue;
			
			// loop through all of root's neighbouring tiles 
			foreach (Transform tile in current.Neighbours)
			{
				_color = root.GetComponent<Renderer>().material.color;
				Color tileColor = tile.GetComponent<Renderer>().material.color;
				
				// get the tile component from the transform
				Tile t = tile.GetComponent<Tile>();
				
				// if the two colours match, then the tile is a neighbour
				// Enqueue the tile if it is not found in _tiles and in q
				if (_color == tileColor && !(tileList.Contains(t)) && !(q.Contains(t)))
					q.Enqueue(t);
			}
		}
		return tileList;
	}
开发者ID:EmilioF,项目名称:UnityProjects,代码行数:36,代码来源:MergeVillages.cs


示例9: FindPath

    public static Path<Tile> FindPath(
        Tile start,
        Tile destination)
    {
        var closed = new HashSet<Tile>();
        var queue = new PriorityQueue<double, Path<Tile>>();
        queue.Enqueue(0, new Path<Tile>(start));

        while (!queue.IsEmpty)
        {
            var path = queue.Dequeue();

            if (closed.Contains(path.LastStep))
                continue;
            if (path.LastStep.Equals(destination))
                return path;

            closed.Add(path.LastStep);

            foreach (Tile n in path.LastStep.Neighbours)
            {
                double d = distance(path.LastStep, n);
                var newPath = path.AddStep(n, d);
                queue.Enqueue(newPath.TotalCost + estimate(n, destination), 
                    newPath);
            }
        }

        return null;
    }
开发者ID:VicBoss,项目名称:KR,代码行数:30,代码来源:PathFinder.cs


示例10: Grid

        public Grid(World world) {
            using (StreamReader sr = new StreamReader("testmap.txt")) {
                List<string> lines = new List<string>();
                while (!sr.EndOfStream) {
                    lines.Add(sr.ReadLine());
                }
                xDimension = lines[0].Length;
                yDimension = lines.Count;
                tiles = new Tile[xDimension, yDimension];
                for (int i = 0; i < xDimension; i++)
                {
                    for (int j = 0; j < yDimension; j++)
                    {
                        tiles[i, j] = new Tile(i, j, new Rectangle((int)(i*TileSize),(int)(j*TileSize),(int)TileSize,(int)TileSize));
                        if (lines[j][i] == '#')
                        {
                            tiles[i, j].passable = false;
                            Body body = BodyFactory.CreateRectangle(world, ConvertUnits.ToSimUnits(TileSize), ConvertUnits.ToSimUnits(TileSize), 10, ConvertUnits.ToSimUnits(GetWindowCenterPos(tiles[i, j])));
                            body.BodyType = BodyType.Static;
                            body.CollidesWith = Category.All;
                            body.CollisionCategories = Category.All;
                            tileBodies.Add(body);
                        }
                            
                    }
                }

            }

            AssignNeighbours();

            pathfinder = new Pathfinder(this);

        }
开发者ID:alexdbaldwin,项目名称:AI_RTS_MonoGame,代码行数:34,代码来源:Grid.cs


示例11: TextureMenu

        public TextureMenu(Tile TileSelected, TextureIndex Index ,List<GuiItem> Garbage)
            : base("TileMenu")
        {
            this.Index = Index;
            this.Garbage = Garbage;
            this.TileSelected = TileSelected;

            foreach (TextureEntry Entry in Index.TextureList)
            {
                if (TileSelected.Type == TileType.Normal)
                {
                    if (Entry.Name.StartsWith("Normal"))
                    {
                        MenuItems.Add(new MenuItem(Entry.Name, Entry.Name));
                    }
                }
                else if(TileSelected.Type == TileType.Obstacle)
                {
                    if (Entry.Name.StartsWith("Obstacle"))
                    {
                        MenuItems.Add(new MenuItem(Entry.Name, Entry.Name));
                    }
                }
                else if (TileSelected.Type == TileType.CreepEnd || TileSelected.Type == TileType.CreepStart || TileSelected.Type == TileType.CreepPath)
                {
                    if (Entry.Name.StartsWith("Creep"))
                    {
                        MenuItems.Add(new MenuItem(Entry.Name, Entry.Name));
                    }
                }
            }

            FixAttribute();
        }
开发者ID:jordsti,项目名称:towerdefenserpg,代码行数:34,代码来源:MapEditorMenu.cs


示例12: CreateSetupActuators

        public void CreateSetupActuators(Tile currentTile)
        {
            var actuators = builder.CurrentMap.GetTileData(currentTile.GridPosition).Actuators;
            if (actuators.Any())
            {
                var factory = parser.TryMatchFactory(actuators, false);
                if (factory != null)
                {
                    currentTile.SubItems.Add(factory.CreateItem(builder, currentTile, actuators));
                }
                else
                {
                    if (actuators.All(x => x.ActuatorType != 5 && x.ActuatorType != 6))
                    {
                        foreach (var i in actuators)
                        {
                            Point? absolutePosition = null;
                            if (i.ActionLocation is RemoteTarget)
                                absolutePosition = ((RemoteTarget)i.ActionLocation).Position.Position.ToAbsolutePosition(builder.CurrentMap);

                            currentTile.SubItems.Add(new Actuator(builder.GetWallPosition(i.TilePosition, currentTile), $"{absolutePosition} {i.DumpString()}"));
                        }
                    }
                    else
                    {

                    }
                }
            }
        }
开发者ID:ggrrin,项目名称:DungeonMaster,代码行数:30,代码来源:FloorActuatorCreator.cs


示例13: TestAreValidNeighboursTop

        public void TestAreValidNeighboursTop()
        {
            Tile emptyTile = new Tile(string.Empty, 1);
            Tile currentTile = new Tile("12", 5);

            Assert.IsTrue(MatrixGenerator.AreValidNeighbours(emptyTile, currentTile), "Empty tile are not neighbours.");
        }
开发者ID:asenval,项目名称:TeamProject-HighQualityCode,代码行数:7,代码来源:MatrixGeneratorTest.cs


示例14: Main

    static void Main(string[] args) {
        string[] inputs;
        inputs = Console.ReadLine().Split(' ');
        int W = int.Parse(inputs[0]);
        int H = int.Parse(inputs[1]);
        Tiles = new Tile[W, H];
        inputs = Console.ReadLine().Split(' ');
        int X = int.Parse(inputs[0]);
        int Y = int.Parse(inputs[1]);
        for (int y = 0; y < H; y++) {
            string R = Console.ReadLine();
            for (int x = 0; x < R.Length; x++) {
                Tiles[x, y] = new Tile(x, y, R[x] == '#');
                Tiles[x, y].BuildLinks(W, H);
                if ((x == 0 || y == 0 || x == W - 1 || y == H - 1) && !Tiles[x, y].IsWall) {
                    OuterTiles.Add(Tiles[x, y]);
                }
            }
        }

        Tile start = Tiles[X, Y];
        foreach (Tile t in OuterTiles) {
            if (DistanceBetween(start, t) != -1) {
                EntryPoints.Add(t);
            }
        }

        EntryPoints = EntryPoints.OrderBy(e => e.X).ThenBy(e => e.Y).ToList();
        Console.WriteLine(EntryPoints.Count);
        foreach (Tile t in EntryPoints) {
            Console.WriteLine("{0} {1}", t.X, t.Y);
        }
    }
开发者ID:manofsteel76667,项目名称:CodeInGame,代码行数:33,代码来源:Maze.cs


示例15: Activate

 public override void Activate(Tile targetTile)
 {
     GameObject instantiatedStunTurret; // The object instantiated
     Vector3 instantiatePosition; // Where to instantiate
     if (Amount == 0) // Out of turrets
         return;
     else { // Instantiate Turret
         Amount--;
         instantiatePosition = new Vector3(Tile.TileMiddle(targetTile).x, 0f, Tile.TileMiddle(targetTile).z);
         instantiatedStunTurret = PhotonNetwork.Instantiate(
                 "Prefabs/DeployableStunTurret",
                 instantiatePosition,
                 Quaternion.identity,
                 0
         );
         if (SoundManagerScript.Singleton != null) { /* Play activated sound effect */
             // Move sound manager to this object
             SoundManagerScript.Singleton.gameObject.transform.position = gameObject.transform.position;
             SoundManagerScript.Singleton.PlaySingle3D(ActivateEfx);
         }
         UpdateContextAwareBox();
         instantiatedStunTurret.GetComponent<DeployableStunTurretActionScript>().enabled = true; // Enable script
         if (Amount == 0) { // Remove the item
             Player.MyPlayer.GetComponent<Player>().RemoveItem(this, false);
             Destroy(gameObject);
             PhotonNetwork.Destroy(gameObject);
         }
     }
 }
开发者ID:RandomTroll18,项目名称:deco3801-nodayoff,代码行数:29,代码来源:DeployableStunTurret.cs


示例16: genBoard

    private void genBoard()
    {
        winReqs = new Dictionary<string, int>();
        Ending[] endings = Ending.findEndings(data).ToArray();
        foreach (Ending ending in endings) {
            winReqs[ending.edgeId] = 0;
        }
        int width = MathData.GetInt(data.SelectSingleNode(XmlUtilities.WIDTH));
        int height = MathData.GetInt(data.SelectSingleNode(XmlUtilities.HEIGHT));
        Tile.BOARD_HEIGHT = height;
        Tile[,] tiles = new Tile[width, height];
        for (int x = 0; x < width; x++) {
            for (int y = 0; y < height; y++) {
                GameObject go = Instantiate(tile) as GameObject;
                go.transform.position = new Vector3((float)x, (float)y, 0f);
                go.transform.parent = gameObject.transform;
                Tile t = go.GetComponent<Tile>();
                tiles[x, y] = t;
                t.ending = endings[Random.Range(0, endings.Length)];
                winReqs[t.ending.edgeId]++;

                if (x > 0) {
                    tiles[x-1, y].right = t;
                    t.left = tiles[x-1, y];
                }
                if (y > 0) {
                    tiles[x, y-1].up = t;
                    t.down = tiles[x, y-1];
                }
            }
        }
    }
开发者ID:CalPolyGameDevelopment,项目名称:ettell,代码行数:32,代码来源:Match3.cs


示例17: makeLine

	// Generate a line from one coordinate to another
	// You can ask for it to be totaly walls or totally floor, based on the bool
	// False: Walls
	// True: Floor
	public static void makeLine(Tile[,] map, Coord begin, Coord end, bool applyFloor) {

		// Assert in range
		if( begin.isOOB (map.GetLength(0), map.GetLength (1), Direction.Stop) ||
		    end.isOOB (map.GetLength(0), map.GetLength (1), Direction.Stop) )
			return;
		
		int startX = begin.x;
		int endX = end.x;
		int startY = begin.y;
		int endY = end.y;


		// Find the linear spacing appropriate from point
		// including the endpoint
		int lengthX = Math.Abs( endX - startX );

		var linspace = new List<Double>();
			linspace = LinSpace (startY, endY, lengthX, true).ToList ();

		// Now it's time to actually put our money where our mouth is
		for(int i = startX; i < endX; i++) {
			int j = (int) linspace[i] ;
			map[i,j].property = applyFloor ? TileType.Floor1 : TileType.OuterWall1;
		}

		// Phew! Thought this one was so easy, didn't cha!?

		return;
	}
开发者ID:starrodkirby86,项目名称:Better-Game-App,代码行数:34,代码来源:RoomUtilityFunctions.cs


示例18: BuildFluff

    private float Width; //width (X) of map

    #endregion Fields

    #region Methods

    //Builds all the fluff
    public void BuildFluff(Tile [,] gd, float scale)
    {
        //Prep variables
        Fluff = new GameObject();
        Fluff.name = "Fluff";
        Fluff.transform.position = new Vector3(0f, 0f, 0f);
        Grid = gd;
        Scale = scale;
        Width = gd.GetLength(0);
        Height = gd.GetLength(1);

        //Loop through the grid, adding fluff spots as appropriate
        for (int i = 1; i < Width - 1; i++)
        {
            for (int j = 1; j < Height - 1; j++)
            {
                //Check walls
                if (Grid[i, j].getType() == "Rock")
                {
                    AddWallLight(i, j);
                }

                //Check floors
                if (Grid[i, j].getType() == "Floor")
                {
                    //AddCornerLight(i, j); not fully functional yet
                    AddParticles(i, j);
                }
            }
        }
    }
开发者ID:mattgor123,项目名称:CS355-Robo-Clean-5000,代码行数:38,代码来源:FluffBuilder.cs


示例19: GetTilesInArea

 public HashSet<Tile> GetTilesInArea(Tile start, int radius, int verticalAllowance)
 {
     if (start == null) return null;
     return Search(start, delegate(Tile arg) {
         return arg.distance <= radius && (Mathf.Abs(start.height - arg.height) <= verticalAllowance);
     });
 }
开发者ID:Policenaut,项目名称:Unity-SRPG,代码行数:7,代码来源:Board.cs


示例20: Map

 // #############################################################################################
 /// Constructor: <summary>
 ///              	Create a map from a tile
 ///              </summary>
 ///
 /// In:		<param name="_tile"></param>
 ///
 // #############################################################################################
 public Map(Tile _tile)
 {
     m_Tile = _tile;
     Reset(_tile.Width, _tile.Height, 16,4);
     LidBase = 64;
     Pavement = 7;
 }
开发者ID:GStick,项目名称:YourWorld,代码行数:15,代码来源:Map.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# TileCollision类代码示例发布时间:2022-05-24
下一篇:
C# TiffTag类代码示例发布时间: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