Esempio n. 1
0
        public Player(GameplayScreen parentScreen, Vector2 position)
        {
            _Player_TexId_Standing_R = TextureManager.AddTexture(new CutlassTexture("Content/Sprites/pirate-standing-48-120-R"));
            _Player_TexId_Standing_L = TextureManager.AddTexture(new CutlassTexture("Content/Sprites/pirate-standing-48-120-L"));
            _Player_TexId_Jumping_R = TextureManager.AddTexture(new CutlassTexture("Content/Sprites/pirate-jumping-64-120-R"));
            _Player_TexId_Jumping_L = TextureManager.AddTexture(new CutlassTexture("Content/Sprites/pirate-jumping-64-120-L"));
            _Player_TexId_Walking_R = TextureManager.AddTexture(new CutlassAnimatedTexture("Content/Sprites/pirate-walking-560-120-R", 10, 5));
            _Player_TexId_Walking_L = TextureManager.AddTexture(new CutlassAnimatedTexture("Content/Sprites/pirate-walking-560-120-L", 10, 5));
            _Player_TexId_Walking_Reverse_R = TextureManager.AddTexture(new CutlassAnimatedTexture("Content/Sprites/pirate-walking-reverse-560-120-R", 10, 5));
            _Player_TexId_Walking_Reverse_L = TextureManager.AddTexture(new CutlassAnimatedTexture("Content/Sprites/pirate-walking-reverse-560-120-L", 10, 5));
            _CurrentTexture = _Player_TexId_Walking_R;

            _ParentScreen = parentScreen;
            _Active = true;
            _Position = position;
            _IsVisible = true;
        }
Esempio n. 2
0
        public Scenery(Vector2 position, bool isVisible = true, ICutlassTexture texture = null, bool animated = false, CollisionSide side = CollisionSide.All)
        {
            _Position = position;
            _IsVisible = isVisible;
            _Active = true;

            if (isVisible && texture != null)
            {
                _SceneryObject_Id = TextureManager.AddTexture(texture);
                _Animated = animated;
                _Side = side;
            }
            else
            {
                _Side = CollisionSide.All;
            }
        }
        /// <summary>
        /// Constructor lets the caller specify whether to include the standard
        /// "A=ok, B=cancel" usage text prompt.
        /// </summary>
        public MessageBoxScreen(string message, bool includeUsageText = false, bool includeCancelOption = false)
        {
            _IncludeCancelOption = includeCancelOption;
            _Gradient_Id = TextureManager.AddTexture(new CutlassTexture("Content/Textures/gradient"));

            string usageText = String.Empty;

            switch (CutlassEngine.CurrentPlatform)
            {
                case PlatformID.MacOSX:
                    goto case PlatformID.Win32Windows;
                case PlatformID.Unix:
                    goto case PlatformID.Win32Windows;
                case PlatformID.Win32NT:
                    goto case PlatformID.Win32Windows;
                case PlatformID.Win32S:
                    goto case PlatformID.Win32Windows;
                case PlatformID.Win32Windows:
                    usageText = "\nSpace, Enter = OK";
                    if (_IncludeCancelOption)
                        usageText += "\nEsc = Cancel";
                    break;
                case PlatformID.WinCE:
                    goto case PlatformID.Win32Windows;
                case PlatformID.Xbox:
                    usageText = "\nSA = OK";
                    if (_IncludeCancelOption)
                        usageText += "\nB = Cancel";
                    break;
                default:
                    break;
            }

            if (includeUsageText)
                this._Message = message + usageText;
            else
                this._Message = message;

            IsPopup = true;

            TransitionOnTime = TimeSpan.FromSeconds(0.2);
            TransitionOffTime = TimeSpan.FromSeconds(0.2);
        }
