本文整理汇总了C#中World.GetTerrainType方法的典型用法代码示例。如果您正苦于以下问题:C# World.GetTerrainType方法的具体用法?C# World.GetTerrainType怎么用?C# World.GetTerrainType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类World
的用法示例。
在下文中一共展示了World.GetTerrainType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Tick
public void Tick(World world)
{
ticks++;
anim.Tick();
// Missile tracks target
if (args.GuidedTarget.IsValidFor(args.SourceActor))
targetPosition = args.GuidedTarget.CenterPosition;
var dist = targetPosition + offset - pos;
var desiredFacing = Traits.Util.GetFacing(dist, facing);
var desiredAltitude = targetPosition.Z;
var jammed = info.Jammable && world.ActorsWithTrait<JamsMissiles>().Any(j => JammedBy(j));
if (jammed)
{
desiredFacing = facing + world.SharedRandom.Next(-20, 21);
desiredAltitude = world.SharedRandom.Next(-43, 86);
}
else if (!args.GuidedTarget.IsValidFor(args.SourceActor))
desiredFacing = facing;
facing = Traits.Util.TickFacing(facing, desiredFacing, info.ROT);
var move = new WVec(0, -1024, 0).Rotate(WRot.FromFacing(facing)) * info.Speed.Range / 1024;
if (targetPosition.Z > 0 && info.TurboBoost)
move = (move * 3) / 2;
if (pos.Z != desiredAltitude)
{
var delta = move.HorizontalLength * info.MaximumPitch.Tan() / 1024;
var dz = (targetPosition.Z - pos.Z).Clamp(-delta, delta);
move += new WVec(0, 0, dz);
}
pos += move;
if (info.Trail != null && --ticksToNextSmoke < 0)
{
world.AddFrameEndTask(w => w.Add(new Smoke(w, pos - 3 * move / 2, info.Trail)));
ticksToNextSmoke = info.TrailInterval;
}
if (info.ContrailLength > 0)
trail.Update(pos);
var cell = pos.ToCPos();
var shouldExplode = (pos.Z < 0) // Hit the ground
|| (dist.LengthSquared < MissileCloseEnough.Range * MissileCloseEnough.Range) // Within range
|| (info.RangeLimit != 0 && ticks > info.RangeLimit) // Ran out of fuel
|| (!info.High && world.ActorMap.GetUnitsAt(cell)
.Any(a => a.HasTrait<IBlocksBullets>())) // Hit a wall
|| (!string.IsNullOrEmpty(info.BoundToTerrainType) && world.GetTerrainType(cell) != info.BoundToTerrainType); // Hit incompatible terrain
if (shouldExplode)
Explode(world);
}
示例2: MovementCostForCell
public int MovementCostForCell(World world, int2 cell)
{
if (!world.Map.IsInMap(cell.X, cell.Y))
return int.MaxValue;
var type = world.GetTerrainType(cell);
if (!TerrainSpeeds.ContainsKey(type))
return int.MaxValue;
return TerrainSpeeds[type].Cost;
}
示例3: WeaponValidForTarget
public static bool WeaponValidForTarget( WeaponInfo weapon, World world, int2 location )
{
if( weapon.ValidTargets.Contains( "Ground" ) && world.GetTerrainType( location ) != "Water" ) return true;
if( weapon.ValidTargets.Contains( "Water" ) && world.GetTerrainType( location ) == "Water" ) return true;
return false;
}
示例4: IsValidAgainst
public bool IsValidAgainst(Target target, World world)
{
if (target.Type == TargetType.Actor)
return IsValidAgainst(target.Actor);
if (target.Type == TargetType.FrozenActor)
return IsValidAgainst(target.FrozenActor);
if (target.Type == TargetType.Terrain)
{
var cell = target.CenterPosition.ToCPos();
if (ValidTargets.Contains("Ground") && world.GetTerrainType(cell) != "Water")
return true;
if (ValidTargets.Contains("Water") && world.GetTerrainType(cell) == "Water")
return true;
return false;
}
return false;
}