public Missile(MissileInfo info, ProjectileArgs args) { Info = info; Args = args; SubPxPosition = Args.src.ToPSubPos(); Altitude = Args.srcAltitude; Facing = Args.facing; if (info.Inaccuracy > 0) offset = (PVecInt)(info.Inaccuracy * args.firedBy.World.SharedRandom.Gauss2D(2)).ToInt2(); if (Info.Image != null) { anim = new Animation(Info.Image, () => Facing); anim.PlayRepeating("idle"); } if (Info.ContrailLength > 0) { Trail = new ContrailHistory(Info.ContrailLength, Info.ContrailUsePlayerColor ? ContrailHistory.ChooseColor(args.firedBy) : Info.ContrailColor, Info.ContrailDelay); } }
public Missile(MissileInfo info, ProjectileArgs args) { Info = info; Args = args; SubPxPosition = Args.src.ToPSubPos(); Altitude = Args.srcAltitude; Facing = Args.facing; if (info.Inaccuracy > 0) { offset = (PVecInt)(info.Inaccuracy * args.firedBy.World.SharedRandom.Gauss2D(2)).ToInt2(); } if (Info.Image != null) { anim = new Animation(Info.Image, () => Facing); anim.PlayRepeating("idle"); } if (Info.ContrailLength > 0) { Trail = new ContrailHistory(Info.ContrailLength, Info.ContrailUsePlayerColor ? ContrailHistory.ChooseColor(args.firedBy) : Info.ContrailColor, Info.ContrailDelay); } }
public NukeLaunch(Player firedBy, Actor silo, string weapon, PVecInt spawnOffset, CPos targetLocation) { this.firedBy = firedBy; this.targetLocation = targetLocation; this.weapon = weapon; anim = new Animation(weapon); anim.PlayRepeating("up"); if (silo == null) { altitude = firedBy.World.Map.Bounds.Height*Game.CellSize; StartDescent(firedBy.World); } else pos = silo.CenterLocation + spawnOffset; }
public NukeLaunch(Player firedBy, Actor silo, string weapon, PVecInt spawnOffset, CPos targetLocation) { this.firedBy = firedBy; this.targetLocation = targetLocation; this.weapon = weapon; anim = new Animation(weapon); anim.PlayRepeating("up"); if (silo == null) { altitude = firedBy.World.Map.Bounds.Height * Game.CellSize; StartDescent(firedBy.World); } else { pos = silo.CenterLocation + spawnOffset; } }
public void Tick(Actor self) { if (--ticks <= 0) { var move = self.Trait<IMove>(); if (move.Altitude > 0 && self.GetDamageState() >= DamageState.Heavy) { var facing = self.Trait<IFacing>(); var altitude = new PVecInt(0, move.Altitude); position = (self.CenterLocation - (PVecInt)Combat.GetTurretPosition(self, facing, smokeTurret).ToInt2()); if (self.World.RenderedShroud.IsVisible(position.ToCPos())) self.World.AddFrameEndTask( w => w.Add(new Smoke(w, position - altitude, "smokey"))); } ticks = interval; } }
public void Tick(Actor self) { if (--ticks <= 0) { var move = self.Trait <IMove>(); if (move.Altitude > 0 && self.GetDamageState() >= DamageState.Heavy) { var facing = self.Trait <IFacing>(); var altitude = new PVecInt(0, move.Altitude); position = (self.CenterLocation - Combat.GetTurretPosition(self, facing, smokeTurret)); if (self.World.LocalShroud.IsVisible(position.ToCPos())) { self.World.AddFrameEndTask( w => w.Add(new Smoke(w, position - altitude, "smokey"))); } } ticks = interval; } }
public static int GetFacing(PVecInt d, int currentFacing) { return(GetFacing(d.ToInt2(), currentFacing)); }
public PVecInt ScreenSpacePosition; // screen-space hack to make things line up good. public Turret(int[] offset, float recoilRecovery) { ScreenSpacePosition = (PVecInt)offset.AbsOffset().ToInt2(); UnitSpacePosition = (PVecInt)offset.RelOffset().ToInt2(); RecoilRecovery = recoilRecovery; }
public PVecInt UnitSpacePosition; // where, in the unit's local space. #endregion Fields #region Constructors public Turret(int[] offset, float recoilRecovery) { ScreenSpacePosition = (PVecInt) offset.AbsOffset().ToInt2(); UnitSpacePosition = (PVecInt) offset.RelOffset().ToInt2(); RecoilRecovery = recoilRecovery; }