Пример #1
0
        private void CreateBodies(BazingaGame game)
        {
            for (int i = 0; i < _mapTiles.Length; i++)
            {
                for (int j = 0; j < _mapTiles[0].Length; j++)
                {
                    if (_mapTiles[i][j].TileSprite != MapSpriteTile.None)
                    {
                        _mapTiles[i][j].IsPassable               = false;
                        _mapTiles[i][j].Origin                   = new Vector2(TileSize / 2f, TileSize / 2f);
                        _mapTiles[i][j].Body                     = BodyFactory.CreateRectangle(game.World, ConvertUnits.ToSimUnits(TileSize), ConvertUnits.ToSimUnits(TileSize), 1f);
                        _mapTiles[i][j].Body.BodyType            = BodyType.Static;
                        _mapTiles[i][j].Body.Position            = ConvertUnits.ToSimUnits((i) * TileSize + TileSize / 2f, (j) * TileSize + TileSize / 2f);
                        _mapTiles[i][j].Body.Friction            = 1f;
                        _mapTiles[i][j].Body.Restitution         = 0f;
                        _mapTiles[i][j].Body.CollisionCategories = Category.Cat2;
                        _mapTiles[i][j].Body.CollidesWith        = Category.All;
                    }
                    else
                    {
                        _mapTiles[i][j].IsPassable = true;
                        _mapTiles[i][j].Origin     = new Vector2(TileSize / 2f, TileSize / 2f);
                        _mapTiles[i][j].Body       = null;
                    }

                    if (_mapTiles[i][j].TileSprite == MapSpriteTile.GroundRight)
                    {
                        _mapTiles[i][j].Body.Friction = 0;
                    }
                }
            }
        }
Пример #2
0
 public BazingaPlayer(BazingaGame game, float initialX, float initialY)
     : base(game)
 {
     _initialX = initialX;
     _initialY = initialY;
     DrawOrder = 100;
 }
 public ParticleEngine(BazingaGame game, Texture2D texture, Vector2 location)
     : base(game)
 {
     EmitterLocation = location;
     this.texture    = texture;
     this.particles  = new List <Particle>();
     random          = new Random();
 }
Пример #4
0
 public Box(BazingaGame game, float initialX, float initialY)
     : base(game)
 {
     // Nop
     DrawOrder = 10;
     _initialX = initialX;
     _initialY = initialY;
 }
Пример #5
0
 /// <summary>
 /// Constructs a new menu entry with the specified text.
 /// </summary>
 public MenuEntry(BazingaGame game, Menu menu, string text, EntryType type)
     : base(game)
 {
     Text   = text;
     _type  = type;
     _menu  = menu;
     _scale = 0.9f;
     Alpha  = 1.0f;
 }
Пример #6
0
        public Menu(BazingaGame game, string menuTitle)
            : base(game)
        {
            _menuTitle = menuTitle;

            //TransitionOnTime = TimeSpan.FromSeconds(0.7);
            //TransitionOffTime = TimeSpan.FromSeconds(0.7);
            //HasCursor = true;
        }
Пример #7
0
 /// <summary>
 /// Constructs a new menu entry with the specified text.
 /// </summary>
 public MenuButton(BazingaGame game, Texture2D sprite, bool flip, Vector2 position)
     : base(game)
 {
     _scale      = 1f;
     _sprite     = sprite;
     _baseOrigin = new Vector2(_sprite.Width / 2f, _sprite.Height / 2f);
     Hover       = false;
     _flip       = flip;
     Position    = position;
 }
        public SplashScreenState(BazingaGame game)
        {
            Game = game;

            _splashScreens                 = new List <Texture2D>();
            _currentSplashScreenIndex      = 0;
            _splashScreenShowTimeInSeconds = 4;

            _lastSplashScreenChanged = new GameTime();
        }
Пример #9
0
 public Particle(BazingaGame game, Texture2D texture, Vector2 position, Vector2 velocity,
                 float angle, float angularVelocity, Color color, float size, int ttl)
     : base(game)
 {
     Texture         = texture;
     Position        = position;
     Velocity        = velocity;
     Angle           = angle;
     AngularVelocity = angularVelocity;
     Color           = color;
     Size            = size;
     TTL             = ttl;
 }
Пример #10
0
        /// <summary>
        ///   Constructs a new input state.
        /// </summary>
        public InputHelper(BazingaGame game)
            : base(game)
        {
            KeyboardState = new KeyboardState();
            GamePadState  = new GamePadState();
            MouseState    = new MouseState();
            VirtualState  = new GamePadState();

            PreviousKeyboardState = new KeyboardState();
            PreviousGamePadState  = new GamePadState();
            PreviousMouseState    = new MouseState();
            PreviousVirtualState  = new GamePadState();

            //_manager = manager;

            _cursorIsVisible = false;
            IsCursorMoved    = false;

            IsCursorValid = true;

            Cursor = Vector2.Zero;

            _handleVirtualStick = false;
        }
Пример #11
0
 public GameMapState(BazingaGame game)
 {
     Game = game;
 }
Пример #12
0
 public MainMenuState(BazingaGame game)
 {
     Game = game;
 }
Пример #13
0
 public Map(BazingaGame game)
     : base(game)
 {
 }