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


C# World.CanPlaceBuilding方法代码示例

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


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

示例1: InnerOrder

		IEnumerable<Order> InnerOrder(World world, CPos xy, MouseInput mi)
		{
			if (world.Paused)
				yield break;

			if (mi.Button == MouseButton.Left)
			{
				var topLeft = xy - FootprintUtils.AdjustForBuildingSize(BuildingInfo);
				if (!world.CanPlaceBuilding(Building, BuildingInfo, topLeft, null)
					|| !BuildingInfo.IsCloseEnoughToBase(world, Producer.Owner, Building, topLeft))
				{
					Sound.PlayNotification(world.Map.Rules, Producer.Owner, "Speech", "BuildingCannotPlaceAudio", Producer.Owner.Country.Race);
					yield break;
				}

				var isLineBuild = world.Map.Rules.Actors[Building].Traits.Contains<LineBuildInfo>();
				yield return new Order(isLineBuild ? "LineBuild" : "PlaceBuilding", Producer.Owner.PlayerActor, false)
				{
					TargetLocation = topLeft,
					TargetActor = Producer,
					TargetString = Building,
					SuppressVisualFeedback = true
				};
			}
		}
开发者ID:JackKucan,项目名称:OpenRA,代码行数:25,代码来源:PlaceBuildingOrderGenerator.cs

示例2: InnerOrder

        IEnumerable<Order> InnerOrder(World world, int2 xy, MouseInput mi)
        {
            if (mi.Button == MouseButton.Left)
            {
                var topLeft = xy - Footprint.AdjustForBuildingSize( BuildingInfo );
                if (!world.CanPlaceBuilding( Building, BuildingInfo, topLeft, null)
                    || !world.IsCloseEnoughToBase(Producer.Owner, Building, BuildingInfo, topLeft))
                {
                    var eva = world.WorldActor.Info.Traits.Get<EvaAlertsInfo>();
                    Sound.Play(eva.BuildingCannotPlaceAudio);
                    yield break;
                }

                if (Rules.Info[ Building ].Traits.Contains<LineBuildInfo>())
                    yield return new Order("LineBuild", Producer.Owner.PlayerActor, topLeft, Building);
                else
                    yield return new Order("PlaceBuilding", Producer.Owner.PlayerActor, topLeft, Building);
            }
        }
开发者ID:mgatland,项目名称:OpenRA,代码行数:19,代码来源:PlaceBuildingOrderGenerator.cs

示例3: InnerOrder

        IEnumerable<Order> InnerOrder(World world, CPos cell, MouseInput mi)
        {
            if (world.Paused)
                yield break;

            var owner = queue.Actor.Owner;
            if (mi.Button == MouseButton.Left)
            {
                var orderType = "PlaceBuilding";
                var topLeft = cell - FootprintUtils.AdjustForBuildingSize(buildingInfo);

                var plugInfo = world.Map.Rules.Actors[building].TraitInfoOrDefault<PlugInfo>();
                if (plugInfo != null)
                {
                    orderType = "PlacePlug";
                    if (!AcceptsPlug(topLeft, plugInfo))
                    {
                        Game.Sound.PlayNotification(world.Map.Rules, owner, "Speech", "BuildingCannotPlaceAudio", owner.Faction.InternalName);
                        yield break;
                    }
                }
                else
                {
                    if (!world.CanPlaceBuilding(building, buildingInfo, topLeft, null)
                        || !buildingInfo.IsCloseEnoughToBase(world, owner, building, topLeft))
                    {
                        foreach (var order in ClearBlockersOrders(world, topLeft))
                            yield return order;

                        Game.Sound.PlayNotification(world.Map.Rules, owner, "Speech", "BuildingCannotPlaceAudio", owner.Faction.InternalName);
                        yield break;
                    }

                    if (world.Map.Rules.Actors[building].HasTraitInfo<LineBuildInfo>() && !mi.Modifiers.HasModifier(Modifiers.Shift))
                        orderType = "LineBuild";
                }

                yield return new Order(orderType, owner.PlayerActor, false)
                {
                    TargetLocation = topLeft,
                    TargetActor = queue.Actor,
                    TargetString = building,
                    SuppressVisualFeedback = true
                };
            }
        }
开发者ID:pchote,项目名称:OpenRA,代码行数:46,代码来源:PlaceBuildingOrderGenerator.cs

示例4: InnerOrder

        IEnumerable<Order> InnerOrder(World world, CPos xy, MouseInput mi)
        {
            if (world.Paused)
                yield break;

            if (mi.Button == MouseButton.Left)
            {
                var orderType = "PlaceBuilding";
                var topLeft = xy - FootprintUtils.AdjustForBuildingSize(buildingInfo);

                var plugInfo = world.Map.Rules.Actors[building].Traits.GetOrDefault<PlugInfo>();
                if (plugInfo != null)
                {
                    orderType = "PlacePlug";
                    if (!AcceptsPlug(topLeft, plugInfo))
                    {
                        Sound.PlayNotification(world.Map.Rules, producer.Owner, "Speech", "BuildingCannotPlaceAudio", producer.Owner.Country.Race);
                        yield break;
                    }
                }
                else
                {
                    if (!world.CanPlaceBuilding(building, buildingInfo, topLeft, null)
                        || !buildingInfo.IsCloseEnoughToBase(world, producer.Owner, building, topLeft))
                    {
                        Sound.PlayNotification(world.Map.Rules, producer.Owner, "Speech", "BuildingCannotPlaceAudio", producer.Owner.Country.Race);
                        yield break;
                    }

                    if (world.Map.Rules.Actors[building].Traits.Contains<LineBuildInfo>())
                        orderType = "LineBuild";
                }

                yield return new Order(orderType, producer.Owner.PlayerActor, false)
                {
                    TargetLocation = topLeft,
                    TargetActor = producer,
                    TargetString = building,
                    SuppressVisualFeedback = true
                };
            }
        }
开发者ID:ushardul,项目名称:OpenRA,代码行数:42,代码来源:PlaceBuildingOrderGenerator.cs

示例5: InnerOrder

        IEnumerable<Order> InnerOrder(World world, int2 xy, MouseInput mi)
        {
            if (mi.Button == MouseButton.Left)
            {
                var topLeft = xy - FootprintUtils.AdjustForBuildingSize( BuildingInfo );
                if (!world.CanPlaceBuilding( Building, BuildingInfo, topLeft, null)
                    || !BuildingInfo.IsCloseEnoughToBase(world, Producer.Owner, Building, topLeft))
                {
                    var eva = world.WorldActor.Info.Traits.Get<EvaAlertsInfo>();
                    Sound.Play(eva.BuildingCannotPlaceAudio);
                    yield break;
                }

                var isLineBuild = Rules.Info[ Building ].Traits.Contains<LineBuildInfo>();
                yield return new Order(isLineBuild ? "LineBuild" : "PlaceBuilding",
                    Producer.Owner.PlayerActor, false) { TargetLocation = topLeft, TargetString = Building };
            }
        }
开发者ID:hoxworth,项目名称:OpenRA,代码行数:18,代码来源:PlaceBuildingOrderGenerator.cs


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