コード例 #1
0
ファイル: JunkShip.cs プロジェクト: Thinny-Hendrix/MoonCow
        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;
        }
コード例 #2
0
ファイル: MgScreen.cs プロジェクト: Thinny-Hendrix/MoonCow
        public MgScreen(Minigame minigame, MgManager manager, Game1 game)
        {
            this.game = game;
            this.minigame = minigame;
            this.manager = manager;
            font = manager.font;

            overlay = game.Content.Load<Texture2D>(@"Minigame/mgOverlay");
            cross = game.Content.Load<Texture2D>(@"Minigame/mgX");

            rTarg = new RenderTarget2D(game.GraphicsDevice, 1365, 1024);
            sb = new SpriteBatch(game.GraphicsDevice);

            blue = new Color(200, 250, 255);
            red = new Color(249, 59, 43);

            particles = new List<SpriteParticle>();
            pToDelete = new List<SpriteParticle>();
            frontParticles = new List<SpriteParticle>();

            messages = new List<MgMessage>();
            mToDelete = new List<MgMessage>();

            moneyDesc = "Money earned:";
            displayMoney = 0;
        }
コード例 #3
0
        public MgModelManager(Game1 game, Minigame minigame)
        {
            this.game = game;
            this.minigame = minigame;

            additive = new List<MgModel>();
            solid = new List<MgModel>();

            cam = new MgCamera(game);

            depthStencilState = new DepthStencilState();
            depthStencilState.DepthBufferEnable = true;
            depthStencilState.DepthBufferWriteEnable = true;

            dbNoWriteEnable = new DepthStencilState();
            depthStencilState.DepthBufferEnable = true;
            dbNoWriteEnable.DepthBufferWriteEnable = false;

            addModels();
        }
コード例 #4
0
ファイル: MgManager.cs プロジェクト: Thinny-Hendrix/MoonCow
        public MgManager(Minigame minigame, Game1 game)
        {
            this.game = game;
            this.minigame = minigame;

            upGoal = new CircleCollider(new Vector2(414,254), 64);
            downGoal = new CircleCollider(new Vector2(604,800), 64);
            leftGoal = new CircleCollider(new Vector2(240,618), 64);
            rightGoal = new CircleCollider(new Vector2(784,430), 64);

            upMark = new List<MgMarker>();
            downMark = new List<MgMarker>();
            leftMark = new List<MgMarker>();
            rightMark = new List<MgMarker>();
            mToDelete = new List<MgMarker>();

            bg = game.Content.Load<Texture2D>(@"Minigame/mgbg2");
            markerSprite = game.Content.Load<Texture2D>(@"Minigame/mgMarker2");
            font = game.Content.Load<SpriteFont>(@"Hud/Venera40");

            rTarg = new RenderTarget2D(game.GraphicsDevice, 1024, 1024);
            sb = new SpriteBatch(game.GraphicsDevice);

            upKey = new MgKey(Buttons.DPadUp, Keys.W, Keys.Up, GamePad.GetState(PlayerIndex.One).ThumbSticks.Left.Y, 0.3f);
            downKey = new MgKey(Buttons.DPadDown, Keys.S, Keys.Down, GamePad.GetState(PlayerIndex.One).ThumbSticks.Left.Y, -0.3f);
            leftKey = new MgKey(Buttons.DPadLeft, Keys.A, Keys.Left, GamePad.GetState(PlayerIndex.One).ThumbSticks.Left.X, -0.3f);
            rightKey = new MgKey(Buttons.DPadRight, Keys.D, Keys.Right, GamePad.GetState(PlayerIndex.One).ThumbSticks.Left.X, 0.3f);
            keys = new List<MgKey>();
            keys.Add(upKey);
            keys.Add(downKey);
            keys.Add(leftKey);
            keys.Add(rightKey);

            markerMax = 8;
            markerCount = 0;
            nextMarker = 1;
            speed = 650;
            normSpeed = speed;
            hardSpeed = speed * 1.2f;
            fail = false;
        }
コード例 #5
0
ファイル: MgDisplayer.cs プロジェクト: Thinny-Hendrix/MoonCow
        public MgDisplayer(Minigame minigame, MgManager manager, Game1 game)
            : base()
        {
            this.minigame = minigame;
            this.manager = manager;
            this.game = game;
            screen = minigame.screen;

            scale = new Vector3(0.25f);

            model = ModelLibrary.mgScreen;
            rot.X = MathHelper.Pi / 2.8f;

            sb = new SpriteBatch(game.GraphicsDevice);
            rTarg = new RenderTarget2D(game.GraphicsDevice, 64, 64);

            visible = false;

            linePos = Vector2.Zero;

            blue = new Color(179, 235, 255);
        }
コード例 #6
0
ファイル: ExpSelect.cs プロジェクト: Thinny-Hendrix/MoonCow
 public void setMinigame(Minigame mg)
 {
     this.mg = mg;
 }
コード例 #7
0
ファイル: Game1.cs プロジェクト: Thinny-Hendrix/MoonCow
        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;
        }