コード例 #1
0
ファイル: Ghost.cs プロジェクト: XXChester/Army-Of-The-Undead
        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();
        }
コード例 #2
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);
        }
コード例 #3
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
        }
コード例 #4
0
ファイル: Launcher.cs プロジェクト: XXChester/Nuke-Launch
        protected void updateDirection()
        {
            if (this.direction == Direction.Left)
            {
                this.truck.SpriteEffect = SpriteEffects.FlipHorizontally;
                this.activeBarrel       = this.leftBarrel;
            }
            else if (this.direction == Direction.Right)
            {
                this.truck.SpriteEffect = SpriteEffects.None;
                this.activeBarrel       = this.rightBarrel;
            }
            float preAngle = this.angle;

            this.angle = (this.angle - this.angle) - preAngle;


            /*if (InputManager.getInstance().wasKeyPressed(Keys.A)) {
             *      if (base.direction != Direction.Left) {
             *              base.direction = Direction.Left;
             *              base.truck.SpriteEffect = SpriteEffects.FlipHorizontally;
             *              base.activeBarrel = base.leftBarrel;
             *              float preAngle = base.angle;
             *              base.angle = (base.angle - base.angle) - preAngle;
             *      }
             * } else if (InputManager.getInstance().wasKeyPressed(Keys.D)) {
             *      if (base.direction != Direction.Right) {
             *              base.direction = Direction.Right;
             *              base.truck.SpriteEffect = SpriteEffects.None;
             *              base.activeBarrel = base.rightBarrel;
             *              float preAngle = base.angle;
             *              base.angle = (base.angle - base.angle) - preAngle;
             *      }
             * }*/
        }
コード例 #5
0
ファイル: Sun.cs プロジェクト: XXChester/Flowers
        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
        }
コード例 #6
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));
                }
            }
        }
コード例 #7
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
        }
コード例 #8
0
        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);
        }
コード例 #9
0
ファイル: Mob.cs プロジェクト: XXChester/Army-Of-The-Undead
        public Mob(ContentManager content, Vector2 position, CharactersInRange charactersInRange, OnDeath onDeath, CollisionCheck collisionCheck, String monsterName)
            : base(content, position, SPEED, charactersInRange, onDeath, Constants.DEFAULT_HEALTH)
        {
            StaticDrawable2D character = getCharacterSprite(content, position, monsterName);

            base.init(character);

            BehaviourFinished idleCallback = delegate() {
                swapBehaviours(this.idleBehaviour, State.Idle);
            };
            BehaviourFinished restartPathing = delegate() {
#if DEBUG
                Debug.log("Restarting");
#endif
                //this.activeBehaviour.Target = this.LastKnownLocation;
                pathToWaypoint(this.LastKnownLocation);
            };

            this.seekingBehaviour    = new Tracking(position, SPEED, idleCallback, collisionCheck);
            this.lostTargetBehaviour = new LostTarget(this.seekingBehaviour.Position, this.seekingBehaviour.Position, SPEED, idleCallback);
            this.pathingBehaviour    = new Pathing(position, SPEED, idleCallback, collisionCheck, restartPathing);
            this.idleBehaviour       = new IdleBehaviour(position);
            this.activeBehaviour     = this.idleBehaviour;
            this.CurrentState        = State.Idle;
            updateBoundingSphere();
            this.previousPoint     = base.Position.toPoint();
            this.LastKnownLocation = base.Position;

            this.skills       = new List <Skill>();
            this.explosionSfx = LoadingUtils.load <SoundEffect>(content, "CorpseExplosion");
            initSkills();
        }
コード例 #10
0
        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);
        }
コード例 #11
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);
        }
コード例 #12
0
        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");
        }
コード例 #13
0
ファイル: Cloud.cs プロジェクト: XXChester/Flowers
        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
        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);
        }
コード例 #16
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);
        }
コード例 #17
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);
        }
コード例 #18
0
        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);
        }
コード例 #19
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);
        }
