本文整理汇总了C#中Actor.IsAtGroundLevel方法的典型用法代码示例。如果您正苦于以下问题:C# Actor.IsAtGroundLevel方法的具体用法?C# Actor.IsAtGroundLevel怎么用?C# Actor.IsAtGroundLevel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Actor
的用法示例。
在下文中一共展示了Actor.IsAtGroundLevel方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Killed
public void Killed(Actor self, AttackInfo e)
{
if (self.Owner.WinState == WinState.Lost || !self.World.Map.Contains(self.Location))
return;
foreach (var condition in self.TraitsImplementing<IPreventsEjectOnDeath>())
if (condition.PreventsEjectOnDeath(self))
return;
var r = self.World.SharedRandom.Next(1, 100);
if (r <= 100 - info.SuccessRate)
return;
var cp = self.CenterPosition;
var inAir = !self.IsAtGroundLevel();
if ((inAir && !info.EjectInAir) || (!inAir && !info.EjectOnGround))
return;
var ge = self.TraitOrDefault<GainsExperience>();
if ((ge == null || ge.Level == 0) && info.SpawnOnlyWhenPromoted)
return;
var pilot = self.World.CreateActor(false, info.PilotActor.ToLowerInvariant(),
new TypeDictionary { new OwnerInit(self.Owner), new LocationInit(self.Location) });
if (ge != null)
{
var pge = pilot.TraitOrDefault<GainsExperience>();
if (pge != null)
{
pge.GiveLevels(ge.Level, true);
}
}
if (info.AllowUnsuitableCell || IsSuitableCell(self, pilot))
{
if (inAir)
{
self.World.AddFrameEndTask(w =>
{
w.Add(pilot);
pilot.QueueActivity(new Parachute(pilot, cp));
});
Game.Sound.Play(info.ChuteSound, cp);
}
else
{
self.World.AddFrameEndTask(w => w.Add(pilot));
var pilotMobile = pilot.TraitOrDefault<Mobile>();
if (pilotMobile != null)
pilotMobile.Nudge(pilot, pilot, true);
}
}
else
pilot.Dispose();
}
示例2: Tick
public override Activity Tick(Actor self)
{
if (IsCanceled || !target.IsValidFor(self))
return NextActivity;
if (!playedSound && helicopter.Info.TakeoffSound != null && self.IsAtGroundLevel())
{
Game.Sound.Play(helicopter.Info.TakeoffSound);
playedSound = true;
}
if (AdjustAltitude(self, helicopter, helicopter.Info.CruiseAltitude))
return this;
var pos = target.CenterPosition;
// Rotate towards the target
var dist = pos - self.CenterPosition;
var desiredFacing = dist.HorizontalLengthSquared != 0 ? dist.Yaw.Facing : helicopter.Facing;
helicopter.Facing = Util.TickFacing(helicopter.Facing, desiredFacing, helicopter.TurnSpeed);
var move = helicopter.FlyStep(desiredFacing);
// Inside the minimum range, so reverse
if (minRange.Length > 0 && target.IsInRange(helicopter.CenterPosition, minRange))
{
helicopter.SetPosition(self, helicopter.CenterPosition - move);
return this;
}
// Inside the maximum range, so we're done
if (maxRange.Length > 0 && target.IsInRange(helicopter.CenterPosition, maxRange))
return NextActivity;
// The next move would overshoot, so just set the final position
if (dist.HorizontalLengthSquared < move.HorizontalLengthSquared)
{
var targetAltitude = helicopter.CenterPosition.Z + helicopter.Info.CruiseAltitude.Length - self.World.Map.DistanceAboveTerrain(helicopter.CenterPosition).Length;
helicopter.SetPosition(self, pos + new WVec(0, 0, targetAltitude - pos.Z));
return NextActivity;
}
helicopter.SetPosition(self, helicopter.CenterPosition + move);
return this;
}
示例3: Tick
public override Activity Tick(Actor self)
{
if (IsCanceled)
return NextActivity;
if (requireSpace && !helicopter.CanLand(self.Location))
return this;
if (!playedSound && helicopter.Info.LandingSound != null && !self.IsAtGroundLevel())
{
Game.Sound.Play(helicopter.Info.LandingSound);
playedSound = true;
}
if (HeliFly.AdjustAltitude(self, helicopter, helicopter.Info.LandAltitude))
return this;
return NextActivity;
}