Пример #1
0
        private void DrawUI(SpriteBatch spriteBatch, Hud hud, GameTime gameTime)
        {
            spriteBatch.Draw(pointer, Carrier.CursorPosition + hud.Camera, null, new Color(Color.R, Color.G, Color.B, 0.3f), (float)gameTime.TotalGameTime.TotalSeconds * MathHelper.TwoPi / 10, pointer.TextureOrigin, 1, SpriteEffects.None, DrawOrder.Flyer - 0.04f);

            if (gameTime.TotalGameTime < showDamageTimer + showTimeout)
            {
                var t   = gameTime.TotalGameTime - showDamageTimer;
                var col = new Color(1, 1, 1, t > showTimeout - fadeDuration ? 1 - (float)(t - showTimeout + fadeDuration).TotalSeconds / (float)fadeDuration.TotalSeconds : 1);
                var pos = Carrier.Position + hud.Camera + hullPosition - Carrier.Sprite.TextureOrigin;

                spriteBatch.Draw(hull, pos.Round(), null, col, 0, Vector2.Zero, 1, SpriteEffects.None, DrawOrder.UI);
                for (int i = 0; i < (int)(8 * (Carrier.Hitpoints / (float)Carrier.MaxHitpoints)); i++)
                {
                    spriteBatch.Draw(hullPoint, (new Vector2(i * (hullPoint.Texture.Width + 1), 0) + pos + hullPointPosition).Round(), null, col, 0, Vector2.Zero, 1, SpriteEffects.None, DrawOrder.UI);
                }
            }

            for (int i = 0; i < 4; i++)
            {
                if (gameTime.TotalGameTime < showDeploySlotTimer[i] + showTimeout)
                {
                    var t   = gameTime.TotalGameTime - showDeploySlotTimer[i];
                    var col = new Color(1, 1, 1, t > showTimeout - fadeDuration ? 1 - (float)(t - showTimeout + fadeDuration).TotalSeconds / (float)fadeDuration.TotalSeconds : 1);
                    var pos = Carrier.Position + hud.Camera + incPosition[i] - Carrier.Sprite.TextureOrigin;
                    spriteBatch.Draw(i < 2 ? incLeft : incRight, pos.Round(), null, col, 0, Vector2.Zero, 1, SpriteEffects.None, DrawOrder.UI);

                    for (int f = 0; f < Carrier.Slots[i].TotalFlyers; f++)
                    {
                        var sprite = Carrier.Slots[i].Flyers[f].Icon;
                        var icoPos = (pos + incPointPosition[i] + new Vector2(f * (1 + sprite.Texture.Width), 0)).Round();
                        var color  = new Color(Carrier.Slots[i].Flyers[f].StatusColor.R, Carrier.Slots[i].Flyers[f].StatusColor.G, Carrier.Slots[i].Flyers[f].StatusColor.B, col.A);

                        spriteBatch.Draw(sprite, icoPos, null, color, 0, Vector2.Zero, 1, SpriteEffects.None, DrawOrder.UI);
                    }
                }
            }

            if (gameTime.TotalGameTime < showEngineTimer + showTimeout)
            {
                var t   = gameTime.TotalGameTime - showEngineTimer;
                var col = new Color(1, 1, 1, t > showTimeout - fadeDuration ? 1 - (float)(t - showTimeout + fadeDuration).TotalSeconds / (float)fadeDuration.TotalSeconds : 1);
                var pos = Carrier.Position + hud.Camera + enginePosition - Carrier.Sprite.TextureOrigin;

                spriteBatch.Draw(engine, pos.Round(), null, col, 0, Vector2.Zero, 1, SpriteEffects.None, DrawOrder.UI);
                spriteBatch.Draw(engineBar, (pos + engineBarPosition).Round(),
                                 new Rectangle(0, 0, (int)(engineBar.Texture.Width * Carrier.Fuel / Carrier.MaxFuel), engineBar.Texture.Height),
                                 col, 0, Vector2.Zero, 1, SpriteEffects.None, DrawOrder.UI);
            }
        }
        public GameControl(Game game)
            : base(game)
        {
            input = new InputProvider(game);
            particles = new ParticleProvider();
            Stars = new StarField(game, 2, 1, 0.5f);
            FrontPlotter = new PrimitiveDraw(game);
            BackPlotter = new PrimitiveDraw(game);

            Hud = new Hud(game);
            text = new TextInterface(game, new Vector2(1360, 730));

            extensions = new ExtensionsManager();
            
        }
