Beispiel #1
0
 public Loader(global_vars.loadType loadtype, ref global_vars vars, ref Game1 game)
     : base(game)
 {
     this.loadtype = loadtype;
     variables = vars;
     this.game = game;
 }
Beispiel #2
0
 /// <summary>
 /// Allows the game to perform any initialization it needs to before starting to run.
 /// This is where it can query for any required services and load any non-graphic
 /// related content.  Calling base.Initialize will enumerate through any components
 /// and initialize them as well.
 /// </summary>
 protected override void Initialize()
 {
     // graphics.ToggleFullScreen();
     variables = new global_vars(graphics);
     this.Components.Add(new Start_Screen(variables, this));
     base.Initialize();
 }
Beispiel #3
0
 public TargetAttack(ref global_vars vars, ref Game1 game)
     : base(game)
 {
     this.game = game;
     this.variables = vars;
     thisTA = this;
 }
Beispiel #4
0
 public Credits(ref global_vars vars, ref Game1 game)
     : base(game)
 {
     this.game = game;
     this.variables = vars;
     thisCredit = this;
     area = new Rectangle(0, 0, variables.screen_width, variables.screen_height);
 }
Beispiel #5
0
 public SmokeAttack(ref global_vars vars, ref Game1 game)
     : base(ref vars, ref game)
 {
     started = false;
     duration = new Timer(8000);
     duration.Elapsed += new ElapsedEventHandler(disable);
     duration.AutoReset = false;
 }
Beispiel #6
0
 public IceAttack(ref global_vars vars, ref Game1 game)
     : base(ref vars, ref game)
 {
     setUp = false;
     duration = new Timer(8000);
     duration.Elapsed += new ElapsedEventHandler(unfreeze);
     duration.AutoReset = false;
 }
Beispiel #7
0
 public Target(ref TargetAttack ta, ref global_vars vars, ref Game1 game)
     : base(game)
 {
     this.game = game;
     this.variables = vars;
     thisTarget = this;
     position = new Rectangle(vars.screen_width/2, vars.screen_height/2, 100, 100);
     attack = ta;
 }
Beispiel #8
0
 public Start_Screen(global_vars vars, Game1 game)
     : base(game)
 {
     this.game = game;
     variables = vars;
     fadedone = false;
     alphavalue = 0;
     alphadec = .50f;
 }
Beispiel #9
0
 public Enemy(ref global_vars variables, Texture2D enemysprite, ref Character player_char, ref Campaign currentCampaign,  Game1 game)
     : base(game)
 {
     this.enemy = enemysprite;
     this.player = player_char;
     this.variables = variables;
     this.game = game;
     this.currentCampaign = currentCampaign;
     thisEnemy = this;
 }
Beispiel #10
0
 public Player(ref global_vars vars, int experience, String[] special, String selectedSpecial, int game_credit, ref Game1 g)
 {
     this.experience = experience;
     this.avaliableSpecials = special;
     this.game_credit = game_credit;
     variables = vars;
     game = g;
     this.selectedSpecial = selectedSpecial;
     character = new Character(selectedSpecial, ref variables, ref g);
 }
Beispiel #11
0
 public Main_Menu(global_vars vars, Game1 game)
     : base(game)
 {
     this.game = game;
     thisMain = this;
     selection_delay = vars.MENU_DELAY;
     current_delay = selection_delay;
     variables = vars;
     optionselected = option.campaign;
     deviceSelected = false;
 }
Beispiel #12
0
        Shield thisShield; //Copy of this implementation of Shield interace, so that it may be passed as ref

        #endregion Fields

        #region Constructors

        public Basic_Shield(int timeAvaliable, Rectangle positionPlaced, ref Character castee, ref global_vars variables, ref Game1 game)
            : base(game)
        {
            this.position = positionPlaced;
            this.castee = castee;
            shieldBatch = new SpriteBatch(game.GraphicsDevice);
            thisShield = this;

            active = new Timer(timeAvaliable);
            active.Elapsed += new ElapsedEventHandler(timeElapsed);
            activate = true;
        }
