コード例 #1
0
        protected override void ActionLogic(LevelMechanics level)
        {
            List <String> stringList = level.GetLevelAsStrings();
            String        levelName  = level.GetName();

            WriteSave.Save(levelName, stringList);
            level.LevelSavedEvent();
        }
コード例 #2
0
 public Boolean PerformAction(Game1 game, LevelMechanics level)
 {
     if (!isActionPerformed)
     {
         ActionLogic(game, level);
         isActionPerformed = true;
         return(true);
     }
     return(false);
 }
コード例 #3
0
 public override void Update(GameTime gameTime)
 {
     for (int n = 0; n < GetWidth(); n++)
     {
         for (int m = 0; m < GetHeight(); m++)
         {
             grid[n, m].Update(gameTime);
             grid[n, m].SetOffset(new Vector2(0, LevelMechanics.GetCurrentOffset()));
         }
     }
 }
コード例 #4
0
        public void Update(GameTime gameTime)
        {
            for (int m = LevelMechanics.GetLowerPosition(); m < LevelMechanics.GetHigherPosition(); m++)
            {
                if (m >= timings.GetLength(0))
                {
                    break;
                }

                timeVector[m].Update(gameTime);
                timeVector[m].SetOffset(new Vector2(0, LevelMechanics.GetCurrentOffset()));
            }
        }
コード例 #5
0
        public void Draw(SpriteBatch spriteBatch)
        {
            int lowerPos  = LevelMechanics.GetLowerPosition();
            int higherPos = LevelMechanics.GetHigherPosition();

            for (int m = lowerPos; m < higherPos; m++)
            {
                //Breaks loop if index going out of bounds.
                if (m >= timings.GetLength(0))
                {
                    break;
                }

                timeVector[m].Draw(spriteBatch, font);
            }
        }
コード例 #6
0
        public override void Initialize()
        {
            base.Initialize();

            spriteSheet = new Sprite(Game.Content.Load <Texture2D>("MapCreator/MapCreatorSpriteSheet"));

            String currentName = "map1";

            levelMechanics = new LevelMechanics(Game, spriteSheet, currentName);
            levelMechanics.Initialize();
            gui = new MapCreatorGUI(Game, spriteSheet, levelMechanics);

            squarePalethera = new SquarePalethera(spriteSheet, new Vector2(380, 100));

            String equipInfo = "No equipment set yet.";

            gui.SetEquipInfo(equipInfo);
        }
コード例 #7
0
        public void Draw(SpriteBatch spriteBatch)
        {
            for (int n = 0; n < GetWidth(); n++)
            {
                int lowerPos  = LevelMechanics.GetLowerPosition();
                int higherPos = LevelMechanics.GetHigherPosition();

                for (int m = lowerPos; m < higherPos; m++)
                {
                    //Breaks loop if going outside bounds.
                    if (m >= GetHeight())
                    {
                        break;
                    }

                    grid[n, m].Draw(spriteBatch);
                }
            }
        }
コード例 #8
0
        public void SetTimeVector(float[] timings)
        {
            this.timings = timings;
            timeVector   = new IntervalButton[timings.GetLength(0)];

            for (int n = 0; n < timings.Length; n++)
            {
                if (n == 0)
                {
                    timeVector[n] = new IntervalButton(new Vector2(25, LevelMechanics.CalculateYPos(n)), null, null, 0);
                    timeVector[n].Initialize();
                }
                else
                {
                    timeVector[n] = new IntervalButton(new Vector2(25, LevelMechanics.CalculateYPos(n)), timeVector[n - 1], null, timings[n]);
                    timeVector[n].Initialize();
                    timeVector[n - 1].SetNext(timeVector[n]);
                }
            }
        }
コード例 #9
0
 public abstract void ClickAction(LevelMechanics level);
コード例 #10
0
 protected override void ActionLogic(LevelMechanics level)
 {
     level.SetLevelObjective(objective, objectiveInt);
 }
