本文整理汇总了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
};
}
}
示例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);
}
}
示例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
};
}
}
示例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
};
}
}
示例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 };
}
}