Beispiel #13
0
 public Pause(ref global_vars vars, ref Playable playmode, ref Game1 game)
     : base(game)
 {
     this.game = game;
     this.playmode = playmode;
     thisPause = this;
     variables = vars;
     HUDLocation = variables.HUDLOC;
     layoverPosition = new Rectangle(0, 0, variables.screen_width, variables.screen_height);
     pauseTimer = new Timer(vars.PAUSE_DELAY, game);
     pauseTimer.Elapsed = pauseDelay;
 }
Beispiel #14
0
        public Character(String special_ability, ref global_vars vars, ref Game1 game)
            : base(game)
        {
            this.game = game;
            thisCharacter = this;
            this.variables = vars;

            this.special_ability = special_ability;
            this.position = new Rectangle(variables.CHARACTER_START_POSITION.X, variables.CHARACTER_START_POSITION.Y, variables.CHARACTER_WIDTH, variables.CHARACTER_HEIGHT);

            base.UpdateOrder = variables.CHARACTER_UPDATE_PRIORITY;
            base.DrawOrder = variables.CHARACTER_UPDATE_PRIORITY;

            this.move_state = variables.CHARACTER_DEFAULT_MOVESTATE;
            this.charsprite = new SpriteBatch(variables.manager.GraphicsDevice);

            attackDelayTimer = new Timer(variables.ATTACK_DELAY);
            attackDelayTimer.Elapsed += new ElapsedEventHandler(attackIsReady);
        }
Beispiel #15
0
        public Upgrade(Dictionary<String, Texture2D[]> texPack, Texture2D overlay, Texture2D defaultSelection, Player player, ref global_vars vars, ref Game1 game)
            : base(game)
        {
            this.currentSlot = 0;
            this.texturePack = texPack;
            this.overlay = overlay;
            this.player = player;
            this.variables = vars;
            this.game = game;
            this.defaultSelection = defaultSelection;
            this.selection = defaultSelection;
            thisUpgrade = this;

            pointLoc = variables.PLOC;
            costLoc = variables.CLOC;

            layoverPosition = new Rectangle(0, 0, vars.screen_width, vars.screen_height);
            selectionDelay = new Timer(vars.UPGRADE_DELAY, game);
            selectionDelay.Elapsed = selectDelay;
        }
Beispiel #16
0
        public Campaign(ref global_vars vars, Player player, Texture2D map, Game1 game)
            : base(game)
        {
            this.variables = vars;
            this.player = player;
            this.map = map;
            this.game = game;
            thisCampaign = this;
            play = this;

            s1 = new Vector2(40, variables.screen_height - 40);
            l1 = new Rectangle(variables.screen_width - 190, variables.screen_height - 70, 50, 50);
            l2 = new Rectangle(variables.screen_width - 130, variables.screen_height - 70, 50, 50);
            l3 = new Rectangle(variables.screen_width - 70, variables.screen_height - 70, 50, 50);

            mapPosition = new Rectangle(0, 0, variables.screen_width, variables.screen_height);
            this.character = this.player.getCharacter(thisCampaign);
            creepers = 0;
            shadows = 0;
        }
Beispiel #17
0
 public static void performSpecialAbility(String identifier, ref global_vars vars, ref Game1 game)
 {
     //Account for null (AKA No Special Ability)
     if (identifier == null)
         return;
     //Fire
     else if(identifier.Equals(vars.ABIL_ONE))
     {
         FireWave f = new FireWave(5000, new Rectangle(0, 0, 50, vars.screen_height), 'r', global_vars.sender.Special, ref vars, ref game);
         game.Components.Add(f);
     }
     //Ice
     else if(identifier.Equals(vars.ABIL_TWO))
     {
         IceAttack ia = new IceAttack(ref vars, ref game);
         game.Components.Add(ia);
     }
     //Smoke
     else if(identifier.Equals(vars.ABIL_THREE))
     {
         SmokeAttack ms = new SmokeAttack(ref vars, ref game);
         game.Components.Add(ms);
     }
 }
