public InstructionsMenu(ContentManager content)
        {
            ColouredButtonParams buttonParms = new ColouredButtonParams();

            buttonParms.Font            = ResourceManager.getInstance().Font;
            buttonParms.Height          = 25;
            buttonParms.LinesTexture    = ResourceManager.getInstance().ButtonLineTexture;
            buttonParms.MouseOverColour = ResourceManager.MOUSE_OVER_COLOUR;
            buttonParms.RegularColour   = ResourceManager.TEXT_COLOUR;
            buttonParms.StartX          = 560;
            buttonParms.Width           = 225;

            // return button
            buttonParms.StartY        = 557;
            buttonParms.Text          = "Return To Main Menu";
            buttonParms.TextsPosition = new Vector2(570f, buttonParms.StartY - 2);
            this.returnToMainButton   = new ColouredButton(buttonParms);

            // title
            StaticDrawable2DParams staticParms = new StaticDrawable2DParams();

            staticParms.Position = new Vector2(0f, 0f);
            staticParms.Texture  = LoadingUtils.load <Texture2D>(content, "Instructions");
            this.title           = new StaticDrawable2D(staticParms);

            // background
            staticParms.Position = new Vector2(80f, 25f);
            staticParms.Texture  = LoadingUtils.load <Texture2D>(content, "HowToPlay");
            this.backGround      = new StaticDrawable2D(staticParms);

            // sound effects
            this.outroSfx = LoadingUtils.load <SoundEffect>(content, "WhereWeGonnaRob");
        }
Пример #2
0
        /// <summary>
        /// Constructs a Slider object based on the params object
        /// </summary>
        /// <param name="parms">SliderParams object</param>
        public Slider(SliderParams parms) : base(parms)
        {
            this.CurrentValue = parms.CurrentValue;
            this.initialX     = parms.Position.X;
            Texture2D texture = LoadingUtils.load <Texture2D>(parms.Content, Constants.GUI_FILE_NAME);

            StaticDrawable2DParams imgParms = new StaticDrawable2DParams {
                Position           = parms.Position,
                LightColour        = parms.BarColour,
                Scale              = parms.Scale,
                RenderingRectangle = Constants.SLIDER_BAR,
                Texture            = texture,
                Origin             = new Vector2(Constants.SLIDER_BAR.Width / 2, Constants.SLIDER_BAR.Height / 2)
            };

            this.bar = new StaticDrawable2D(imgParms);

            imgParms.Scale              = parms.BallScale;
            imgParms.LightColour        = parms.BallColour;
            imgParms.RenderingRectangle = Constants.SLIDER_BALL;
            imgParms.Origin             = new Vector2(Constants.SLIDER_BALL.Width / 2, Constants.SLIDER_BALL.Height / 2);
            this.ball = new StaticDrawable2D(imgParms);
            setPosition();

            Text2DParams textParms = new Text2DParams {
                Position    = new Vector2(parms.Position.X + 100f, parms.Position.Y),
                LightColour = parms.LightColour,
                WrittenText = getValue(),
                Font        = parms.Font,
                Origin      = new Vector2(16f, 16f),
            };

            this.text = new Text2D(textParms);
        }
Пример #3
0
        public Sun(ContentManager content)
        {
            StaticDrawable2DParams parms = new StaticDrawable2DParams();
            Texture2D sunTx = LoadingUtils.load <Texture2D>(content, "SunLayer1");

            parms.Texture    = sunTx;
            parms.Scale      = new Vector2(START_SCALE, START_SCALE);
            parms.Origin     = new Vector2(48f, 48f);
            parms.Position   = new Vector2(70f, 70f);
            this.innerLayer  = new StaticDrawable2D(parms);
            parms.Texture    = LoadingUtils.load <Texture2D>(content, "SunLayer2");
            this.outterLayer = new StaticDrawable2D(parms);

            PulseEffectParams effectParms = new PulseEffectParams {
                Reference   = this.outterLayer,
                ScaleBy     = .25f,
                ScaleDownTo = START_SCALE,
                ScaleUpTo   = END_SCALE
            };

            this.outterLayer.addEffect(new PulseEffect(effectParms));

#if WINDOWS
#if DEBUG
            if (this.innerLayer != null)
            {
                ScriptManager.getInstance().registerObject(this.innerLayer, "sunInner");
            }
            if (this.outterLayer != null)
            {
                ScriptManager.getInstance().registerObject(this.outterLayer, "sunOutter");
            }
#endif
#endif
        }
