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


C# World.ShroudObscures方法代码示例

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


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

示例1: GetCursor

		public string GetCursor(World world, CPos xy, MouseInput mi)
		{
			var useSelect = false;
			var underCursor = world.ScreenMap.ActorsAt(mi)
				.Where(a => !world.FogObscures(a) && a.HasTrait<ITargetable>())
				.WithHighestSelectionPriority();

			if (underCursor != null && (mi.Modifiers.HasModifier(Modifiers.Shift) || !world.Selection.Actors.Any()))
			{
				var selectable = underCursor.TraitOrDefault<Selectable>();
				if (selectable != null && selectable.Info.Selectable)
					useSelect = true;
			}

			Target target;
			if (underCursor != null)
				target = Target.FromActor(underCursor);
			else
			{
				var frozen = world.ScreenMap.FrozenActorsAt(world.RenderPlayer, mi)
					.Where(a => a.Info.Traits.Contains<ITargetableInfo>() && !a.Footprint.All(c => world.ShroudObscures(c)))
					.WithHighestSelectionPriority();
				target = frozen != null ? Target.FromFrozenActor(frozen) : Target.FromCell(world, xy);
			}

			var orders = world.Selection.Actors
				.Select(a => OrderForUnit(a, target, mi))
				.Where(o => o != null)
				.ToArray();

			var cursorName = orders.Select(o => o.Cursor).FirstOrDefault();
			return cursorName ?? (useSelect ? "select" : "default");
		}
开发者ID:Berzeger,项目名称:OpenRA,代码行数:33,代码来源:UnitOrderGenerator.cs

示例2: Order

		public IEnumerable<Order> Order(World world, CPos xy, MouseInput mi)
		{
			var underCursor = world.ScreenMap.ActorsAt(mi)
				.Where(a => !world.FogObscures(a) && a.HasTrait<ITargetable>())
				.WithHighestSelectionPriority();

			Target target;
			if (underCursor != null)
				target = Target.FromActor(underCursor);
			else
			{
				var frozen = world.ScreenMap.FrozenActorsAt(world.RenderPlayer, mi)
					.Where(a => a.Info.Traits.Contains<ITargetableInfo>() && !a.Footprint.All(c => world.ShroudObscures(c)))
					.WithHighestSelectionPriority();
				target = frozen != null ? Target.FromFrozenActor(frozen) : Target.FromCell(world, xy);
			}

			var orders = world.Selection.Actors
				.Select(a => OrderForUnit(a, target, mi))
				.Where(o => o != null)
				.ToArray();

			var actorsInvolved = orders.Select(o => o.Actor).Distinct();
			if (actorsInvolved.Any())
				yield return new Order("CreateGroup", actorsInvolved.First().Owner.PlayerActor, false)
				{
					TargetString = actorsInvolved.Select(a => a.ActorID).JoinWith(",")
				};

			foreach (var o in orders)
				yield return CheckSameOrder(o.Order, o.Trait.IssueOrder(o.Actor, o.Order, o.Target, mi.Modifiers.HasModifier(Modifiers.Shift)));
		}
开发者ID:Berzeger,项目名称:OpenRA,代码行数:32,代码来源:UnitOrderGenerator.cs

示例3: Order

		public IEnumerable<Order> Order(World world, CPos xy, MouseInput mi)
		{
			if (mi.Button != MouseButton.Left)
				world.CancelInputMode();
			else if (!world.ShroudObscures(xy))
			{
				world.CancelInputMode();
				yield return new Order("PlaceBeacon", world.LocalPlayer.PlayerActor, false) { TargetLocation = xy, SuppressVisualFeedback = true };
			}
		}
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:10,代码来源:BeaconOrderGenerator.cs

示例4: GetCursor

		public string GetCursor(World world, CPos xy, MouseInput mi) { return !world.ShroudObscures(xy) ? "ability" : "generic-blocked"; }
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:1,代码来源:BeaconOrderGenerator.cs

