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


C# Tile类代码示例

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


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


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