Пример #4
0
        public Fence(ContentManager content)
        {
            int size = 9;

            this.pieces = new StaticDrawable2D[size];
            Texture2D fenceTexture       = LoadingUtils.load <Texture2D>(content, "Fence");
            StaticDrawable2DParams parms = new StaticDrawable2DParams();

            parms.Texture = fenceTexture;
            parms.Scale   = new Vector2(1f, 1.5f);
            int textureWidth = fenceTexture.Width;

            for (int i = 0; i < size; i++)
            {
                parms.Position = new Vector2(i * textureWidth, 330f);
                this.pieces[i] = new StaticDrawable2D(parms);
            }

#if WINDOWS
#if DEBUG
            if (this.pieces != null)
            {
                for (int i = 0; i < this.pieces.Length; i++)
                {
                    ScriptManager.getInstance().registerObject(this.pieces[i], "fence" + i);
                }
            }
#endif
#endif
        }
        public TutorialComplete(ContentManager content)
            : base(content, "GeneralBackground")
        {
            VisualCallback setPrevipousState = delegate() {
                GameStateMachine.getInstance().goToPreviousState();
            };
            VisualCallback setNextState = delegate() {
                GameStateMachine.getInstance().LevelContext = null;
                GameStateMachine.getInstance().goToNextState();
            };

            List <ButtonRequest> requests = new List <ButtonRequest>();

            requests.Add(new ButtonRequest("Menu", setPrevipousState));
            requests.Add(new ButtonRequest("Torment", setNextState));
            base.createButtons(requests.ToArray());

            Texture2D texture            = LoadingUtils.load <Texture2D>(content, "Tut_Finish");
            StaticDrawable2DParams parms = new StaticDrawable2DParams {
                Texture  = texture,
                Origin   = new Vector2(texture.Width / 2, texture.Height / 2),
                Position = new Vector2(Constants.RESOLUTION_X / 2, Constants.RESOLUTION_Y / 2)
            };

            this.image = new StaticDrawable2D(parms);
        }
Пример #6
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            Constants.FONT = LoadingUtils.load <SpriteFont>(Content, "SpriteFont1");
            GameStateMachine.getInstance().init(GraphicsDevice, Content);
            SoundManager.getInstance().init(Content);

            this.fadeParams = new FadeEffectParams {
                OriginalColour      = Color.Black,
                State               = FadeEffect.FadeState.Out,
                TotalTransitionTime = TRANSITION_TIME
            };
            this.fadeEffect = new FadeEffect(fadeParams);

            StaticDrawable2DParams transitionParms = new StaticDrawable2DParams {
                Texture     = LoadingUtils.load <Texture2D>(Content, "Chip"),
                Scale       = new Vector2(Constants.RESOLUTION_X, Constants.RESOLUTION_Y),
                LightColour = Color.Black
            };

            this.transitionItem = new StaticDrawable2D(transitionParms);
            this.transitionItem.addEffect(this.fadeEffect);

#if WINDOWS
#if DEBUG
            ScriptManager.getInstance().LogFile = "Log.log";
            ScriptManager.getInstance().registerObject(MapEditor.getInstance(), "editor");
            Debug.debugChip = LoadingUtils.load <Texture2D>(Content, "Chip");
            Debug.debugRing = TextureUtils.create2DRingTexture(GraphicsDevice, (int)Constants.BOUNDING_SPHERE_SIZE, Color.White);
#endif
#endif
        }
        public MapSelection(GraphicsDevice device, string mapName, int index, int width, int height, int startX, int startY)
        {
            this.MapName = mapName;
            ColouredButtonParams buttonParms = new ColouredButtonParams();

            buttonParms.Font            = ResourceManager.getInstance().Font;
            buttonParms.Height          = height;
            buttonParms.LinesTexture    = ResourceManager.getInstance().ButtonLineTexture;
            buttonParms.MouseOverColour = ResourceManager.MOUSE_OVER_COLOUR;
            buttonParms.RegularColour   = ResourceManager.TEXT_COLOUR;
            buttonParms.StartX          = startX;
            buttonParms.Width           = width;
            buttonParms.StartY          = startY - ((index + 1) * height + (17 * (index + 1)));
            buttonParms.Text            = mapName;
            buttonParms.TextsPosition   = new Vector2(startX + (width / 2 - 30), buttonParms.StartY - 2f);
            this.PreviewButton          = new ColouredButton(buttonParms);

            // title
            StaticDrawable2DParams staticParms = new StaticDrawable2DParams();

            staticParms.Position = new Vector2(20f, 100f);
            staticParms.Texture  = LoadingUtils.loadTexture2D(device, ResourceManager.MAP_FOLDER + mapName + ".png");
            staticParms.Scale    = new Vector2(.8f, .8f);
            this.previewImage    = new StaticDrawable2D(staticParms);
        }
