コード例 #1
0
ファイル: Sentry.cs プロジェクト: Thinny-Hendrix/MoonCow
        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));
        }
コード例 #2
0
ファイル: Turret.cs プロジェクト: Thinny-Hendrix/MoonCow
        public Turret(Vector3 pos, Vector3 targetDir, Game1 game)
        {
            this.game = game;
            this.pos = pos;
            this.targetDir = targetDir;
            this.currentDir = targetDir;

            state = State.idle;
            projectiles = new List<Projectile>();
            toDelete = new List<Projectile>();
            col = new CircleCollider(pos, 40);
            //turretModel = new TurretModel(this, game);
            //game.modelManager.addObject(turretModel);
            enemyManager = game.enemyManager;
        }
コード例 #3
0
        public HudAttackDisplayer(Game1 game, Hud hud)
        {
            this.game = game;
            this.hud = hud;
            this.enemyManager = game.enemyManager;
            sb = new SpriteBatch(game.GraphicsDevice);
            messageType = MessageType.end;

            waveDisplays = new List<HudWave>();

            bigFont = game.Content.Load<SpriteFont>(@"Hud/Venera900big");
            waveStartFill = game.Content.Load<Texture2D>(@"Hud/AttackDisplay/attackStartFill");
            waveStartOut = game.Content.Load<Texture2D>(@"Hud/AttackDisplay/attackStartOut");
            warnMark = game.Content.Load<Texture2D>(@"Hud/AttackDisplay/warnMark");
            warnFill = game.Content.Load<Texture2D>(@"Hud/AttackDisplay/warnFill");
            warnOut1 = game.Content.Load<Texture2D>(@"Hud/AttackDisplay/warnOut1");
            warnOut2 = game.Content.Load<Texture2D>(@"Hud/AttackDisplay/warnOut2");
            warnOut2w = game.Content.Load<Texture2D>(@"Hud/AttackDisplay/warnOut2-w");
            attackOverFill = game.Content.Load<Texture2D>(@"Hud/AttackDisplay/attackOverFill");
            attackOverOut = game.Content.Load<Texture2D>(@"Hud/AttackDisplay/attackOverOut");

            swaSml = game.Content.Load<Texture2D>(@"Hud/AttackDisplay/swaSml");
            swaBig = game.Content.Load<Texture2D>(@"Hud/AttackDisplay/swaBig");
            sneSml = game.Content.Load<Texture2D>(@"Hud/AttackDisplay/sneSml");
            sneBig = game.Content.Load<Texture2D>(@"Hud/AttackDisplay/sneBig");
            gunSml = game.Content.Load<Texture2D>(@"Hud/AttackDisplay/gunSml");
            gunBig = game.Content.Load<Texture2D>(@"Hud/AttackDisplay/gunBig");
            hevSml = game.Content.Load<Texture2D>(@"Hud/AttackDisplay/hevSml");
            hevBig = game.Content.Load<Texture2D>(@"Hud/AttackDisplay/hevBig");

            barMask = game.Content.Load<Texture2D>(@"Hud/Masks/waveMask");

            wavOut = game.Content.Load<Texture2D>(@"Hud/AttackDisplay/waveOut");
            wavOutW = game.Content.Load<Texture2D>(@"Hud/AttackDisplay/waveOutW");
            wavFill = game.Content.Load<Texture2D>(@"Hud/AttackDisplay/waveFill");

            warnMidPos = new Vector2(960, 360);
            warnSidePos = new Vector2(150, 350);
            currentWarnPos = warnMidPos;
        }
コード例 #4
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;
        }