Beispiel #18
0
 public FireWave(int timeAvaliable, Rectangle startpos, char direction, global_vars.sender sender, ref global_vars variables, ref Game1 game)
     : base(timeAvaliable, startpos, direction, sender, ref variables, ref game)
 {
     thisFirewave = this;
 }
 public Shadow_Basic_Attack(int timeAvaliable, Rectangle startpos, char direction, global_vars.sender sender, ref global_vars variables, ref Game1 game)
     : base(timeAvaliable, startpos, direction, sender, ref variables, ref game)
 {
 }
Beispiel #20
0
 public static bool abilityIsAvaliable(int ability_number, ref Player player, ref global_vars vars)
 {
     return player.ABILITY[ability_number-1] != vars.NO_ABILITY ? true : false;
 }
Beispiel #21
0
 public Creeper(ref global_vars variables, Texture2D enemysprite, ref Character player_char, ref Campaign currentCampaign, Game1 game)
     : base(ref variables, enemysprite, ref player_char, ref currentCampaign, game)
 {
 }
Beispiel #22
0
 public bool notify(global_vars.notification request)
 {
     if (request.Equals(global_vars.notification.ShieldRequest))
     {
         if (shieldsAvaliable == 0)
             return false;
         else
             shieldsAvaliable--;
     }
     else if (request.Equals(global_vars.notification.SpecialRequest))
     {
         if (!specialAvaliable)
             return false;
         else
         {
             specialAvaliable = false;
             specTimer.Start();
         }
     }
     else if(request.Equals(global_vars.notification.PlayerDeath))
     {
         playerDeath();
     }
     return true;
 }
Beispiel #23
0
 public static void handlePauseScreenCommands(ref Pause pause, ref global_vars vars)
 {
     keypressed = Keyboard.GetState();
     if (keypressed.IsKeyDown(vars.PAUSE))
         pause.PauseGame();
     else if (keypressed.IsKeyDown(vars.QUIT))
         pause.Quit();
 }
Beispiel #24
0
 public static void handleTargetCommands(ref Target target, ref global_vars vars)
 {
     keypressed = Keyboard.GetState();
     if (keypressed.IsKeyDown(Keys.Up))
         target.move('u');
     else if (keypressed.IsKeyDown(Keys.Down))
         target.move('d');
     else if (keypressed.IsKeyDown(Keys.Right))
         target.move('r');
     else if (keypressed.IsKeyDown(Keys.Left))
         target.move('l');
     else if (keypressed.IsKeyDown(Keys.Enter))
         target.select();
 }
Beispiel #25
0
 public static void handleUpgradeScreenCommands(ref Upgrade upgrade, ref global_vars vars)
 {
     keypressed = Keyboard.GetState();
     if (keypressed.IsKeyDown(vars.PURCHASE))
         upgrade.buyAbility();
     else if (keypressed.IsKeyDown(vars.SELECT))
         upgrade.setAbility();
     else if (keypressed.IsKeyDown(vars.REMOVE))
         upgrade.remove();
     else if (keypressed.IsKeyDown(Keys.Right))
         upgrade.moveAbilityRight();
     else if (keypressed.IsKeyDown(Keys.Left))
         upgrade.moveAbilityLeft();
     else if (keypressed.IsKeyDown(Keys.Escape))
         upgrade.quit();
 }
Beispiel #26
0
 public ShadowEater(ref global_vars variables, Texture2D enemysprite, ref Character player_char, ref Campaign currentCampaign, Game1 game)
     : base(ref variables, enemysprite, ref player_char, ref currentCampaign, game)
 {
     attackSound = game.Content.Load<SoundEffect>("Sounds\\shadowAttackSound");
 }