Пример #8
0
        /// <summary>
        /// Constructs a CheckBox object based on the params
        /// </summary>
        /// <param name="parms">CheckBoxParams object</param>
        public CheckBox(CheckBoxParams parms) : base(parms)
        {
            this.Checked = parms.Checked;

            StaticDrawable2DParams imgParms = new StaticDrawable2DParams {
                Position           = parms.Position,
                LightColour        = parms.LightColour,
                Scale              = parms.Scale,
                RenderingRectangle = Constants.CHK_BOX_UNCHECKED,
                Texture            = LoadingUtils.load <Texture2D>(parms.Content, Constants.GUI_FILE_NAME),
                Origin             = new Vector2(Constants.CHK_BOX_UNCHECKED.Width / 2, Constants.CHK_BOX_UNCHECKED.Height / 2)
            };

            this.uncheckedBoxImag = new StaticDrawable2D(imgParms);
            Vector3 min = new Vector3(parms.Position.X - Constants.CHK_BOX_CHECKED.Width / 2,
                                      parms.Position.Y - Constants.CHK_BOX_CHECKED.Height / 2, 0f);
            Vector3 max = new Vector3(parms.Position.X + Constants.CHK_BOX_CHECKED.Width / 2,
                                      parms.Position.Y + Constants.CHK_BOX_CHECKED.Height / 2, 0f);

            this.bbox = new BoundingBox(min, max);

            imgParms.RenderingRectangle = Constants.CHK_BOX_CHECKED;
            this.checkedBoxImag         = new StaticDrawable2D(imgParms);

            Text2DParams textParms = new Text2DParams {
                Position    = new Vector2(parms.Position.X + 40f, parms.Position.Y),
                LightColour = parms.LightColour,
                WrittenText = parms.Text,
                Scale       = parms.Scale,
                Font        = parms.Font,
                Origin      = new Vector2(Constants.CHK_BOX_UNCHECKED.Width / 2, Constants.CHK_BOX_UNCHECKED.Height / 2)
            };

            this.text = new Text2D(textParms);
        }
Пример #9
0
        public BackGround(ContentManager content)
        {
            StaticDrawable2DParams backGroundParms = new StaticDrawable2DParams();

            backGroundParms.Position    = new Vector2(0f, Constants.HUD_OFFSET);
            backGroundParms.Texture     = LoadingUtils.load <Texture2D>(content, "BackGround1");
            backGroundParms.LightColour = COLOUR;
            this.backGround             = new StaticDrawable2D(backGroundParms);

            this.grassBlades = new List <StaticDrawable2D>();
            Texture2D grass1Texture           = LoadingUtils.load <Texture2D>(content, "Grass1");
            StaticDrawable2DParams grassParms = new StaticDrawable2DParams();

            grassParms.Texture = grass1Texture;

            List <Point> usedIndexes = new List <Point>();
            Point        point;
            Random       rand = new Random();

            for (int i = 0; i < GRASS_BLADES; i++)
            {
                point = new Point(rand.Next(Constants.MAX_X_TILES), rand.Next(Constants.MAX_Y_TILES));
                if (usedIndexes.Contains(point))
                {
                    i--;
                    continue;
                }
                else
                {
                    usedIndexes.Add(point);
                    grassParms.Position = new Vector2(point.X * Constants.TILE_SIZE, (point.Y * Constants.TILE_SIZE) + Constants.HUD_OFFSET);
                    this.grassBlades.Add(new StaticDrawable2D(grassParms));
                }
            }
        }
