Exemplo n.º 1
0
 public SkyboxModel(Model model, Ship ship)
     : base(model)
 {
     this.model = model;
     this.ship = ship;
     scale = new Vector3(100, 120, 100);
 }
Exemplo n.º 2
0
        public Sentry(Game1 game, EnemyManager manager, Vector3 pos)
        {
            this.game = game;
            this.manager = manager;
            this.pos = pos;
            ship = game.ship;

            wakeRange = new CircleCollider(pos, 30);
            sleepRange = new CircleCollider(pos, 40);
            col = new CircleCollider(pos, 1.5f);
            state = State.idle;
            prevState = state;

            model = new SentryModel(this, game);
            game.modelManager.addEnemy(model);

            targetDir = Vector3.Forward;
            eyeDir = targetDir;
            cannonDir = targetDir;
            cooldownTime = 2;
            emoteTime = 0;
            health = 25;
            agroFireCount = 0;

            triggeredTele = false;

            telegraph = new EnemyShotTelegraph(game, pos - targetDir*2, targetDir, 1);
            game.modelManager.addEffect(telegraph);

            nodePos = new Vector2((int)((pos.X / 30) + 0.5f), (int)((pos.Z / 30) + 0.5f));
        }
Exemplo n.º 3
0
        public JunkShip(Game1 game, Vector3 pos)
        {
            this.game = game;
            this.pos = pos;
            minigame = game.minigame;
            instance = new MgInstance(game, minigame);
            ship = game.ship;
            dir.X = Utilities.nextFloat() * 2 - 1;
            dir.Z = Utilities.nextFloat() * 2 - 1;
            dir.Normalize();
            successAtActivate = -1;

            interactRange = new CircleCollider(this.pos + dir*4, 2);

            cols = new List<OOBB>();
            cols.Add(new OOBB(this.pos + dir * 1.5f, dir, 1, 4, dir));
            cols.Add(new OOBB(this.pos + dir * -1.5f, dir, 1, 4, -dir));
            cols.Add(new OOBB(this.pos + Vector3.Cross(dir, Vector3.Up) * -1.5f, dir, 1, 4, Vector3.Cross(-dir, Vector3.Up)));
            cols.Add(new OOBB(this.pos + Vector3.Cross(-dir, Vector3.Up) * -1.5f, dir, 1, 4, Vector3.Cross(dir, Vector3.Up)));

            col = new OOBB(this.pos+dir*1.5f, dir, 1, 4, dir);

            model = new JunkShipModel(this, game);
            game.modelManager.addObject(model);
            nodePos = new Vector2((int)((this.pos.X / 30) + 0.5f), (int)((this.pos.Z / 30) + 0.5f));

            destroying = false;
        }
Exemplo n.º 4
0
        public AmmoGib(MoneyManager mon, Ship ship, Vector3 pos, Game1 game, int type)
            : base()
        {
            this.value = value;
            this.model = ModelLibrary.bombProjectile;
            this.pos = pos;
            this.ship = ship;
            this.game = game;
            this.type = type;
            moneyManager = mon;
            weps = ship.weapons;
            scale = new Vector3(.3f, .3f, .3f);

            setColor(type);

            glow = new MoneyGibGlow(TextureManager.square, this, game);
            game.modelManager.addEffect(glow);

            initDirection.X = (float)Utilities.random.NextDouble()*2-1;
            initDirection.Y = (float)Utilities.random.NextDouble()*2-1;
            initDirection.Z = (float)Utilities.random.NextDouble()*2-1;
            initDirection.Normalize();

            currentDirection = initDirection;

            rot = currentDirection;

            speed = Utilities.nextFloat()*5+17;
            changeDirectionSpeed = Utilities.nextFloat() + 4.5f;

            col = new CircleCollider(pos, 0.05f);
            collected = false;
        }
Exemplo n.º 5
0
        public ShipHealthSystem(Game1 game, Ship ship)
            : base(game)
        {
            this.game = game;
            this.ship = ship;

            reset();
        }
Exemplo n.º 6
0
 public SpeedCylModel(Model model, Ship ship, Game1 game)
     : base(model)
 {
     this.model = model;
     this.ship = ship;
     this.game = game;
     scale = new Vector3(100, 100, 100);
     offset = -25;
 }
Exemplo n.º 7
0
 public Weapon(WeaponSystem wepSys, Ship ship, Game1 game)
 {
     this.wepSys = wepSys;
     this.ship = ship;
     this.game = game;
     cooldown = 0;
     level = 1;
     projectiles = new List<Projectile>();
     toDelete = new List<Projectile>();
 }