コード例 #20
0
ファイル: Wall.cs プロジェクト: XXChester/Snake-Rawr-Rawr
        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;
        }
コード例 #21
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");
        }
コード例 #22
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);
        }
コード例 #23
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);
        }
コード例 #24
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);
        }
コード例 #25
0
        protected void init(bool fullRegen = false)
        {
            if (fullRegen)
            {
                this.allGhosts.Clear();
                this.mobs.Clear();
                this.map             = null;
                this.recentlySpawned = new List <Ghost>();
            }
            this.ghostObserverHandler = new GhostObservationHandler();
            this.hud = new HUD(content, delegate(int id) {
                Ghost selected = this.selectedGhosts[id];
                clearSelectedGhosts();
                selectGhost(selected);
                this.clearSelection = false;
            });
            initDelegates();
            loadMap();
            // if we have ghosts left over, we need to preserve them
            if (GameStateMachine.getInstance().LevelContext != null && GameStateMachine.getInstance().LevelContext.Ghosts != null)
            {
                Ghost primary = this.allGhosts[0];
                Ghost ghost   = null;
                for (int i = 1; i <= GameStateMachine.getInstance().LevelContext.Ghosts.Count; i++)
                {
                    ghost = GameStateMachine.getInstance().LevelContext.Ghosts[i - i];
                    float factor = ghost.Health;
                    if (factor > 0)
                    {
                        Vector2 newPosition = Vector2.Add(primary.Position, new Vector2(i * (Constants.TILE_SIZE / 2)));
                        this.allGhosts.Add(new Ghost(content, newPosition, this.ghostObserverHandler, this.mobsInRange, this.ghostDeathFinish, factor));
                    }
                }
            }
#if DEBUG
            /*Ghost g = new Ghost(content, new Vector2(672, 360), this.ghostObserverHandler, this.mobsInRange, this.ghostDeathFinish, 10f);
             * this.allGhosts.Add(g);*/
#endif
            StaticDrawable2DParams botParms = new StaticDrawable2DParams()
            {
                Position = new Vector2(0f, 672),
                Texture  = LoadingUtils.load <Texture2D>(content, "BottomBorder"),
            };
            this.bottomBorder = new StaticDrawable2D(botParms);
            CombatManager.getInstance().init();
            EffectsManager.getInstance().init();
        }
コード例 #26
0
        public ModeSelectMenu(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;

            // Normal button
            buttonParms.StartY        = 473;
            buttonParms.Text          = "Normal";
            buttonParms.TextsPosition = new Vector2(640f, buttonParms.StartY - 2f);
            this.normalButton         = new ColouredButton(buttonParms);

            // Time attack button
            buttonParms.StartY        = 515;
            buttonParms.Text          = "Time Attack";
            buttonParms.TextsPosition = new Vector2(610f, buttonParms.StartY - 2f);
            this.timeAttackButton     = new ColouredButton(buttonParms);

            // 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, "ModeSelection");
            this.title           = new StaticDrawable2D(staticParms);

            // background
            staticParms.Position = new Vector2(15f, 150f);
            staticParms.Scale    = new Vector2(.75f, .75f);
            staticParms.Texture  = LoadingUtils.load <Texture2D>(content, "ModeHelp");
            this.backGround      = new StaticDrawable2D(staticParms);

            // sound effects
            this.outroSfx = LoadingUtils.load <SoundEffect>(content, "WhereWeGonnaRob");
        }
コード例 #27
0
        public BaseTutorialScenario(ContentManager content, string scenarioName, Ghost ghost, Mob mob)
        {
            Constants.ALLOW_MOB_ATTACKS    = false;
            Constants.ALLOW_PLAYER_ATTACKS = false;

            this.ghost = ghost;
            this.mob   = mob;

            Texture2D texture            = LoadingUtils.load <Texture2D>(content, "Tut_" + scenarioName);
            Vector2   position           = new Vector2(Constants.RESOLUTION_X / 2, 0f);
            StaticDrawable2DParams parms = new StaticDrawable2DParams {
                Position = position,
                Texture  = texture,
                Origin   = new Vector2(texture.Width / 2f, 0f)
            };

            this.tutorialHelp = new StaticDrawable2D(parms);
        }