Пример #3
0
        public override void Draw(SpriteBatch spriteBatch, Hud hud, GameTime gameTime)
        {
            foreach (var elem in tentacle)
            {
                spriteBatch.Draw(elem.Sprite, Position + hud.Camera, null, Color.White, elem.Angle + elem.Angle * (float)gameTime.TotalGameTime.TotalSeconds, new Vector2(0, elem.Sprite.TextureOrigin.Y), Scale, SpriteEffects.None, DrawOrder.Flyer - 0.01f);
            }

            base.Draw(spriteBatch, hud, gameTime);

            var eyeColor = new Color(
                (byte)(Math.Sin(gameTime.TotalGameTime.Milliseconds / 1000f * MathHelper.TwoPi) * 255 / 2 + 255 / 2),
                (byte)(Math.Cos(gameTime.TotalGameTime.Milliseconds / 1000f * MathHelper.TwoPi) * 255 / 2 + 255 / 2),
                (byte)(Math.Tan(gameTime.TotalGameTime.Milliseconds / 1000f * MathHelper.TwoPi) * 255 / 2 + 255 / 2),
                255);

            spriteBatch.Draw(eye, IntPosition ? (Position + hud.Camera).Round() : Position + hud.Camera, null, eyeColor, MathHelper.PiOver2 + Angle, eye.TextureOrigin, Scale, SpriteEffects.None, DrawOrder.Flyer + 0.01f);
        }
Пример #4
0
        public D1Enemy(Hud hud, Fraction fraction)
            : base(hud, fraction)
        {
            Sprite          = new SpriteSheet("s\\Tripping-Octo-Nemesis-Base");
            Status          = Conditions.Airborne;
            Speed           = 1000 / 16 + 10;
            AngleSpeed      = 1;
            Angle           = 0;
            availableFlyer  = 9;
            packSize        = 3;
            currentPackSize = 3;
            deployCooldown  = TimeSpan.FromSeconds(10);
            deployDuration  = TimeSpan.FromMilliseconds(500);
            Class           = ShipClasses.Carrier;

            SetEngines(0, null);
        }
        public Carrier(Hud hud, Fraction fraction)
            : base(fraction)
        {
            Sprite = new SpriteSheet("s\\mothership");
            Speed  = hud.CameraSpeed.Y;
            Angle  = -MathHelper.PiOver2;

            SetEngines(150,
                       new Vector2(-Sprite.TextureOrigin.Y + 2, -18),
                       new Vector2(-Sprite.TextureOrigin.Y + 2, 18),
                       new Vector2(-Sprite.TextureOrigin.Y + 2, -16),
                       new Vector2(-Sprite.TextureOrigin.Y + 2, 16));

            Hitpoints            = 100;
            MaxHitpoints         = 100;
            IntPosition          = true;
            Status               = Conditions.Airborne;
            additionalLayerDepth = -0.02f;
            Weapon               = null;
            Carrier              = this;
            Class = ShipClasses.Carrier;
            Ki    = new SpaceShip.NoScreenMovement();
        }
Пример #6
0
        public virtual void Draw(SpriteBatch spriteBatch, Hud hud, GameTime gameTime)
        {
            if (DeleteFlag)
            {
                return;
            }
            if (!IsAirborne)
            {
                return;
            }

            spriteBatch.Draw(Sprite, IntPosition ? (Position + hud.Camera).Round() : Position + hud.Camera, gameTime, Color, Sprite.TextureOrigin, MathHelper.PiOver2 + Angle, Scale, DrawOrder.Flyer + additionalLayerDepth + depthVarriation);
            //spriteBatch.Draw(Sprite, IntPosition ? (Position + hud.Camera).Round() : Position + hud.Camera, null, Color, MathHelper.PiOver2 + Angle, Sprite.TextureOrigin, Scale, SpriteEffects.None, DrawOrder.Flyer+additionalLayerDepth);
            for (int i = 0; i < track.Count; i++)
            {
                float f = i / (float)trackLength;
                spriteBatch.DrawRectangle(track[i] + hud.Camera, 1, 1, new Color(f, 0.5f * f, 0, f), DrawOrder.Flyer - 0.01f + additionalLayerDepth);
            }
            if (Weapon != null)
            {
                Weapon.Draw(spriteBatch, gameTime);
            }
        }
Пример #7
0
        public override void Update(GameTime gameTime, Hud hud)
        {
            base.Update(gameTime, hud);

            HandleInput(gameTime, hud);
        }
Пример #8
0
        public override void Draw(SpriteBatch spriteBatch, Hud hud, GameTime gameTime)
        {
            base.Draw(spriteBatch, hud, gameTime);

            DrawUI(spriteBatch, hud, gameTime);
        }
 public virtual void Draw(SpriteBatch spriteBatch, Hud hud, GameTime gameTime)
 {
 }
        public virtual void Update(GameTime gameTime, Hud hud)
        {
            base.Update(gameTime);

            lastUpdate = gameTime.TotalGameTime;
        }