Пример #10
0
        public MainMenu(ContentManager content)
        {
            ColouredButtonParams buttonParms = new ColouredButtonParams();

            buttonParms.Font            = ResourceManager.getInstance().Font;
            buttonParms.Height          = 25;
            buttonParms.LinesTexture    = ResourceManager.getInstance().ButtonLineTexture;
            buttonParms.MouseOverColour = ResourceManager.MOUSE_OVER_COLOUR;
            buttonParms.RegularColour   = ResourceManager.TEXT_COLOUR;
            buttonParms.StartX          = 640;
            buttonParms.Width           = 150;

            // play button
            buttonParms.StartY        = 473;
            buttonParms.Text          = "Play";
            buttonParms.TextsPosition = new Vector2(690f, buttonParms.StartY - 2f);
            this.playButton           = new ColouredButton(buttonParms);

            // instructions button
            buttonParms.StartY        = 515;
            buttonParms.Text          = "Instructions";
            buttonParms.TextsPosition = new Vector2(650f, buttonParms.StartY - 2f);
            this.instructionsButton   = new ColouredButton(buttonParms);

            // exit button
            buttonParms.StartY        = 557;
            buttonParms.Text          = "Exit";
            buttonParms.TextsPosition = new Vector2(690f, buttonParms.StartY - 2);
            this.exitButton           = new ColouredButton(buttonParms);

            // title
            StaticDrawable2DParams staticParms = new StaticDrawable2DParams();

            staticParms.Position = new Vector2(0f, -20f);
            staticParms.Texture  = LoadingUtils.load <Texture2D>(content, "Title");
            this.title           = new StaticDrawable2D(staticParms);

            // background
            staticParms.Position = new Vector2(0f, 0f);
            staticParms.Texture  = LoadingUtils.load <Texture2D>(content, "MainMenu");
            this.backGround      = new StaticDrawable2D(staticParms);

            // load sound effects
            this.introSfx    = LoadingUtils.load <SoundEffect>(content, "Introduction");
            this.outroSfx    = LoadingUtils.load <SoundEffect>(content, "LetsGo");
            this.idleSfxs    = new SoundEffect[3];
            this.idleSfxs[0] = LoadingUtils.load <SoundEffect>(content, "Rules");
            this.idleSfxs[1] = LoadingUtils.load <SoundEffect>(content, "HaventGotAllDay");
            this.idleSfxs[2] = LoadingUtils.load <SoundEffect>(content, "LetsRobSomething");
            // tired of hearing this when debugging and not starting in this state
            if (StateManager.getInstance().CurrentGameState == StateManager.GameState.MainMenu)
            {
                SoundManager.getInstance().sfxEngine.playSoundEffect(this.introSfx);
            }
#if WINDOWS
#if DEBUG
            ScriptManager.getInstance().registerObject(((ColouredButton)this.playButton).Text, "playText");
#endif
#endif
        }
Пример #11
0
        public MainMenu(ContentManager content) : base(content, "MainMenu", new Vector2(Constants.RESOLUTION_X / 2, Constants.RESOLUTION_Y / 8 * 3))
        {
            this.effectParms = new PulseEffectParams {
                ScaleBy     = 1f,
                ScaleDownTo = .9f,
                ScaleUpTo   = 1.1f
            };
            this.index = 0;

            this.menuItems = new StaticDrawable2D[BUTTON_NAMES.Length];
            Vector2 startPosition = new Vector2(Constants.RESOLUTION_X / 2, (Constants.RESOLUTION_Y / 8 * 3) + 250f);

            StaticDrawable2DParams parms = new StaticDrawable2DParams {
                Origin = new Vector2(128f),
                Scale  = DEFAULT_SCALE,
            };

            for (int i = 0; i < this.menuItems.Length; i++)
            {
                parms.Position = new Vector2(startPosition.X, startPosition.Y + (i * SPACE));
                parms.Texture  = LoadingUtils.load <Texture2D>(content, BUTTON_NAMES[i]);

                this.menuItems[i] = new StaticDrawable2D(parms);
            }
            this.menuItems[0].addEffect(new PulseEffect(this.effectParms));
        }
Пример #12
0
        public Ghost(ContentManager content, Vector2 position, GhostObservationHandler observerHandler, CharactersInRange charactersInRange, OnDeath onDeath, float health = Constants.DEFAULT_HEALTH)
            : base(content, position, SPEED, charactersInRange, onDeath, health)
        {
            this.observerHandler = observerHandler;
            Texture2D texture = LoadingUtils.load <Texture2D>(content, "Ghost");

            StaticDrawable2DParams characterParms = new StaticDrawable2DParams {
                Position = position,
                Texture  = texture,
                Origin   = new Vector2(Constants.TILE_SIZE / 2)
            };

            base.init(new StaticDrawable2D(characterParms));

            Texture2D radiusTexture      = LoadingUtils.load <Texture2D>(content, "Ring");
            StaticDrawable2DParams parms = new StaticDrawable2DParams();

            parms.Position    = position;
            parms.LightColour = Color.LimeGreen;
            parms.Texture     = radiusTexture;
            parms.Origin      = new Vector2(Constants.TILE_SIZE / 2, -(Constants.TILE_SIZE / 4));

            this.selectedImg = new StaticDrawable2D(parms);
            this.seeking     = new Tracking(position, SPEED);
            this.fadeEffect  = createEffect(base.LightColour);
            this.addEffect(fadeEffect);
            this.selectedFadeEffect = createEffect(this.selectedImg.LightColour);

            initSkills();
        }
