public GameState()
        {
            //get a reference to pause state
            pState = GameStateManager.man.pState;
            mState = GameStateManager.man.mState;

            //initialize list of entity updaters and the collision manager singleton
            updaters = new List <Action>();
            col      = new Managers.CollisionManager(100);
            int seed = 5; //Game.rng.Next();

            wMan           = new Managers.WorldManager(seed, 10, 100, 10d, 64, col, new Point(0, 0));
            Game.worldMaxX = wMan.worldMaxX;
            Game.worldMaxY = wMan.worldMaxY;
            LastWorldPos   = new Point(Game.worldCenterX, Game.worldCenterY);

            //initialize background entity
            background = new quad(Managers.WorldManager.worldTex);
            background.AddComponent(new cBackgroundManger());
            updaters.Add(background.update);

            //initialize player character entity
            playerCharacter = new quad("Content/roguelikeCharBeard_transparent.png");
            playerCharacter.AddComponent(new cFollowCamera(playerCharacter));
            cCollider  playerCollider  = new cCollider(playerCharacter);
            cMouseFire playerBulletMan = new cMouseFire(playerCharacter);

            playerHealth = new cHealth(10, playerCharacter, this, 30);
            playerCharacter.AddComponent(playerHealth);
            playerCharacter.AddComponent(playerCollider);
            playerCharacter.AddComponent(new cKeyboardMoveandCollide(5, 1.5f, playerCollider));
            playerCharacter.AddComponent(playerBulletMan);
            playerCharacter.pos.xPos = Game.window.Width / 2 + 10;
            playerCharacter.pos.yPos = Game.window.Height / 2 + 10;
            playerCharacter.AddComponent(new cDEBUG_POS());
            playerCharacter.AddComponent(new cRangedWeapon(playerCharacter, playerBulletMan, 10));
            playerCharacter.tag = "Player";
            updaters.Add(playerCharacter.update);

            //initialize enemy manager
            eMan = new Managers.EnemyManager(playerCharacter, playerHealth, 1000);
            updaters.Add(eMan.update);

            //initialize UI entities
            gameover = new Button("Game Over. Click to go to Main Menu", Game.buttonBackground, toMenuState, OpenTK.Input.MouseButton.Left, this);
            gameover.SetActive(false);
            updaters.Add(gameover.update);

            uiHealth = new Button("Health: 00", Game.buttonBackground, "", OpenTK.Input.MouseButton.Left, this);
            uiHealth.t.AddComponent(new cUIHealth(uiHealth.t, playerHealth));
            updaters.Add(uiHealth.update);

            uiLevel = new Button("Level 00", Game.buttonBackground, "", OpenTK.Input.MouseButton.Left, this);
            uiLevel.t.AddComponent(new cUILevel(uiLevel.t));
            updaters.Add(uiLevel.update);

            uiPos = new Button("[0,0] {00,00}", Game.buttonBackground, "", OpenTK.Input.MouseButton.Left, this);
            uiPos.t.AddComponent(new cUIPosition(uiPos.t));
            updaters.Add(uiPos.update);
        }
示例#2
0
        public EnemyManager(renderable player, cHealth playerHealth, int enemyCount, NullEngine.StateMachine.iState parentState)
        {
            if (man == null)
            {
                man = this;
            }
            else
            {
                throw new SingletonException(this);
            }

            updaters        = new List <Action>();
            activeEnemies   = new List <int>();
            playerCharacter = player;
            level           = 0;
            //initialize eneimes
            enemies = new quad[enemyCount];
            for (int j = 0; j < enemies.Length; j++)
            {
                enemies[j] = new quad("Game/Content/roguelikeCharBeard_transparent.png", parentState);
                cCollider badguyCollider = new cCollider(enemies[j]);
                enemies[j].AddComponent(new cDamagePlayer(playerCharacter, playerHealth, 1, badguyCollider));
                enemies[j].AddComponent(badguyCollider);
                enemies[j].AddComponent(new cEnemyAI(3, badguyCollider, playerCharacter, 300));
                enemies[j].active = false;
                updaters.Add(enemies[j].update);
            }
        }
示例#3
0
 public nodes(int x, int y, quad ownerQuad, plus ownerPlus)   //getting data in easier
 {
     int  X          = x;
     int  Y          = y;
     quad parentQuad = ownerQuad;
     plus parentPlus = ownerPlus;
 }
示例#4
0
        public quad createEntity()
        {
            quad temp = new quad("Game/Content/bullet.png", this);

            temp.AddComponent(new Components.cBounce(temp));
            temp.pos.xScale = 0.75f;
            temp.pos.yScale = 0.75f;
            temp.pos.xPos   = Game.rng.Next(Game.windowRect.Left, Game.windowRect.Right);
            temp.pos.yPos   = Game.rng.Next(Game.windowRect.Top, Game.windowRect.Bottom);
            return(temp);
        }
示例#5
0
 public Button(string text, Texture2D background, Action onClick, MouseButton buttonToCheck, StateMachine.iState state)
 {
     this.background = new quad(background, state);
     this.background.doDistCulling = false;
     t = new text(text, state);
     this.background.width  = t.tex.width;
     this.background.height = t.tex.height;
     this.onClick           = onClick;
     button = buttonToCheck;
     Game.buttonMan.Add(this);
     containingState = state;
 }
示例#6
0
        public Button(int size, string text, Texture2D background, String toEcho, MouseButton buttonToCheck, StateMachine.iState state)
        {
            this.background = new quad(background, state);
            this.background.doDistCulling = false;
            t = new text(text, state);
            this.background.width  = size;
            this.background.height = size;

            this.echo = toEcho;
            onClick   = Echo;
            button    = buttonToCheck;
            Game.buttonMan.Add(this);
            containingState = state;
        }
示例#7
0
        public Button(string text, Texture2D background, String toEcho, MouseButton buttonToCheck, StateMachines.iState state)
        {
            this.background = new quad(background);
            this.background.doDistCulling = false;
            t = new text(text);
            this.background.width  = t.tex.width;
            this.background.height = t.tex.height;

            if (text == " ")
            {
                this.background.width  = 16;
                this.background.height = 16;
            }

            this.echo = toEcho;
            onClick   = Echo;
            button    = buttonToCheck;
            Game.buttonMan.Add(this);
            containingState = state;
        }