本文整理汇总了C#中ActorInitializer.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# ActorInitializer.Contains方法的具体用法?C# ActorInitializer.Contains怎么用?C# ActorInitializer.Contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActorInitializer
的用法示例。
在下文中一共展示了ActorInitializer.Contains方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Aircraft
public Aircraft( ActorInitializer init , AircraftInfo info)
{
if (init.Contains<LocationInit>())
this.Location = init.Get<LocationInit,int2>();
this.Facing = init.Contains<FacingInit>() ? init.Get<FacingInit,int>() : info.InitialFacing;
this.Altitude = init.Contains<AltitudeInit>() ? init.Get<AltitudeInit,int>() : 0;
Info = info;
}
示例2: Aircraft
public Aircraft( ActorInitializer init , AircraftInfo info)
{
this.self = init.self;
if( init.Contains<LocationInit>() )
this.SubPxPosition = 1024 * Util.CenterOfCell( init.Get<LocationInit, int2>() );
this.Facing = init.Contains<FacingInit>() ? init.Get<FacingInit,int>() : info.InitialFacing;
this.Altitude = init.Contains<AltitudeInit>() ? init.Get<AltitudeInit,int>() : 0;
Info = info;
}
示例3: GetInitialTurretFacing
public static int GetInitialTurretFacing(ActorInitializer init, int def)
{
if (init.Contains<TurretFacingInit>())
return init.Get<TurretFacingInit,int>();
if (init.Contains<FacingInit>())
return init.Get<FacingInit,int>();
return def;
}
示例4: BodyOrientation
public BodyOrientation(ActorInitializer init, BodyOrientationInfo info)
{
this.info = info;
var self = init.Self;
var faction = init.Contains<FactionInit>() ? init.Get<FactionInit, string>() : self.Owner.Faction.InternalName;
quantizedFacings = Exts.Lazy(() =>
{
// Override value is set
if (info.QuantizedFacings >= 0)
return info.QuantizedFacings;
var qboi = self.Info.TraitInfoOrDefault<IQuantizeBodyOrientationInfo>();
// If a sprite actor has neither custom QuantizedFacings nor a trait implementing IQuantizeBodyOrientationInfo, throw
if (qboi == null)
{
if (self.Info.HasTraitInfo<WithSpriteBodyInfo>())
throw new InvalidOperationException("Actor '" + self.Info.Name + "' has a sprite body but no facing quantization."
+ " Either add the QuantizeFacingsFromSequence trait or set custom QuantizedFacings on BodyOrientation.");
else
throw new InvalidOperationException("Actor type '" + self.Info.Name + "' does not define a quantized body orientation.");
}
return qboi.QuantizedBodyFacings(self.Info, self.World.Map.Rules.Sequences, faction);
});
}
示例5: Transforms
public Transforms(ActorInitializer init, TransformsInfo info)
{
self = init.Self;
this.info = info;
buildingInfo = self.World.Map.Rules.Actors[info.IntoActor].TraitInfoOrDefault<BuildingInfo>();
faction = init.Contains<FactionInit>() ? init.Get<FactionInit, string>() : self.Owner.Faction.InternalName;
}
示例6: AttackPopupTurreted
public AttackPopupTurreted(ActorInitializer init, AttackPopupTurretedInfo info)
: base(init.self)
{
Info = info;
buildComplete = init.Contains<SkipMakeAnimsInit>();
turret = turrets.FirstOrDefault();
}
示例7: Turreted
public Turreted(ActorInitializer init, TurretedInfo info)
{
this.info = info;
turretFacing = info.InitialFacing;
turretFacing = init.Contains<FacingInit>() ? init.Get<FacingInit,int>() : info.InitialFacing;
facing = init.self.TraitOrDefault<IFacing>();
}
示例8: Transforms
public Transforms(ActorInitializer init, TransformsInfo info)
{
self = init.self;
this.info = info;
bi = self.World.Map.Rules.Actors[info.IntoActor].Traits.GetOrDefault<BuildingInfo>();
race = init.Contains<RaceInit>() ? init.Get<RaceInit, string>() : self.Owner.Country.Race;
}
示例9: Mobile
public Mobile(ActorInitializer init, MobileInfo info)
{
this.self = init.self;
this.Info = info;
uim = self.World.WorldActor.Trait<UnitInfluence>();
if (init.Contains<LocationInit>())
{
this.__fromCell = this.__toCell = init.Get<LocationInit, int2>();
this.PxPosition = Util.CenterOfCell(fromCell);
}
this.Facing = init.Contains<FacingInit>() ? init.Get<FacingInit, int>() : info.InitialFacing;
this.Altitude = init.Contains<AltitudeInit>() ? init.Get<AltitudeInit, int>() : 0;
}
示例10: Husk
public Husk(ActorInitializer init)
{
this.self = init.self;
this.location = init.Get<LocationInit,int2>();
this.Facing = init.Contains<FacingInit>() ? init.Get<FacingInit,int>() : 128;
self.World.WorldActor.Trait<UnitInfluence>().Add(self, this);
}
示例11: AttackPopupTurreted
public AttackPopupTurreted(ActorInitializer init, AttackPopupTurretedInfo info)
: base(init.self)
{
Info = info;
Turret = init.self.Trait<Turreted>();
if (init.Contains<SkipMakeAnimsInit>())
buildComplete = true;
}
示例12: RenderBuilding
public RenderBuilding( ActorInitializer init, Func<int> baseFacing )
: base(init.self, baseFacing)
{
var self = init.self;
if( init.Contains<SkipMakeAnimsInit>() || !self.Info.Traits.Get<RenderBuildingInfo>().HasMakeAnimation )
anim.PlayThen( "idle", () => self.World.AddFrameEndTask( _ => Complete( self ) ) );
else
anim.PlayThen( "make", () => self.World.AddFrameEndTask( _ => Complete( self ) ) );
}
示例13: Mobile
public Mobile(ActorInitializer init, MobileInfo info)
{
this.self = init.self;
this.Info = info;
toSubCell = fromSubCell = info.SharesCell ? SubCell.Center : SubCell.FullCell;
if (init.Contains<SubCellInit>())
{
this.fromSubCell = this.toSubCell = init.Get<SubCellInit, SubCell>();
}
if (init.Contains<LocationInit>())
{
this.__fromCell = this.__toCell = init.Get<LocationInit, int2>();
this.PxPosition = Util.CenterOfCell(fromCell) + info.SubCellOffsets[fromSubCell];
}
this.Facing = init.Contains<FacingInit>() ? init.Get<FacingInit, int>() : info.InitialFacing;
this.Altitude = init.Contains<AltitudeInit>() ? init.Get<AltitudeInit, int>() : 0;
}
示例14: ProvidesPrerequisite
public ProvidesPrerequisite(ActorInitializer init, ProvidesPrerequisiteInfo info)
{
this.info = info;
prerequisite = info.Prerequisite;
if (string.IsNullOrEmpty(prerequisite))
prerequisite = init.Self.Info.Name;
var race = init.Contains<RaceInit>() ? init.Get<RaceInit, string>() : init.Self.Owner.Country.Race;
Update(init.Self.Owner, race);
}
示例15: ProvidesPrerequisite
public ProvidesPrerequisite(ActorInitializer init, ProvidesPrerequisiteInfo info)
{
this.info = info;
prerequisite = info.Prerequisite;
if (string.IsNullOrEmpty(prerequisite))
prerequisite = init.Self.Info.Name;
var faction = init.Contains<FactionInit>() ? init.Get<FactionInit, string>() : init.Self.Owner.Faction.InternalName;
Update(init.Self.Owner, faction);
}