Пример #13
0
        public Cloud(Vector2 position, Texture2D texture, SpriteEffects spriteEffect)
        {
            StaticDrawable2DParams parms = new StaticDrawable2DParams();

            parms.Texture      = texture;
            parms.Position     = position;
            parms.SpriteEffect = spriteEffect;
            this.drawable      = new StaticDrawable2D(parms);
        }
Пример #14
0
        public Item(ContentManager content, string textureName, Placement startingPlacement)
        {
            StaticDrawable2DParams parms = new StaticDrawable2DParams();

            parms.Texture  = LoadingUtils.load <Texture2D>(content, textureName);
            parms.Origin   = new Vector2(ResourceManager.TILE_SIZE / 2f);
            parms.Position = new Vector2(startingPlacement.worldPosition.X + parms.Origin.X, startingPlacement.worldPosition.Y + parms.Origin.Y);
            this.image     = new StaticDrawable2D(parms);
            this.placement = startingPlacement;
        }
Пример #15
0
        /// <summary>
        /// Draws a radius using a SpriteDrawable2D
        /// </summary>
        /// <param name="spriteBatch">SpriteBatch object used to draw</param>
        /// <param name="position">Position to draw the radius around</param>
        /// <param name="debugColour">Colour to draw the rectangle in</param>
        /// <param name="radiusSpecificTexture">Texture2D used for drawing the radius</param>
        public static void drawRadius(SpriteBatch spriteBatch, Vector2 position, Texture2D radiusSpecificTexture, Color debugColour)
        {
            StaticDrawable2DParams parms = new StaticDrawable2DParams();

            parms.Position    = position;
            parms.LightColour = debugColour;
            parms.Texture     = radiusSpecificTexture;
            parms.Origin      = new Vector2(radiusSpecificTexture.Height / 2);
            new StaticDrawable2D(parms).render(spriteBatch);
        }
Пример #16
0
        public Tile(Texture2D texture, Point index, Color renderColour, TileValues tileValue)
            : base(index, texture, tileValue, new Vector2(1f))
        {
            StaticDrawable2DParams parms = new StaticDrawable2DParams();

            parms.Position    = new Vector2(base.WorldPosition.X, base.WorldPosition.Y + GameDisplay.BOARD_OFFSET_Y);
            parms.Texture     = texture;
            parms.LightColour = renderColour;
            this.image        = new StaticDrawable2D(parms);
        }
Пример #17
0
        public Cinematic(ContentManager content)
        {
            Texture2D texture            = LoadingUtils.load <Texture2D>(content, "Logo");
            StaticDrawable2DParams parms = new StaticDrawable2DParams {
                Texture  = texture,
                Origin   = new Vector2(texture.Width / 2, texture.Height / 2),
                Position = new Vector2(Constants.RESOLUTION_X / 2, Constants.RESOLUTION_Y / 2)
            };

            this.cinematic = new StaticDrawable2D(parms);
        }
Пример #18
0
        public BaseMenu(ContentManager content, string backgroundName, Vector2 position)
        {
            Texture2D texture            = LoadingUtils.load <Texture2D>(content, backgroundName);
            StaticDrawable2DParams parms = new StaticDrawable2DParams {
                Texture  = texture,
                Origin   = new Vector2(texture.Width / 2, texture.Height / 2),
                Position = position
            };

            this.background = new StaticDrawable2D(parms);
        }
Пример #19
0
        public HUDSelected(ContentManager content, Vector2 position) : base(content)
        {
            StaticDrawable2DParams parms = new StaticDrawable2DParams()
            {
                Position = position,
                Texture  = LoadingUtils.load <Texture2D>(content, "Ghost_Grey"),
                Scale    = new Vector2(.5f),
            };

            base.init(new StaticDrawable2D(parms));
        }