コード例 #28
0
        public GameOverMenu(ContentManager content, ScoreCalculationDelegate scoreCalculator, ResetBoardDelegate resetCallBack)
        {
            this.scoreCalculatorCallBack = (ScoreCalculationDelegate)scoreCalculator;
            this.resetCallBack           = resetCallBack;
            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          = 515;

            // replay button
            buttonParms.Text          = "Replay";
            buttonParms.TextsPosition = new Vector2(645f, buttonParms.StartY - 2f);
            this.replayButton         = new ColouredButton(buttonParms);

            // Map selection button
            buttonParms.StartY        = 557;
            buttonParms.Text          = "Map Selection";
            buttonParms.TextsPosition = new Vector2(610f, buttonParms.StartY - 2f);
            this.mapSelectionButton   = new ColouredButton(buttonParms);

            // game over text
            Text2DParams textParams = new Text2DParams();

            textParams.Font     = ResourceManager.getInstance().Font;
            textParams.Position = new Vector2(200f, 50f);
            this.gameOverText   = new Text2D(textParams);

            // loosing background
            StaticDrawable2DParams staticParms = new StaticDrawable2DParams();

            staticParms.Position = new Vector2(-10f, 0f);
            staticParms.Texture  = LoadingUtils.load <Texture2D>(content, "BackGround1");
            this.looseBackGround = new StaticDrawable2D(staticParms);

            // winning background
            staticParms.Texture = LoadingUtils.load <Texture2D>(content, "BackGround2");
            this.winBackGround  = new StaticDrawable2D(staticParms);
        }
コード例 #29
0
        public InGameMenu(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;

            // play button
            buttonParms.StartY        = 515;
            buttonParms.Text          = "Return to Game";
            buttonParms.TextsPosition = new Vector2(610f, buttonParms.StartY - 2f);
            this.returnToGameButton   = new ColouredButton(buttonParms);

            // exit button
            buttonParms.StartY        = 557;
            buttonParms.Text          = "Exit To Main Menu";
            buttonParms.TextsPosition = new Vector2(590f, buttonParms.StartY - 2);
            this.exitToMainButton     = new ColouredButton(buttonParms);

            // title
            StaticDrawable2DParams staticParms = new StaticDrawable2DParams();

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

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

            // setup the particle emitter
            BaseParticle2DEmitterParams particleEmitterParams = new BaseParticle2DEmitterParams();

            particleEmitterParams.ParticleTexture = LoadingUtils.load <Texture2D>(content, "QuestionParticle");
            particleEmitterParams.SpawnDelay      = QuestionMarkEmitter.SPAWN_DELAY;
            this.particleEmitter = new QuestionMarkEmitter(particleEmitterParams);
        }
コード例 #30
0
        public HUDIcon(ContentManager content, Vector2 position, string textureName) : base(content)
        {
            this.content = content;

            StaticDrawable2DParams parms = new StaticDrawable2DParams();

            parms.Position = position;
            parms.Origin   = new Vector2(ICON_SIZE / 2f);
            parms.Texture  = LoadingUtils.load <Texture2D>(content, "Skill" + textureName);

            base.init(new StaticDrawable2D(parms));
            parms.Position = Vector2.Add(position, new Vector2(0f, ICON_SIZE / 2f));
            parms.Texture  = LoadingUtils.load <Texture2D>(content, "CooldownChip");
            parms.Origin   = new Vector2(ICON_SIZE / 2f, 0f);
            parms.Rotation = MathHelper.ToRadians(180f);
            parms.Scale    = getDefaultScale();
            this.coolDown  = new StaticDrawable2D(parms);
            //this.information = new TextPopup(content, position);
        }