public RenderVoxels(Actor self, RenderVoxelsInfo info) { this.self = self; this.info = info; body = self.Trait <IBodyOrientation>(); camera = new WRot(WAngle.Zero, body.CameraPitch - new WAngle(256), new WAngle(256)); lightSource = new WRot(WAngle.Zero, new WAngle(256) - info.LightPitch, info.LightYaw); }
public WithCargo(Actor self, WithCargoInfo info) { cargo = self.Trait <Cargo>(); facing = self.TraitOrDefault <IFacing>(); cargoInfo = info; body = self.Trait <IBodyOrientation>(); }
public Contrail(Actor self, ContrailInfo info) { this.info = info; var color = info.UsePlayerColor ? ContrailRenderable.ChooseColor(self) : info.Color; trail = new ContrailRenderable(self.World, color, info.TrailLength, 0, 0); body = self.Trait <IBodyOrientation>(); }
public WithVoxelTurret(Actor self, WithVoxelTurretInfo info) { this.self = self; body = self.Trait <IBodyOrientation>(); turreted = self.TraitsImplementing <Turreted>() .First(tt => tt.Name == info.Turret); var rv = self.Trait <RenderVoxels>(); rv.Add(new VoxelAnimation(VoxelProvider.GetVoxel(rv.Image, info.Sequence), () => turreted.Position(self), () => TurretRotation(), () => false, () => 0)); }
public WithCargo(Actor self, WithCargoInfo info) { cargo = self.Trait <Cargo>(); facing = self.TraitOrDefault <IFacing>(); cargoInfo = info; body = self.Trait <IBodyOrientation>(); if (info.LocalOffset.Length == 0) { throw new InvalidOperationException("LocalOffset must have at least one entry"); } }
public WithVoxelBarrel(Actor self, WithVoxelBarrelInfo info) { this.self = self; this.info = info; body = self.Trait <IBodyOrientation>(); armament = self.TraitsImplementing <Armament>() .First(a => a.Info.Name == info.Armament); turreted = self.TraitsImplementing <Turreted>() .First(tt => tt.Name == armament.Info.Turret); var rv = self.Trait <RenderVoxels>(); rv.Add(new VoxelAnimation(VoxelProvider.GetVoxel(rv.Image, info.Sequence), BarrelOffset, BarrelRotation, () => false, () => 0)); }
public WithCargo(Actor self, WithCargoInfo info) { cargo = self.Trait <Cargo>(); facing = self.TraitOrDefault <IFacing>(); cargoInfo = info; body = self.Trait <IBodyOrientation>(); if (info.LocalOffset.Length % 3 != 0) { throw new InvalidOperationException("Invalid LocalOffset array length"); } positions = new WVec[info.LocalOffset.Length / 3]; for (var i = 0; i < info.LocalOffset.Length / 3; i++) { positions[i] = new WVec(info.LocalOffset[3 * i], info.LocalOffset[3 * i + 1], info.LocalOffset[3 * i + 2]); } }
public WithTurret(Actor self, WithTurretInfo info) : base(info) { rs = self.Trait <RenderSprites>(); body = self.Trait <IBodyOrientation>(); Attack = self.TraitOrDefault <AttackBase>(); t = self.TraitsImplementing <Turreted>() .First(tt => tt.Name == info.Turret); arms = self.TraitsImplementing <Armament>() .Where(w => w.Info.Turret == info.Turret).ToArray(); DefaultAnimation = new Animation(self.World, rs.GetImage(self), () => t.TurretFacing); DefaultAnimation.PlayRepeating(NormalizeSequence(self, info.Sequence)); rs.Add(new AnimationWithOffset( DefaultAnimation, () => TurretOffset(self), () => IsTraitDisabled, () => false, p => ZOffsetFromCenter(self, p, 1))); // Restrict turret facings to match the sprite t.QuantizedFacings = DefaultAnimation.CurrentSequence.Facings; }
public WithTurret(Actor self, WithTurretInfo info) { this.info = info; rs = self.Trait <RenderSprites>(); body = self.Trait <IBodyOrientation>(); ab = self.TraitOrDefault <AttackBase>(); t = self.TraitsImplementing <Turreted>() .First(tt => tt.Name == info.Turret); arms = self.TraitsImplementing <Armament>() .Where(w => w.Info.Turret == info.Turret); anim = new Animation(rs.GetImage(self), () => t.turretFacing); anim.Play(info.Sequence); rs.anims.Add("turret_{0}".F(info.Turret), new AnimationWithOffset( anim, () => TurretOffset(self), null, p => ZOffsetFromCenter(self, p, 1))); // Restrict turret facings to match the sprite t.QuantizedFacings = anim.CurrentSequence.Facings; }
public WithBarrel(Actor self, WithBarrelInfo info) { this.self = self; this.info = info; body = self.Trait <IBodyOrientation>(); armament = self.TraitsImplementing <Armament>() .First(a => a.Info.Name == info.Armament); turreted = self.TraitsImplementing <Turreted>() .First(tt => tt.Name == armament.Info.Turret); var rs = self.Trait <RenderSprites>(); anim = new Animation(self.World, rs.GetImage(self), () => turreted.TurretFacing); anim.Play(info.Sequence); rs.Add(new AnimationWithOffset( anim, () => BarrelOffset(), null, () => false, p => WithTurret.ZOffsetFromCenter(self, p, 0))); // Restrict turret facings to match the sprite turreted.QuantizedFacings = anim.CurrentSequence.Facings; }
public NukePower(Actor self, NukePowerInfo info) : base(self, info) { body = self.Trait <IBodyOrientation>(); this.info = info; }
public SmokeTrailWhenDamaged(Actor self, SmokeTrailWhenDamagedInfo info) { this.info = info; body = self.Trait <IBodyOrientation>(); }
public void Created(Actor self) { attack = self.TraitOrDefault <AttackTurreted>(); facing = self.TraitOrDefault <IFacing>(); body = self.Trait <IBodyOrientation>(); }