Пример #20
0
        public GenerationBoundary(ContentManager content, Vector2 position, float rotation = 0f) : base(content, true)
        {
            StaticDrawable2DParams boundaryParam = new StaticDrawable2DParams {
                Texture     = LoadingUtils.load <Texture2D>(this.content, "Chip"),
                LightColour = new Color(100f, 0f, 0f),
                Scale       = new Vector2(Constants.RESOLUTION_X, Constants.GENERATION_Y_SIZE),
                Rotation    = MathHelper.ToRadians(rotation),
                Position    = position
            };

            base.init(new StaticDrawable2D(boundaryParam));
        }
Пример #21
0
        public Wall(ContentManager content, Vector2 position)
            : base(content)
        {
            Texture2D texture = null;

            texture = LoadingUtils.load <Texture2D>(content, "Fence");

            StaticDrawable2DParams wallParams = new StaticDrawable2DParams {
                Position = position,
                Texture  = texture,
                Scale    = new Vector2(.5f),
                Origin   = new Vector2(Constants.TILE_SIZE)
            };

            this.idleImage = new StaticDrawable2D(wallParams);

            Animated2DSpriteLoadSingleRowBasedOnTexture parms = new Animated2DSpriteLoadSingleRowBasedOnTexture();
            BaseAnimationManagerParams animationParms         = new BaseAnimationManagerParams();

            animationParms.AnimationState  = AnimationState.PlayForwardOnce;
            animationParms.FrameRate       = 100f;
            animationParms.TotalFrameCount = 3;
            parms.Position        = position;
            parms.Scale           = new Vector2(.25f);
            parms.Texture         = LoadingUtils.load <Texture2D>(content, "FenceOpening");
            parms.Origin          = new Vector2(Constants.TILE_SIZE);
            parms.AnimationParams = animationParms;
            this.spawnSprite      = new Animated2DSprite(parms);
            base.init(spawnSprite);

            BaseParticle2DEmitterParams emitterParams = new BaseParticle2DEmitterParams()
            {
                ParticleTexture = LoadingUtils.load <Texture2D>(content, "Dust"),
            };

            this.dustEmitter = new DustParticleEmitter(emitterParams, base.Position);
            for (int i = 0; i < 5; i++)
            {
                this.dustEmitter.createParticle();
            }

            this.crumpleSFX = LoadingUtils.load <SoundEffect>(content, SFX_NAME_CRUMPLE);
            SoundEmitterParams sfxEmitterParms = new SoundEmitterParams {
                SFXEngine   = SoundManager.getInstance().SFXEngine,
                EmittRadius = SFX_EMITT_RADIUS,
                Position    = this.spawnSprite.Position
            };

            this.sfxEmitter = new SoundEmitter(sfxEmitterParms);
            SoundManager.getInstance().addEmitter(this.sfxEmitter);
            SoundManager.getInstance().playSoundEffect(this.sfxEmitter, this.crumpleSFX);
            this.stage = Stage.Opening;
        }
Пример #22
0
        private StaticDrawable2D getCharacterSprite(ContentManager content, Vector2 position, String monsterName)
        {
            Texture2D texture = LoadingUtils.load <Texture2D>(content, monsterName);

            StaticDrawable2DParams characterParams = new StaticDrawable2DParams {
                Position = position,
                Texture  = texture,
                Origin   = new Vector2(Constants.TILE_SIZE / 2),
            };

            return(new StaticDrawable2D(characterParams));
        }