Beispiel #27
0
        public static void handleCommand(ref Character character, ref Playable playable, ref global_vars variables, ref Game1 game)
        {
            keypressed = Keyboard.GetState();

            //Player movement

            if (keypressed.IsKeyDown(variables.CHARACTER_UP) && (character.getPosition().Y > 0))
            {
                character.setPosition(character.getPosition().X, character.getPosition().Y - variables.CHARACTER_DEFAULT_MOVE_SPEED);
                character.move_state = global_vars.movestate.up;
            }
            else if (keypressed.IsKeyDown(variables.CHARACTER_DOWN) && (character.getPosition().Y < (variables.screen_height - variables.CHARACTER_HEIGHT)))
            {
                character.setPosition(character.getPosition().X, character.getPosition().Y + variables.CHARACTER_DEFAULT_MOVE_SPEED);
                character.move_state = global_vars.movestate.down;
            }
            else if (keypressed.IsKeyDown(variables.CHARACTER_RIGHT) && (character.getPosition().X < variables.screen_width - variables.CHARACTER_WIDTH))
            {
                character.setPosition(character.getPosition().X + variables.CHARACTER_DEFAULT_MOVE_SPEED, character.getPosition().Y);
                character.move_state = global_vars.movestate.right;
            }
            else if (keypressed.IsKeyDown(variables.CHARACTER_LEFT) && (character.getPosition().X > 0))
            {
                character.setPosition(character.getPosition().X - variables.CHARACTER_DEFAULT_MOVE_SPEED, character.getPosition().Y);
                character.move_state = global_vars.movestate.left;
            }

            else character.move_state = global_vars.movestate.notmoving;

            //User commands (spells, shields, etc)
            //Attacks start at player's center
            int posx = character.getPosition().X + (variables.CHARACTER_WIDTH / 4);
            int posy = character.getPosition().Y + (variables.CHARACTER_HEIGHT / 4);
            int shieldx = character.getPosition().X - (variables.SHIELD_WIDTH / 2);
            int shieldy = character.getPosition().Y - (variables.SHIELD_HEIGHT / 2);

            //Sheild (One at a time)
            if (keypressed.IsKeyDown(variables.SHIELD) && (character.shieldOut == false))
            {
                try
                {
                    bool answer = playable.notify(global_vars.notification.ShieldRequest);
                    if (answer)
                    {
                        character.shieldOut = true;
                        game.Components.Add(new Basic_Shield(10000, new Rectangle(shieldx, shieldy, variables.SHIELD_WIDTH, variables.SHIELD_HEIGHT), ref character, ref variables, ref game));
                    }
                }
                catch (Exception e) { throw e; }
            }

            //Basic Attack
            if (keypressed.IsKeyDown(variables.ATTACK_BASIC_UP) && (character.attackReady == true))
            {
                character.attackReady = false;
                game.Components.Add(new Basic_Attack(3000, new Rectangle(posx, posy, variables.ATTACK_SPELL_SIZE, variables.ATTACK_SPELL_SIZE), 'u', global_vars.sender.Character, ref variables, ref game));
            }
            else if (keypressed.IsKeyDown(variables.ATTACK_BASIC_RIGHT) && (character.attackReady == true))
            {
                character.attackReady = false;
                game.Components.Add(new Basic_Attack(3000, new Rectangle(posx, posy, variables.ATTACK_SPELL_SIZE, variables.ATTACK_SPELL_SIZE), 'r', global_vars.sender.Character, ref variables, ref game));
            }
            else if (keypressed.IsKeyDown(variables.ATTACK_BASIC_LEFT) && (character.attackReady == true))
            {
                character.attackReady = false;
                game.Components.Add(new Basic_Attack(3000, new Rectangle(posx, posy, variables.ATTACK_SPELL_SIZE, variables.ATTACK_SPELL_SIZE), 'l', global_vars.sender.Character, ref variables, ref game));
            }
            else if (keypressed.IsKeyDown(variables.ATTACK_BASIC_DOWN) && (character.attackReady == true))
            {
                character.attackReady = false;
                game.Components.Add(new Basic_Attack(3000, new Rectangle(posx, posy, variables.ATTACK_SPELL_SIZE, variables.ATTACK_SPELL_SIZE), 'd', global_vars.sender.Character, ref variables, ref game));
            }

            //Special Ability
            if (keypressed.IsKeyDown(variables.SPECIAL_ABILITY))
            {
                try
                {
                    bool answer = playable.notify(global_vars.notification.SpecialRequest);
                    if (answer)
                    {
                        Ability_Manager.performSpecialAbility(character.getSpecial(), ref variables, ref game);
                    }
                }
                catch (Exception e) { }
            }

            //Exit Full Screen
               // if (keypressed.IsKeyDown(Keys.Escape))
              //      variables.manager.ToggleFullScreen();
        }