public TDGunboat(ActorInitializer init, TDGunboatInfo info) { Info = info; self = init.Self; var locationInit = init.GetOrDefault <LocationInit>(); if (locationInit != null) { SetPosition(self, locationInit.Value); } var centerPositionInit = init.GetOrDefault <CenterPositionInit>(); if (centerPositionInit != null) { SetPosition(self, centerPositionInit.Value); } Facing = init.GetValue <FacingInit, WAngle>(Info.GetInitialFacing()); // Prevent mappers from setting bogus facings if (Facing != Left && Facing != Right) { Facing = Facing.Angle > 511 ? Right : Left; } }
public TDGunboat(ActorInitializer init, TDGunboatInfo info) { Info = info; self = init.Self; if (init.Contains <LocationInit>()) { SetPosition(self, init.Get <LocationInit, CPos>()); } if (init.Contains <CenterPositionInit>()) { SetPosition(self, init.Get <CenterPositionInit, WPos>()); } Facing = init.Contains <FacingInit>() ? init.Get <FacingInit, int>() : Info.GetInitialFacing(); // Prevent mappers from setting bogus facings if (Facing != 64 && Facing != 192) { Facing = Facing > 127 ? 192 : 64; } }