Exemplo n.º 8
0
        public ShipParticleSystem(Game1 game, Ship ship)
            : base(game)
        {
            this.game = game;
            this.ship = ship;

            addThrustParticle(0);
            thrustGenTime = 0;
            currentlyBoosting = false;
            currentlyMoving = false;
        }
Exemplo n.º 9
0
 public HudRespawn(Hud hud, SpriteFont font, Game1 game)
 {
     active = true;
     state = 5;
     time = 1.5f;
     this.hud = hud;
     this.font = font;
     this.game = game;
     ship = game.ship;
     updateText();
 }
Exemplo n.º 10
0
        public Hud(Game1 game, SpriteFont font, SpriteBatch spriteBatch, GraphicsDevice graphicsDevice)
            : base(game)
        {
            this.game = game;
            ship = game.ship;
            this.font = font;
            this.spriteBatch = spriteBatch;
            this.graphicsDevice = graphicsDevice;

            hudMoney = new HudMoney(this, font, game);
            hudWeapon = new HudWeapon(this, font, game);
            hudHealth = new HudHealth(this, font, game);
            hudState = new HudState(this, font, game);
            hudMap = new HudMap(this, font, game);
            hudMessage = new HudMessage(this, font, game);
            hudMg = new HudMg(this, game.Content.Load<SpriteFont>(@"Hud/Venera900big"), game);
            hudCollectable = new HudCollectable(this, font, game);

            viewportW = game.GraphicsDevice.Viewport.Width;
            viewportH = game.GraphicsDevice.Viewport.Height;

            hudAttackDisplayer = new HudAttackDisplayer(game, this);
            quickSelect = new QuickSelect(this, game, font);
            expSelect = new ExpSelect(this, game, font);
            turSelect = new TurretSelect(this, game, font);
            hudPrompt = new HudPrompt(this, game, font);
            respawn = new HudRespawn(this, hudMg.font, game);
            hudHelp = new HudHelp(this, game, font);
            hudEnd = new HudEnd(this, game);
            hudZoom = new HudZoom(this, game);

            position = new Vector2(0, 0);
            contPrimary = Color.White;
            contSecondary = new Color(174, 215, 255);
            outline = new Color(0, 64, 127);
            fill = new Color(0, 16, 73, 179);
            redBody = new Color(181, 77, 102);
            blueBody = new Color(86, 124, 193);

            whiteTex = new Texture2D(graphicsDevice, 1, 1);
            whiteTex.SetData(new Color[] { Color.White });
            flashTime = 15;

            scale = (float)game.GraphicsDevice.Viewport.Bounds.Width / 1920.0f;

            butA = game.Content.Load<Texture2D>(@"Hud/butA");
            butB = game.Content.Load<Texture2D>(@"Hud/butB");
            butX = game.Content.Load<Texture2D>(@"Hud/butX");
            butY = game.Content.Load<Texture2D>(@"Hud/butY");
            endO = game.Content.Load<Texture2D>(@"Hud/endO");
            endF = game.Content.Load<Texture2D>(@"Hud/endF");
        }
Exemplo n.º 11
0
        public WeaponMissiles(WeaponSystem wepSys, Ship ship, Game1 game)
            : base(wepSys, ship, game)
        {
            icon = TextureManager.icoAst;
            name = "Asteroid sorter";

            damage = 0.25f;
            rateOfFire = 0.9f;
            range = 0.9f;

            coolMax = 15;
            laserPos = 0;
            EXPMAX = 250;
        }
Exemplo n.º 12
0
        public Camera(Game1 game, Vector3 pos, Vector3 target, Vector3 up)
            : base(game)
        {
            // Build camera view matrix
            this.game = game;
            ship = game.ship;
            cameraPosition = pos;
            cameraUp = up;
            lookAt = target;
            CreateLookAt();
            projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.Pi/3, (float)Game.Window.ClientBounds.Width /
                (float)Game.Window.ClientBounds.Height, 1, 3000);

            shakeTime = 0;
            shakeConstant = 1;
        }
Exemplo n.º 13
0
        public WeaponWave(WeaponSystem wepSys, Ship ship, Game1 game)
            : base(wepSys, ship, game)
        {
            icon = TextureManager.icoWave;
            name = "Pulse Generator";
            ammoName = "Wave";

            damage = 0.7f;
            rateOfFire = 0.4f;
            range = 0.3f;

            coolMax = 90;
            ammoMax = 24;
            ammo = ammoMax;

            EXPMAX = 250;
        }