コード例 #11
0
 protected override void ActionLogic(LevelMechanics level)
 {
     level.ClearGrid();
 }
コード例 #12
0
 protected abstract void ActionLogic(Game1 game, LevelMechanics level);
コード例 #13
0
 protected override void ActionLogic(LevelMechanics level)
 {
     //string filepath = Microsoft.VisualBasic.Interaction.InputBox("Enter name of the saved level:", "Load level", "map1", -1, -1);
     //level.LoadFile(filepath);
     //level.ChangeName(filepath);
 }
コード例 #14
0
 protected override void ActionLogic(LevelMechanics level)
 {
     level.SetLevelDuration(newDuration);
 }
コード例 #15
0
 protected override void ActionLogic(LevelMechanics level)
 {
     level.SetTestStartTime(newStartTime);
 }
コード例 #16
0
 public virtual void Initialize()
 {
     SetCollisionZone(LevelMechanics.GetCurrentOffset());
 }
コード例 #17
0
 protected override void ActionLogic(LevelMechanics level)
 {
     level.ChangeGridViewFrame(incrementAmount);
 }
コード例 #18
0
 protected abstract void ActionLogic(LevelMechanics level);
コード例 #19
0
 protected override void ActionLogic(Game1 game, LevelMechanics level)
 {
     game.stateManager.shooterState.SetupMapCreatorTestRun(level.GetName(), level.GetTestStartTime());
     game.stateManager.shooterState.BeginTestLevel();
 }
コード例 #20
0
 protected override void ActionLogic(LevelMechanics level)
 {
     level.SetWidthInPixels(newWidth);
 }