Пример #23
0
        public Wall(ContentManager content, Vector2 position, Texture2D texture, BoundingBox boundingBox)
            : base(content)
        {
            this.staticBoundingBox = boundingBox;
            StaticDrawable2DParams wallParams = new StaticDrawable2DParams {
                Position = position,
                Texture  = texture,
                Origin   = new Vector2(Constants.TILE_SIZE / 2)
            };

            base.init(new StaticDrawable2D(wallParams));
        }
        public MapSeletMenu(GraphicsDevice device, ContentManager content)
        {
            ColouredButtonParams buttonParms = new ColouredButtonParams();

            buttonParms.Font              = ResourceManager.getInstance().Font;
            buttonParms.Height            = 25;
            buttonParms.LinesTexture      = ResourceManager.getInstance().ButtonLineTexture;
            buttonParms.MouseOverColour   = ResourceManager.MOUSE_OVER_COLOUR;
            buttonParms.RegularColour     = ResourceManager.TEXT_COLOUR;
            buttonParms.StartX            = 580;
            buttonParms.Width             = 205;
            buttonParms.StartY            = 530;
            buttonParms.Text              = "Mode Selection";
            buttonParms.TextsPosition     = new Vector2(605f, buttonParms.StartY - 2);
            this.returnToModeSelectButton = new ColouredButton(buttonParms);

            // read in our map names from the Maps directory
            string[] maps = Directory.GetFiles(ResourceManager.MAP_FOLDER, "*.png");
            for (int i = 0; i < maps.Length; i++)
            {
                maps[i] = StringUtils.scrubPathAndExtFromFileName(maps[i]);
            }
            Array.Sort(maps, new MapComparer());

            // load up our map selections via the names from the dierctory
            this.mapSelections = new List <MapSelection>(maps.Length);
            for (int i = 0; i < maps.Length; i++)
            {
                // if the maps number is double digits we need to offset it a bit
                if (maps[i].Length == 4)
                {
                    this.mapSelections.Add(new MapSelection(device, maps[i], i, buttonParms.Width, buttonParms.Height, buttonParms.StartX, buttonParms.StartY));
                }
                else
                {
                    this.mapSelections.Add(new MapSelection(device, maps[i], i, buttonParms.Width, buttonParms.Height, buttonParms.StartX - 4, buttonParms.StartY));
                }
            }

            // title
            StaticDrawable2DParams staticParms = new StaticDrawable2DParams();

            staticParms.Position = new Vector2(0f, 0f);
            staticParms.Texture  = LoadingUtils.load <Texture2D>(content, "MapSelection");
            this.title           = new StaticDrawable2D(staticParms);

            // no preview image
            staticParms.Position    = new Vector2(20f, 100f);
            staticParms.Texture     = LoadingUtils.load <Texture2D>(content, "NoPreview");
            staticParms.Scale       = new Vector2(.8f, .8f);
            staticParms.LightColour = ResourceManager.TEXT_COLOUR;
            this.noPreviewImage     = new StaticDrawable2D(staticParms);
        }
Пример #25
0
        public RadiusRing(ContentManager content, Vector2 position)
        {
            StaticDrawable2DParams ringParams = new StaticDrawable2DParams();

            ringParams.Position    = position;
            ringParams.Texture     = LoadingUtils.load <Texture2D>(content, "RadiusRing");
            TEXTURE_WIDTH          = ringParams.Texture.Width;
            ringParams.LightColour = COLOUR;
            ringParams.Origin      = new Vector2(TEXTURE_WIDTH / 2f);
            this.ring = new StaticDrawable2D(ringParams);
            updateBoundingSphere(position);
        }
Пример #26
0
        public GameDisplay(ContentManager content)
        {
            this.content = content;
            this.timer   = new Timer(content);

            ColouredButtonParams buttonParms = new ColouredButtonParams();

            buttonParms.Font            = ResourceManager.getInstance().Font;
            buttonParms.Height          = 25;
            buttonParms.LinesTexture    = ResourceManager.getInstance().ButtonLineTexture;
            buttonParms.MouseOverColour = ResourceManager.MOUSE_OVER_COLOUR;
            buttonParms.RegularColour   = ResourceManager.TEXT_COLOUR;
            buttonParms.StartX          = 700;
            buttonParms.Width           = 75;
            buttonParms.StartY          = 557;

            // start button
            buttonParms.Text          = "Start";
            buttonParms.TextsPosition = new Vector2(711f, buttonParms.StartY - 2f);
            this.startButton          = new ColouredButton(buttonParms);

            // HUD
            Text2DParams textParms = new Text2DParams();

            textParms.Font        = ResourceManager.getInstance().Font;
            textParms.LightColour = ResourceManager.TEXT_COLOUR;
            textParms.Position    = new Vector2(727f, 150f);
            this.treasureText     = new Text2D(textParms);

            StaticDrawable2DParams staticParms = new StaticDrawable2DParams();

            staticParms          = new StaticDrawable2DParams();
            staticParms.Position = new Vector2(702f, 148f);
            staticParms.Texture  = LoadingUtils.load <Texture2D>(content, "Treasure1");
            this.treasure        = new StaticDrawable2D(staticParms);

            //dust particle emitter
            BaseParticle2DEmitterParams particleEmitterParams = new BaseParticle2DEmitterParams();

            particleEmitterParams.ParticleTexture = LoadingUtils.load <Texture2D>(content, "Dust1");
            particleEmitterParams.SpawnDelay      = DustParticleEmitter.SPAWN_DELAY;
            this.dustEmitter = new DustParticleEmitter(particleEmitterParams);

            // load sound effects
            this.introSfx         = LoadingUtils.load <SoundEffect>(content, LEVEL_ENTRY_SFX_NAME);
            this.payDaySfx        = LoadingUtils.load <SoundEffect>(content, "PayDay");
            this.treasureSfx      = LoadingUtils.load <SoundEffect>(content, "TreasureCollect");
            this.guardDetectedSfx = LoadingUtils.load <SoundEffect>(content, "GuardDetection");
            this.dumpsterCrashSfx = LoadingUtils.load <SoundEffect>(content, "DumpsterCrash");
            this.dumpsterCloseSfx = LoadingUtils.load <SoundEffect>(content, "DumpsterClose");
        }