Exemplo n.º 14
0
        public WeaponBomb(WeaponSystem wepSys, Ship ship, Game1 game)
            : base(wepSys, ship, game)
        {
            icon = TextureManager.icoBomb;
            name = "Exobomb";

            rateOfFire = 0.2f;
            damage = 1;
            range = 0.8f;
            coolMax = 90;
            softCoolmax = 60;
            ammoMax = 8;
            ammo = ammoMax;
            EXPMAX = 250;

            splos = new List<BombExplosion>();
            sploToDelete = new List<BombExplosion>();
        }
Exemplo n.º 15
0
        public WeaponLaser(WeaponSystem wepSys, Ship ship, Game1 game)
            : base(wepSys, ship, game)
        {
            icon = TextureManager.icoPew;
            name = "Laser Cutters";
            ammoName = "Charge";

            damage = 0.3f;
            rateOfFire = 0.9f;
            range = 0.9f;

            coolMax = 15;
            laserPos = 0;

            ammoMax = 200;
            ammo = ammoMax;

            EXPMAX = 250;
        }
Exemplo n.º 16
0
        public MoneyGib(float value, Model model, MoneyManager moneyManager, Ship ship, Vector3 pos, Game1 game, int type)
            : base()
        {
            this.value = value;

            if (type == 4)
            {
                this.model = ModelLibrary.polyGib;
                scale = new Vector3(.15f, .15f, .15f);
            }
            else
            {
                this.model = model;
                scale = new Vector3(.03f, .03f, .03f);
            }

            this.pos = pos;
            this.moneyManager = moneyManager;
            this.ship = ship;
            this.game = game;

            setColor(type);

            glow = new MoneyGibGlow(TextureManager.square, this, game);
            game.modelManager.addEffect(glow);

            initDirection.X = (float)Utilities.random.NextDouble()*2-1;
            initDirection.Y = (float)Utilities.random.NextDouble()*2-1;
            initDirection.Z = (float)Utilities.random.NextDouble()*2-1;
            initDirection.Normalize();

            currentDirection = initDirection;

            rot = currentDirection;

            speed = Utilities.nextFloat()*5+17;
            changeDirectionSpeed = Utilities.nextFloat() + 4.5f;

            col = new CircleCollider(pos, 0.05f);
            collected = false;
        }
Exemplo n.º 17
0
        public RainbowTunnelModel(Model model, Ship ship, Game game)
            : base(model)
        {
            this.model = model;
            this.ship = ship;
            this.game = game;
            scale = new Vector3(200, 200, 200);
            offset = -2;

            texPos1 = new Vector2(0, 0);
            rTarg = new RenderTarget2D(game.GraphicsDevice, 2048, 2048);
            sb = new SpriteBatch(game.GraphicsDevice);
            //rBow = game.Content.Load<Texture2D>(@"Hud/hudMapF");
            //rBow = game.Content.Load<Texture2D>(@"Hud/rainbowTunnel");
            rBow = game.Content.Load<Texture2D>(@"Models/Misc/Rbow/rbowTunnelt");
            glow = game.Content.Load<Texture2D>(@"Models/Effects/tex1");
            endGlow = game.Content.Load<Model>(@"Models/Misc/square");

            depthStencilState = new DepthStencilState();
            depthStencilState.DepthBufferEnable = true;
            depthStencilState.DepthBufferWriteEnable = true;
        }
Exemplo n.º 18
0
        public SpaceDust(Model model, Ship ship, int yRange)
            : base(model)
        {
            this.model = model;
            this.ship = ship;
            scale = new Vector3(.015f,.015f,.015f);
            rot.X = (float)Utilities.random.NextDouble();
            rot.Y = (float)Utilities.random.NextDouble();
            rot.Z = (float)Utilities.random.NextDouble();

            //pos.X = ship.pos.X + Utilities.random.NextDouble((float)0, range * 2) - range;

            pos.X = (ship.pos.X - range + ((float)Utilities.random.NextDouble() * range*2));
            pos.Z = (ship.pos.Z  - range + ((float)Utilities.random.NextDouble() * range*2));

            if (yRange == 0)
                pos.Y = (ship.pos.Y - 10 + ((float)Utilities.random.NextDouble() * 9.5f));
            else
                pos.Y = (ship.pos.Y + 10 - ((float)Utilities.random.NextDouble() * 7.5f));

            //System.Diagnostics.Debug.WriteLine(pos);
        }