示例5: ShroudBitmap

        public static Bitmap ShroudBitmap(World world)
        {
            var map = world.Map;
            var size = Exts.NextPowerOf2(Math.Max(map.Bounds.Width, map.Bounds.Height));
            var bitmap = new Bitmap(size, size);
            if (world.RenderPlayer == null)
                return bitmap;

            var bitmapData = bitmap.LockBits(bitmap.Bounds(),
                ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);

            var shroud = Color.Black.ToArgb();
            var fog = Color.FromArgb(128, Color.Black).ToArgb();

            unsafe
            {
                int* c = (int*)bitmapData.Scan0;

                for (var x = 0; x < map.Bounds.Width; x++)
                    for (var y = 0; y < map.Bounds.Height; y++)
                    {
                        var p = new CPos(x + map.Bounds.Left, y + map.Bounds.Top);
                        if (world.ShroudObscures(p))
                            *(c + (y * bitmapData.Stride >> 2) + x) = shroud;
                        else if (world.FogObscures(p))
                            *(c + (y * bitmapData.Stride >> 2) + x) = fog;
                    }
            }

            bitmap.UnlockBits(bitmapData);
            return bitmap;
        }
开发者ID:Tsher,项目名称:OpenRA,代码行数:32,代码来源:Minimap.cs

示例6: GetCursor

 public string GetCursor(World world, CPos cell, int2 worldPixel, MouseInput mi)
 {
     return !world.ShroudObscures(cell) ? "ability" : "generic-blocked";
 }
开发者ID:CH4Code,项目名称:OpenRA,代码行数:4,代码来源:BeaconOrderGenerator.cs

示例7: RenderAboveShroud

            public IEnumerable<IRenderable> RenderAboveShroud(WorldRenderer wr, World world)
            {
                var minelayer = minelayers.FirstOrDefault(m => m.IsInWorld && !m.IsDead);
                if (minelayer == null)
                    yield break;

                // We get the biggest depth so we cover all cells that mines could be placed on.
                var minefield = GetMinefieldCells(minefieldStart, lastMousePos,
                    minelayers.Max(m => m.Info.TraitInfo<MinelayerInfo>().MinefieldDepth));

                var movement = minelayer.Trait<IPositionable>();
                var pal = wr.Palette(TileSet.TerrainPaletteInternalName);
                foreach (var c in minefield)
                {
                    var tile = movement.CanEnterCell(c, null, false) && !world.ShroudObscures(c) ? tileOk : tileBlocked;
                    yield return new SpriteRenderable(tile, world.Map.CenterOfCell(c),
                        WVec.Zero, -511, pal, 1f, true);
                }
            }
开发者ID:pchote,项目名称:OpenRA,代码行数:19,代码来源:Minelayer.cs

示例8: ShroudBitmap

		public static Bitmap ShroudBitmap(World world)
		{
			var map = world.Map;
			var b = map.Bounds;

			var size = Exts.NextPowerOf2(Math.Max(b.Width, b.Height));
			var bitmap = new Bitmap(size, size);
			if (world.RenderPlayer == null)
				return bitmap;

			var bitmapData = bitmap.LockBits(bitmap.Bounds(),
				ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);

			var shroud = Color.Black.ToArgb();
			var fog = Color.FromArgb(128, Color.Black).ToArgb();
			var offset = new CVec(b.Left, b.Top);

			unsafe
			{
				var c = (int*)bitmapData.Scan0;

				foreach (var cell in map.Cells)
				{
					var uv = Map.CellToMap(map.TileShape, cell) - offset;
					if (world.ShroudObscures(cell))
						*(c + (uv.Y * bitmapData.Stride >> 2) + uv.X) = shroud;
					else if (world.FogObscures(cell))
						*(c + (uv.Y * bitmapData.Stride >> 2) + uv.X) = fog;
				}
			}

			bitmap.UnlockBits(bitmapData);
			return bitmap;
		}
开发者ID:JackKucan,项目名称:OpenRA,代码行数:34,代码来源:Minimap.cs


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