Пример #27
0
        public House(ContentManager content)
        {
            Texture2D houseTexture             = LoadingUtils.load <Texture2D>(content, "House");
            StaticDrawable2DParams houseParams = new StaticDrawable2DParams();

            houseParams.Texture  = houseTexture;
            houseParams.Position = new Vector2(1000f, 100f);
            this.house           = new StaticDrawable2D(houseParams);

            BaseParticle2DEmitterParams particleEmitterParams = new BaseParticle2DEmitterParams();

            particleEmitterParams.ParticleTexture = LoadingUtils.load <Texture2D>(content, "Smoke1");
            particleEmitterParams.SpawnDelay      = SmokeEmitter.SPAWN_DELAY;
            this.chimneySmokeEmitter = new SmokeEmitter(particleEmitterParams);
        }
Пример #28
0
        public Body(ContentManager content, Vector2 position, Vector2 heading, float rotation, List <TargetPosition> targetPositions)
            : base(content, true)
        {
            StaticDrawable2DParams bodyParms = new StaticDrawable2DParams();

            bodyParms.Texture     = LoadingUtils.load <Texture2D>(content, "Snakebody");
            bodyParms.Position    = position;
            bodyParms.Rotation    = rotation;
            bodyParms.Origin      = new Vector2(Constants.TILE_SIZE / 2);
            bodyParms.LightColour = Constants.SNAKE_LIGHT;
            base.init(new StaticDrawable2D(bodyParms));

            this.heading         = heading;
            this.targetPositions = targetPositions;
            this.pulseDirection  = PulseDirection.Up;
        }
Пример #29
0
        public HealthBar(ContentManager content, Vector2 position, float health)
        {
            this.MAX_HEALTH    = MathHelper.Max(Constants.DEFAULT_HEALTH, health);
            this.currentHealth = health;
            Vector2 pos = getPosition(position);
            StaticDrawable2DParams parms = new StaticDrawable2DParams();

            parms.Texture        = LoadingUtils.load <Texture2D>(content, "Chip");
            parms.Position       = new Vector2(pos.X, pos.Y);
            parms.Scale          = new Vector2(SCALE.X, SCALE.Y);
            parms.LightColour    = Color.Green;
            this.remainingHealth = new StaticDrawable2D(parms);

            parms.LightColour  = Color.DarkRed;
            this.maximumHealth = new StaticDrawable2D(parms);
        }
Пример #30
0
        public Dumpster(ContentManager content, string openDumpsterTextureName, string closedDumpsterTextureName, Placement startingPlacement)
            : base(content, openDumpsterTextureName, startingPlacement)
        {
            this.acceptingOccupants = true;
            StaticDrawable2DParams parms = new StaticDrawable2DParams();

            parms.Texture       = LoadingUtils.load <Texture2D>(content, closedDumpsterTextureName);
            parms.Origin        = new Vector2(ResourceManager.TILE_SIZE / 2f);
            parms.Position      = new Vector2(startingPlacement.worldPosition.X + parms.Origin.X, startingPlacement.worldPosition.Y + parms.Origin.Y);
            this.closedDumpster = new StaticDrawable2D(parms);

            Vector2 bboxPositionMin = startingPlacement.worldPosition;
            Vector2 bboxPositionMax = Vector2.Add(startingPlacement.worldPosition, new Vector2(ResourceManager.TILE_SIZE));

            base.BoundingBox = Helper.getBBox(bboxPositionMin, bboxPositionMax);
        }