Exemplo n.º 19
0
        public WeaponSystem(Ship ship, Game game)
            : base(game)
        {
            this.ship = ship;
            this.game = (Game1)game;
            currentWeapon = 1;

            pew1 = Game.Content.Load<Texture2D>(@"Models/Effects/tex1");
            pew2 = Game.Content.Load<Texture2D>(@"Models/Effects/tex2");
            pew3 = Game.Content.Load<Texture2D>(@"Models/Effects/tex3");

            drill = new WeaponDrill(this, ship, this.game);

            weapons.Add(new WeaponMissiles(this, ship, this.game));
            weapons.Add(new WeaponWave(this, ship, this.game));
            weapons.Add(new WeaponLaser(this, ship, this.game));
            weapons.Add(new WeaponBomb(this, ship, this.game));
            weapons.Add(drill);

            activeWeapon = (Weapon)weapons.ElementAt(2);

            hasDrill = false;
        }
Exemplo n.º 20
0
        public TurretBase(Vector3 pos, Vector3 dir, Game1 game)
        {
            this.pos = pos;
            this.dir = dir;
            this.game = game;
            baseModel = new TurretBaseModel(pos, game);
            game.modelManager.addObject(baseModel);
            nodePos = new Vector2((int)((pos.X / 30) + 0.5f), (int)((pos.Z / 30) + 0.5f));
            ship = game.ship;
            turretType = TurretType.none;

            gattPrice = 1250;
            pyroPrice = 2000;
            elecPrice = 3500;

            col = new CircleCollider(pos, 5);

            coolDown = 0;

            holo = new TurretHolo(pos, game);
            game.modelManager.addEffect(holo);
            triggeredHoloClose = false;
        }
Exemplo n.º 21
0
        public MoneyCollectParticle(Game1 game, Ship ship, Color col)
            : base()
        {
            this.model = TextureManager.square;
            this.game = game;
            this.ship = ship;
            this.col = col;
            pos = ship.pos;
            scalef = Utilities.nextFloat()/100 + 0.005f;
            zRot = Utilities.nextFloat() * MathHelper.PiOver2;
            tex = TextureManager.spark1;
            sb = new SpriteBatch(game.GraphicsDevice);
            rTarg = new RenderTarget2D(game.GraphicsDevice, 64, 64);

            direction.X = (float)Utilities.random.NextDouble() * 2 - 1;
            direction.Y = (float)Utilities.random.NextDouble();
            direction.Z = (float)Utilities.random.NextDouble() * 2 - 1;
            direction.Normalize();
            speed = 4.5f + Utilities.nextFloat();
            alpha = 1;

            life = Utilities.nextFloat();
        }
Exemplo n.º 22
0
        public WeaponDrill(WeaponSystem wepSys, Ship ship, Game1 game)
            : base(wepSys, ship, game)
        {
            icon = TextureManager.icoDrill;
            name = "Omega Drill";

            damage = 1;
            rateOfFire = 0;
            range = 0.1f;

            level = 3;

            coolMax = 90;
            softCoolmax = 60;
            ammoMax = 16;
            ammo = ammoMax;
            col = new CircleCollider(ship.pos+ship.direction, 0.5f);
            active = false;

            dome = new DrillDome(game, this);
            game.modelManager.addEffect(dome);
            finishingRange = new OOBB(ship.pos + ship.direction * 15, ship.direction, 3, 30);
            spins = new DrillSpinControl(game, this);
        }
