Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        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);
            }
        }
Ejemplo n.º 3
0
        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;
        }
Ejemplo n.º 4
0
        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;
            }
        }
Ejemplo n.º 5
0
        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;
            }
        }
Ejemplo n.º 6
0
        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;
            }
        }
Ejemplo n.º 7
0
 public static int GetFacing(PVecInt d, int currentFacing)
 {
     return(GetFacing(d.ToInt2(), currentFacing));
 }
Ejemplo n.º 8
0
        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;
        }
Ejemplo n.º 9
0
        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;
        }