Esempio n. 4
0
        /// <summary>
        /// Load graphics content.
        /// </summary>
        protected override void LoadContent()
        {
            //_SpriteBatch = new SpriteBatch(GraphicsDevice);

            _Blank_Id = TextureManager.AddTexture(new CutlassTexture("Content/Textures/blank"));
            _Cursor_Id = TextureManager.AddTexture(new CutlassTexture("Content/Textures/cursor"));

            // Tell each of the screens to load their content.
            foreach (GameScreen screen in _Screens)
            {
                screen.LoadContent();
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Get a Texture2D
        /// </summary>
        /// <param name="textureName"></param>
        /// <returns></returns>
        public static Texture2D GetTexture2D(TexId textureId)
        {
            ICutlassTexture texture = GetTexture(textureId);

            if (texture != null)
                return texture.BaseTexture;
            else
                return null;
        }
Esempio n. 6
0
 /// <summary>
 /// Get a texture
 /// </summary>
 /// <param name="textureId"></param>
 /// <returns></returns>
 public static ICutlassTexture GetTexture(TexId textureId)
 {
     return _Textures.ElementAtOrDefault(textureId).Value;
 }
Esempio n. 7
0
        /// <summary>
        /// Remove a texture from the dictionary.
        /// </summary>
        /// <param name="textureName"></param>
        public static void RemoveTexture(TexId textureId)
        {
            ICutlassTexture textureToRemove;
            _Textures.TryGetValue(textureId, out textureToRemove);

            if (textureToRemove != null)
            {
                if (_Initialized)
                    textureToRemove.UnloadContent();

                _Textures.Remove(textureId);
            }
        }
        /// <summary>
        /// Loads graphics content for this screen. The background texture is quite
        /// big, so we use our own local ContentManager to load it. This allows us
        /// to unload before going from the menus into the game itself, wheras if we
        /// used the shared ContentManager provided by the Game class, the content
        /// would remain loaded forever.
        /// </summary>
        public override void LoadContent()
        {
            base.LoadContent();

            _OceanClouds_Id = TextureManager.AddTexture(new CutlassTexture("Content/Textures/oceanClouds"));
        }
        /// <summary>
        /// Load Content
        /// </summary>
        public override void LoadContent()
        {
            base.LoadContent();

            _TitleScrollMiddle_Id = TextureManager.AddTexture(new CutlassTexture("Content/Textures/titleScrollMiddle"));
            _TitleScrollEdge_Id = TextureManager.AddTexture(new CutlassTexture("Content/Textures/titleScrollEdge"));
            _MenuBackgroundCorner_Id = TextureManager.AddTexture(new CutlassTexture("Content/Textures/backgroundMenuCorner"));
            _MenuBackgroundVerticalEdge_Id = TextureManager.AddTexture(new CutlassTexture("Content/Textures/backgroundMenuVerticalEdge"));
            _MenuBackgroundHorizontalEdge_Id = TextureManager.AddTexture(new CutlassTexture("Content/Textures/backgroundMenuHorizontalEdge"));

            _TitleFont_Id = FontManager.AddFont(new CutlassFont("Content/Fonts/bilboSwashCaps"));

            SetMenuEntryFont(FontManager.AddFont(new CutlassFont("Content/Fonts/frederickaTheGreat")));
            SetMenuEntryTextColor(Palette.CharcoalGrey);
            SetMenuEntrySelectedTextColor(Palette.LightBlue);
        }
Esempio n. 10
0
        /// <summary>
        /// Load Content.
        /// </summary>
        protected override void LoadContent()
        {
            base.LoadContent();

            _Blank_Id = TextureManager.AddTexture(new CutlassTexture("Content/Textures/blank"));
        }
Esempio n. 11
0
        public void HandleInput(GameTime gameTime, Cutlass.GameComponents.Input input, Vector2 playerScreenPosition)
        {
            KeyboardState keyboardState = input.CurrentKeyboardState;
            MouseState mouseState = input.CurrentMouseState;
            GamePadState gamePadState = input.CurrentGamePadState;

            //Keyboard Input
            _IsJumpingDown = false;
            _WalkDirection = 0;

            if (keyboardState.IsKeyDown(GameSettingsManager.Default.LeftKey))
            {
                _WalkDirection = _WalkDirection - 1;
                _Velocity.X = Math.Max(_Velocity.X - (0.1f * (float)gameTime.ElapsedGameTime.TotalMilliseconds), -MAX_PLAYER_HORIZONTAL_SPEED);
            }

            if (keyboardState.IsKeyDown(GameSettingsManager.Default.RightKey))
            {
                _WalkDirection = _WalkDirection + 1;
                _Velocity.X = Math.Min(_Velocity.X + (0.1f * (float)gameTime.ElapsedGameTime.TotalMilliseconds), MAX_PLAYER_HORIZONTAL_SPEED);
            }

            if (keyboardState.IsKeyDown(GameSettingsManager.Default.JumpKey) && _IsOnGround)
            {
                _IsOnGround = false;

                if (keyboardState.IsKeyDown(GameSettingsManager.Default.DownKey))
                {
                    _IsJumpingDown = true;
                    _Velocity.Y += 1.0f;
                }
                else
                {
                    _Velocity.Y = _Velocity.Y - (6.0f);
                }
            }

            //Mouse Input
            Vector2 mousePosition = new Vector2(mouseState.X, mouseState.Y);
            _LookDirection = mousePosition - (playerScreenPosition);// + new Vector2(Width / 2, Height / 2));
            _LookDirection.Normalize();

            //Looking Right
            if (_LookDirection.X >= 0)
            {
                //On the ground
                if (_WasOnGround)
                {
                    //Walking forward
                    if (_WalkDirection > 0)
                    {
                        _CurrentTexture = _Player_TexId_Walking_R;
                    }
                    //Walking backward
                    else if (_WalkDirection < 0)
                    {
                        _CurrentTexture = _Player_TexId_Walking_Reverse_R;
                    }
                    //Standing
                    else
                    {
                        _CurrentTexture = _Player_TexId_Standing_R;
                    }
                }
                //Jumping
                else
                {
                    _CurrentTexture = _Player_TexId_Jumping_R;
                }
            }
            //Looking Left
            else
            {
                //On the ground
                if (_WasOnGround)
                {
                    //Walking forward
                    if (_WalkDirection < 0)
                    {
                        _CurrentTexture = _Player_TexId_Walking_L;
                    }
                    //Walking backward
                    else if (_WalkDirection > 0)
                    {
                        _CurrentTexture = _Player_TexId_Walking_Reverse_L;
                    }
                    //Standing
                    else
                    {
                        _CurrentTexture = _Player_TexId_Standing_L;
                    }
                }
                //Jumping
                else
                {
                    _CurrentTexture = _Player_TexId_Jumping_L;
                }
            }
        }