Exemplo n.º 23
0
        public void initializeGame(string level)
        {
            loadPercentage = 0;
            if (!loadedGameContent)
            {
                TextureManager.initialize(this);
                loadPercentage = 0.1f;
                ModelLibrary.initialize(this);
                loadPercentage = 0.2f;
                loadPercentage = 0.25f;
                loadedGameContent = true;
            }

            modelManager = new ModelManager(this);
            ship = new Ship(this);
            core = new BaseCore(this);
            camera = new Camera(this, new Vector3(40, 150, 10), Vector3.Zero, Vector3.Up);
            turretManager = new TurretManager(this);
            asteroidManager = new AsteroidManager(this);
            enemyManager = new EnemyManager(this);
            waveManager = new WaveManager(this);
            hud = new Hud(this, Content.Load<SpriteFont>(@"Hud/Venera40"), spriteBatch, GraphicsDevice);

            minigame = new Minigame(this);
            levelStats = new StatTracker();
            loadPercentage = 0.65f;

            levelFileName = "dends";
            //levelFileName = "map1-revis";
            //levelFileName = "pac-man";
            layout = new MapData(level);
            //layout = new MapData(@"Content/MapXml/Level2.xml");
            //layout = new MapData(@"Content/MapXml/pac-man.xml");
            //layout = new MapData(@"Content/MapXml/broktes.xml");

            map = new Map(this, layout.getNodes());

            bloom = new BloomComponent(this);

            Components.Add(ship);
            Components.Add(camera);
            Components.Add(modelManager);
            Components.Add(enemyManager);
            Components.Add(waveManager);
            Components.Add(core);
            Components.Add(turretManager);
            Components.Add(asteroidManager);
            Components.Add(minigame);

            //make sure the post process effects go second last, and the hud is absolute last
            //Components.Add(bloom);
            Components.Add(hud);

            loadPercentage = 1f;

            modelManager.makeStarField();
            turretManager.Initialize();

            //Debugging stuff for A*
            shortestPath = new Pathfinder(map);
            turretAvoid = new PathfinderTurretAvoid(map);

            System.Diagnostics.Debug.WriteLine("A new map has been loaded, our pathfinding algorithm is now finding the shortest path from each enemy spawn to the core");
            List<Vector2> spawns = map.getEnemySpawn();
            System.Diagnostics.Debug.WriteLine("There are " + spawns.Count() + " enemy spawn point(s) in this map");
            int count = 1;
            foreach(Vector2 spawn in spawns)
            {
                List<Vector2> path = shortestPath.findPath(new Point((int)spawn.X, (int)spawn.Y), new Point((int)map.getCoreLocation().X, (int)map.getCoreLocation().Y));
                System.Diagnostics.Debug.WriteLine("The path from spawn " + count + " is as follows:");
                foreach(Vector2 nodePos in path)
                {
                    System.Diagnostics.Debug.WriteLine(nodePos);
                }
                count++;
            }

            justLoadedContent = true;
        }
Exemplo n.º 24
0
 public void setShip(Ship ship)
 {
     this.ship = ship;
     pos = ship.pos;
 }
Exemplo n.º 25
0
        public ShipThrustParticle(Game1 game, Ship ship, ShipParticleSystem particles, int type)
            : base()
        {
            if(type != 4)
                this.model = TextureManager.square;
            else
                this.model = TextureManager.flameSquare;

            this.game = game;
            this.ship = ship;
            this.particles = particles;
            this.type = type;
            time = 0;

            switch(type)
            {
                default:
                    break;
                case 0:
                    tex = TextureManager.particle1small;
                    fScale = 0.015f;
                    distance = -0.35f;
                    break;

                case -1:
                case 1:
                    tex = TextureManager.particle1small;
                    sb = new SpriteBatch(game.GraphicsDevice);
                    rTarg = new RenderTarget2D(game.GraphicsDevice, 64, 64);
                    fScale = 0.02f;
                    rot.Z = Utilities.nextFloat() * MathHelper.PiOver2;
                    distance = -0.35f;
                    alpha = 1;
                    col = Color.White;
                    pos = ship.pos+ship.direction*distance;
                    break;
                case 2:
                case 3:
                    tex = TextureManager.smoke1;
                    sb = new SpriteBatch(game.GraphicsDevice);
                    rTarg = new RenderTarget2D(game.GraphicsDevice, 64, 64);
                    fScale = 0.02f;
                    rot.Z = Utilities.nextFloat() * MathHelper.PiOver2;
                    distance = -0.35f;
                    alpha = 1;
                    if (type == 2)
                        col = Color.Orange;
                    else
                        col = Color.Cyan;
                    pos = ship.pos+ship.direction*distance;
                    break;
                case 4:
                    tex = TextureManager.boostFlame;
                    rTarg = new RenderTarget2D(game.GraphicsDevice, 64, 128);
                    sb = new SpriteBatch(game.GraphicsDevice);
                    alpha = 1;
                    fScale = 0;
                    distance = -0.35f;
                    time = 0;
                    rot = new Vector3(-.3f, MathHelper.Pi, Utilities.nextFloat()*MathHelper.Pi*2);

                    rotAxis.X = (float)Math.Sin(rot.Y);
                    rotAxis.Z = (float)Math.Cos(rot.Y);
                    rotAxis.Y = (float)Math.Sin(rot.X);
                    rotAxis.Normalize();
                    break;
                case 5:
                    fScale = 0;
                    distance = -0.35f;
                    pos = ship.pos + ship.direction * distance;
                    rot.Z = (float)Utilities.random.NextDouble() * MathHelper.Pi * 2;
                    tex = TextureManager.particle3small;
                    model = TextureManager.square;
                    col = Color.Cyan;
                    sb = new SpriteBatch(game.GraphicsDevice);
                    rTarg = new RenderTarget2D(game.GraphicsDevice, 64, 64);
                    alpha = 1;
                    break;
            }
        }