コード例 #21
0
        public MapCreatorGUI(Game1 game, Sprite spriteSheet, LevelMechanics level)
        {
            this.game        = game;
            this.spriteSheet = spriteSheet;
            this.level       = level;

            font        = game.Content.Load <SpriteFont>("Fonts/MCSmallFont");
            font8       = game.Content.Load <SpriteFont>("Fonts/MCfont8");
            icelandFont = game.Content.Load <SpriteFont>("Fonts/Iceland_14");

            staticFontExperiment   = game.Content.Load <SpriteFont>("Fonts/Iceland_14");
            staticSpriteExperiment = new Sprite(game.Content.Load <Texture2D>("MapCreator/MapCreatorSpriteSheet"));

            screenW = Game1.ScreenSize.X;
            screenH = Game1.ScreenSize.Y;

            #region regularButtons
            buttons = new List <MapCreatorButton>();

            Vector2 quitpos = new Vector2(screenW - 90, screenH - 60);
            buttons.Add(new QuitApplicationButton(spriteSheet, quitpos));
            Vector2         savepos = new Vector2(screenW - 170, screenH - 60);
            SaveLevelButton save    = new SaveLevelButton(game, spriteSheet, savepos);
            buttons.Add(save);
            Vector2 loadpos = new Vector2(screenW - 250, screenH - 60);
            buttons.Add(new LoadLevelButton(game, spriteSheet, loadpos));
            Vector2 editpos = new Vector2(screenW - 90, screenH - 100);
            buttons.Add(new EditNameButton(game, spriteSheet, editpos));
            Vector2 clearpos = new Vector2(screenW - 90, screenH - 140);
            buttons.Add(new ClearGridButton(game, spriteSheet, clearpos));
            Vector2 runpos = new Vector2(screenW - 90, screenH - 180);
            buttons.Add(new RunLevelButton(spriteSheet, runpos));

            levelObjectivePos = new Vector2(550, screenH - 75);
            buttons.Add(new SetLevelObjectiveButton(spriteSheet, levelObjectivePos));

            gridWidthPos = new Vector2(screenW - 250, screenH - 175);
            Vector2 gridWidthBigMinusPos = gridWidthPos;
            buttons.Add(new GridWidthIncrButton(game, spriteSheet, gridWidthBigMinusPos, IncrementalType.largeNegative));
            Vector2 gridWidthSmallMinusPos = new Vector2(gridWidthPos.X + 30, gridWidthPos.Y);
            buttons.Add(new GridWidthIncrButton(game, spriteSheet, gridWidthSmallMinusPos, IncrementalType.smallNegative));
            Vector2 gridWidthSmallPlusPos = new Vector2(gridWidthPos.X + 60, gridWidthPos.Y);
            buttons.Add(new GridWidthIncrButton(game, spriteSheet, gridWidthSmallPlusPos, IncrementalType.smallPositive));
            Vector2 gridWidthBigPlusPos = new Vector2(gridWidthPos.X + 90, gridWidthPos.Y);
            buttons.Add(new GridWidthIncrButton(game, spriteSheet, gridWidthBigPlusPos, IncrementalType.largePositive));

            gridHeightPos = new Vector2(screenW - 250, screenH - 125);
            Vector2 gridHeightBigMinusPos = gridHeightPos;
            buttons.Add(new GridHeightIncrButton(game, spriteSheet, gridHeightBigMinusPos, IncrementalType.largeNegative));
            Vector2 gridHeightSmallMinusPos = new Vector2(gridHeightPos.X + 30, gridHeightPos.Y);
            buttons.Add(new GridHeightIncrButton(game, spriteSheet, gridHeightSmallMinusPos, IncrementalType.smallNegative));
            Vector2 gridHeightSmallPlusPos = new Vector2(gridHeightPos.X + 60, gridHeightPos.Y);
            buttons.Add(new GridHeightIncrButton(game, spriteSheet, gridHeightSmallPlusPos, IncrementalType.smallPositive));
            Vector2 gridHeightBigPlusPos = new Vector2(gridHeightPos.X + 90, gridHeightPos.Y);
            buttons.Add(new GridHeightIncrButton(game, spriteSheet, gridHeightBigPlusPos, IncrementalType.largePositive));

            durationWidthPos = new Vector2(screenW - 80, screenH - 225);
            Vector2 durationWidthMinus = durationWidthPos;
            buttons.Add(new DurationWidthIncrButton(game, spriteSheet, durationWidthMinus, IncrementalType.smallNegative));
            Vector2 durationWidthPlus = new Vector2(durationWidthPos.X - 20, durationWidthPos.Y);
            buttons.Add(new DurationWidthIncrButton(game, spriteSheet, durationWidthPlus, IncrementalType.smallPositive));

            gridViewPos = new Vector2(screenW - 50, screenH - 329);
            Vector2 changeGridViewUpPos = gridViewPos;
            buttons.Add(new ChangeGridViewButton(game, spriteSheet, changeGridViewUpPos, IncrementalType.upArrow));
            Vector2 changeGridViewDownPos = new Vector2(gridViewPos.X + 25, gridViewPos.Y);
            buttons.Add(new ChangeGridViewButton(game, spriteSheet, changeGridViewDownPos, IncrementalType.downArrow));

            widthButtonPos = new Vector2(screenW - 80, screenH - 270);
            buttons.Add(new WidthInPixelsButton(spriteSheet, widthButtonPos, level.GetWidthInPixels()));
            durationButtonPos = new Vector2(screenW - 80, screenH - 250);
            buttons.Add(new DurationButton(spriteSheet, durationButtonPos, level.GetLevelDuration()));
            startTimeButtonPos = new Vector2(screenW - 80, screenH - 290);
            buttons.Add(new StartTimeButton(spriteSheet, startTimeButtonPos));

            foreach (MapCreatorButton button in buttons)
            {
                button.Initialize();
            }
            #endregion

            buttonPinger = new ButtonPinger(game, buttons);

            actions     = new List <Action>();
            deadActions = new List <Action>();

            equipInfoString = "";
        }
コード例 #22
0
 protected override void ActionLogic(LevelMechanics level)
 {
     level.ChangeDurationGridWidth(incrementAmount);
 }