/// <summary>
        /// A Polygon object that you will be able to draw.
        /// Animations are being implemented as we speak.
        /// </summary>
        /// <param name="graphicsDevice">The graphicsdevice from a GameRef object</param>
        /// <param name="vertices">The vertices in a clockwise order</param>
        public PolygonShape(DnK game, Vector2[] vertices)
        {
            _gameRef      = game;
            _vertices     = vertices;
            _triangulated = false;
            _size         = Vector2.Zero;
            _area         = 0f;
            _center       = Vector2.Zero;

            _edgeEffect = _gameRef.Content.Load <Effect>("Graphics/Shaders/Edge");

            _effect = new BasicEffect(_gameRef.GraphicsDevice)
            {
                Projection = Matrix.CreateOrthographicOffCenter(
                    0, _gameRef.GraphicsDevice.Viewport.Width, _gameRef.GraphicsDevice.Viewport.Height, 0, 0, 1),
                VertexColorEnabled = true,
                DiffuseColor       = new Vector3(0, 1, 0),
                Alpha = 0.5f
            };

            if (_vertices != null)
            {
                Triangulate();
            }
        }
Exemplo n.º 2
0
 public Laser(DnK gameRef, Vector2 start, Vector2 end, float thickness = 1)
     : base(gameRef)
 {
     _start = start;
     _end = end;
     _thickness = thickness;
 }
Exemplo n.º 3
0
        public BossStructure(DnK game, Entity parent, int iteration = 50, float step = 25, PolygonShape polygonShape = null)
        {
            _gameRef = game;
            _parent = parent;

            _iteration = iteration;
            _step = step;
            _iteration = iteration;
            _area = 0f;

            _bottomRightVertices = new List<Vector2>();
            _bottomLeftVertices = new List<Vector2>();
            _topRightVertices = new List<Vector2>();
            _topLeftVertices = new List<Vector2>();

            _bottomRightLastDirection = Direction.Left;
            _topRightLastDirection = Direction.Left;

            if (polygonShape != null)
            {
                _polygonShape = polygonShape;
                _size = polygonShape.GetSize();
            }
            else
            {
                _polygonShape = new PolygonShape(_gameRef, null);
                GenerateBaseStructure();
            }
        }
Exemplo n.º 4
0
        public BossStructure(DnK game, Entity parent, int iteration = 50, float step = 25, PolygonShape polygonShape = null)
        {
            _gameRef = game;
            _parent  = parent;

            _iteration = iteration;
            _step      = step;
            _iteration = iteration;
            _area      = 0f;

            _bottomRightVertices = new List <Vector2>();
            _bottomLeftVertices  = new List <Vector2>();
            _topRightVertices    = new List <Vector2>();
            _topLeftVertices     = new List <Vector2>();

            _bottomRightLastDirection = Direction.Left;
            _topRightLastDirection    = Direction.Left;

            if (polygonShape != null)
            {
                _polygonShape = polygonShape;
                _size         = polygonShape.GetSize();
            }
            else
            {
                _polygonShape = new PolygonShape(_gameRef, null);
                GenerateBaseStructure();
            }
        }
Exemplo n.º 5
0
        public BaseGameState(Game game, GameStateManager manager)
            : base(game, manager)
        {
            GameRef = (DnK)game;

            playerIndexInControl = PlayerIndex.One;
        }
Exemplo n.º 6
0
        public BaseGameState(Game game, GameStateManager manager)
            : base(game, manager)
        {
            GameRef = (DnK)game;

            playerIndexInControl = PlayerIndex.One;
        }
Exemplo n.º 7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Danmaku_no_Kyojin.BulletEngine.Mover"/> class.
        /// </summary>
        /// <param name="myBulletManager">My bullet manager.</param>
        public Mover(DnK game, IBulletManager myBulletManager) : base(game, myBulletManager)
        {
            Position = Vector2.Zero;
            Rotation = 0f;

            IsAlive = true;
        }
Exemplo n.º 8
0
 protected BaseBullet(DnK gameRef, Texture2D sprite, Vector2 position, Vector2 direction, Vector2 velocity)
     : base(gameRef)
 {
     Sprite    = sprite;
     Position  = position;
     Direction = direction;
     Velocity  = velocity;
 }
Exemplo n.º 9
0
        protected Entity(DnK gameRef)
        {
            GameRef = gameRef;

            CollisionBoxes = new CollisionElements();
            _scale         = new Vector2(1f, 1f);
            IsAlive        = true;
        }
Exemplo n.º 10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Danmaku_no_Kyojin.BulletEngine.Mover"/> class.
        /// </summary>
        /// <param name="gameRef">Game reference</param>
        /// <param name="myBulletManager">My bullet manager.</param>
        public Mover(DnK gameRef, IBulletManager myBulletManager)
            : base(gameRef, myBulletManager)
        {
            Position = Vector2.Zero;
            Rotation = 0f;

            IsAlive = true;
        }
Exemplo n.º 11
0
 public Boss(DnK game)
     : base(game)
 {
     MoverManager = new MoverManager(Game);
     GameManager.GameDifficulty = Config.GameDifficultyDelegate;
     DefeatNumber = 0;
     _speed       = 1f;
 }
Exemplo n.º 12
0
        protected Entity(DnK gameRef)
        {
            GameRef = gameRef;

            CollisionBoxes = new CollisionElements();
            _scale = new Vector2(1f, 1f);
            IsAlive = true;
        }
Exemplo n.º 13
0
 protected BaseBullet(DnK gameRef, Texture2D sprite, Vector2 position, Vector2 direction, Vector2 velocity)
     : base(gameRef)
 {
     Sprite = sprite;
     Position = position;
     Direction = direction;
     Velocity = velocity;
 }
Exemplo n.º 14
0
 public Boss(DnK game)
     : base(game)
 {
     MoverManager = new MoverManager(Game);
     GameManager.GameDifficulty = Config.GameDifficultyDelegate;
     DefeatNumber = 0;
     _speed = 1f;
 }
Exemplo n.º 15
0
 public Bullet(DnK gameRef, Texture2D sprite, Vector2 position, Vector2 direction, Vector2 velocity)
     : base(gameRef, sprite, position, direction, velocity)
 {
     Rotation  = (float)Math.Atan2(direction.Y, direction.X) - MathHelper.PiOver2;
     _distance = 0;
     WaveMode  = false;
     CollisionBoxes.Add(new CollisionCircle(this, Vector2.Zero, sprite.Width / 2f));
     Power = Improvements.ShootPowerData[PlayerData.ShootPowerIndex].Key;
 }
Exemplo n.º 16
0
 public Player(DnK game, Viewport viewport, int id, Config.Controller controller, Vector2 position)
     : base(game)
 {
     _viewport       = viewport;
     ID              = id;
     _controller     = controller;
     _originPosition = position;
     Position        = _originPosition;
     Center          = Vector2.Zero;
 }
Exemplo n.º 17
0
 public Player(DnK game, Viewport viewport, int id, Config.Controller controller, Vector2 position)
     : base(game)
 {
     _viewport = viewport;
     ID = id;
     _controller = controller;
     _originPosition = position;
     Position = _originPosition;
     Center = Vector2.Zero;
 }
Exemplo n.º 18
0
        public BaseGameState(Game game, GameStateManager manager)
            : base(game, manager)
        {
            GameRef = (DnK)game;

            playerIndexInControl = PlayerIndex.One;

            var controlFont = GameRef.Content.Load<SpriteFont>("Graphics/Fonts/ControlFont");
            ControlManager = new ControlManager(controlFont);
        }
Exemplo n.º 19
0
        public BaseGameState(Game game, GameStateManager manager)
            : base(game, manager)
        {
            GameRef = (DnK)game;

            playerIndexInControl = PlayerIndex.One;

            var controlFont = GameRef.Content.Load <SpriteFont>("Graphics/Fonts/ControlFont");

            ControlManager = new ControlManager(controlFont);
        }
Exemplo n.º 20
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BulletMLLib.Bullet"/> class.
        /// </summary>
        /// <param name="myBulletManager">My bullet manager.</param>
        public Bullet(DnK gameRef, IBulletManager myBulletManager)
            : base(gameRef)
        {
            //grba the bullet manager for this dude
            Debug.Assert(null != myBulletManager);
            _bulletManager = myBulletManager;

            Acceleration = Vector2.Zero;

            _tasks = new List<BulletMLTask>();
            _fireData = new List<FireData>();
        }
Exemplo n.º 21
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BulletMLLib.Bullet"/> class.
        /// </summary>
        /// <param name="myBulletManager">My bullet manager.</param>
        public Bullet(DnK gameRef, IBulletManager myBulletManager)
            : base(gameRef)
        {
            //grba the bullet manager for this dude
            Debug.Assert(null != myBulletManager);
            _bulletManager = myBulletManager;

            Acceleration = Vector2.Zero;

            _tasks    = new List <BulletMLTask>();
            _fireData = new List <FireData>();
        }
Exemplo n.º 22
0
 public Player(DnK gameRef, Viewport viewport, int id, Config.Controller controller, Vector2 position)
     : base(gameRef)
 {
     _viewport = viewport;
     ID = id;
     _controller = controller;
     _originPosition = position;
     Position = _originPosition;
     Origin = Vector2.Zero;
     _random = new Random();
     _cameraPosition = new Vector2(_viewport.Width / 2f, _viewport.Height / 2f);
     _focusMode = false;
     _timeBeforeRespawn = TimeSpan.Zero;
 }
Exemplo n.º 23
0
 public Player(DnK gameRef, Viewport viewport, int id, Config.Controller controller, Vector2 position)
     : base(gameRef)
 {
     _viewport          = viewport;
     ID                 = id;
     _controller        = controller;
     _originPosition    = position;
     Position           = _originPosition;
     Origin             = Vector2.Zero;
     _random            = new Random();
     _cameraPosition    = new Vector2(_viewport.Width / 2f, _viewport.Height / 2f);
     _focusMode         = false;
     _timeBeforeRespawn = TimeSpan.Zero;
 }
Exemplo n.º 24
0
 public BossCore(
     DnK gameRef,
     Entity parent,
     PositionDelegate playerPositionDelegate,
     MoverManager moverManager,
     List <BulletPattern> bulletPatterns,
     float initialHp = 100f)
     : base(gameRef)
 {
     _parent    = parent;
     _hp        = initialHp;
     _activated = false;
     _playerPositionDelegate = playerPositionDelegate;
     _moverManager           = moverManager;
     _bulletPatterns         = bulletPatterns;
 }
Exemplo n.º 25
0
 public BossCore(
     DnK gameRef, 
     Entity parent, 
     PositionDelegate playerPositionDelegate, 
     MoverManager moverManager,
     List<BulletPattern> bulletPatterns,
     float initialHp = 100f)
     : base(gameRef)
 {
     _parent = parent;
     _hp = initialHp;
     _activated = false;
     _playerPositionDelegate = playerPositionDelegate;
     _moverManager = moverManager;
     _bulletPatterns = bulletPatterns;
 }
Exemplo n.º 26
0
        public Boss(DnK gameRef, List<Player> players, int iteration = 50, float step = 25)
        {
            _gameRef = gameRef;
            _defeatCounter = 0;
            MoverManager = new MoverManager(gameRef);
            GameManager.GameDifficulty = Config.GameDifficultyDelegate;
            _players = players;
            _iteration = iteration;
            _step = step;
            _previousBossPart = null;

            _parts = new List<BossPart>();
            _currentPartIndex = 0;

            int targetPlayerId = _gameRef.Rand.Next(0, _players.Count);
            MoverManager.Initialize(_players[targetPlayerId].GetPosition);
        }
Exemplo n.º 27
0
        public Boss(DnK gameRef, List <Player> players, int iteration = 50, float step = 25)
        {
            _gameRef                   = gameRef;
            _defeatCounter             = 0;
            MoverManager               = new MoverManager(gameRef);
            GameManager.GameDifficulty = Config.GameDifficultyDelegate;
            _players                   = players;
            _iteration                 = iteration;
            _step             = step;
            _previousBossPart = null;

            _parts            = new List <BossPart>();
            _currentPartIndex = 0;

            int targetPlayerId = _gameRef.Rand.Next(0, _players.Count);

            MoverManager.Initialize(_players[targetPlayerId].GetPosition);
        }
Exemplo n.º 28
0
        public Bullet(DnK game, Texture2D sprite, Vector2 position, Vector2 direction, float velocity)
            : base(game, sprite, position, direction, velocity)
        {
            Rotation  = 0;
            Center    = new Vector2(Sprite.Width / 2f, Sprite.Height / 2f);
            _distance = 0;

            WaveMode = false;

            List <Point> vertices = new List <Point>()
            {
                new Point(0, 0),
                new Point(sprite.Width, 0),
                new Point(sprite.Width, sprite.Height),
                new Point(0, sprite.Height),
            };

            CollisionBox = new CollisionConvexPolygon(this, Vector2.Zero, vertices);

            Power = Improvements.ShootPowerData[PlayerData.ShootPowerIndex].Key;
        }
Exemplo n.º 29
0
        public Bullet(DnK game, Texture2D sprite, Vector2 position, Vector2 direction, float velocity)
            : base(game, sprite, position, direction, velocity)
        {
            Rotation = 0;
            Center = new Vector2(Sprite.Width / 2f, Sprite.Height / 2f);
            _distance = 0;

            WaveMode = false;

            List<Point> vertices = new List<Point>()
                {
                    new Point(0, 0),
                    new Point(sprite.Width, 0),
                    new Point(sprite.Width, sprite.Height),
                    new Point(0, sprite.Height),
                };

            CollisionBox = new CollisionConvexPolygon(this, Vector2.Zero, vertices);

            Power = Improvements.ShootPowerData[PlayerData.ShootPowerIndex].Key;
        }
Exemplo n.º 30
0
 public Turret(
     DnK gameRef,
     Entity parent,
     Entity target,
     MoverManager moverManager,
     Vector2 initialPosition,
     BulletPattern pattern,
     Color color)
     : base(gameRef)
 {
     _initialPosition = initialPosition;
     X             = InitialPosition.X;
     Y             = InitialPosition.Y;
     _parent       = parent;
     _target       = target;
     _moverManager = moverManager;
     _pattern      = pattern;
     _timer        = new TimeSpan(0, 0, (int)(GameRef.Rand.NextDouble() * 30));
     _color        = color;
     Scale         = new Vector2(0.5f, 0.5f);
 }
Exemplo n.º 31
0
 public Turret(
     DnK gameRef, 
     Entity parent, 
     Entity target,
     MoverManager moverManager,
     Vector2 initialPosition, 
     BulletPattern pattern, 
     Color color)
     : base(gameRef)
 {
     _initialPosition = initialPosition;
     X = InitialPosition.X;
     Y = InitialPosition.Y;
     _parent = parent;
     _target = target;
     _moverManager = moverManager;
     _pattern = pattern;
     _timer = new TimeSpan(0, 0, (int)(GameRef.Rand.NextDouble() * 30));
     _color = color;
     Scale = new Vector2(0.5f, 0.5f);
 }
Exemplo n.º 32
0
        /// <summary>
        /// A Polygon object that you will be able to draw.
        /// Animations are being implemented as we speak.
        /// </summary>
        /// <param name="graphicsDevice">The graphicsdevice from a GameRef object</param>
        /// <param name="vertices">The vertices in a clockwise order</param>
        public PolygonShape(DnK game, Vector2[] vertices)
        {
            _gameRef = game;
            _vertices = vertices;
            _triangulated = false;
            _size = Vector2.Zero;
            _area = 0f;
            _center = Vector2.Zero;

            _edgeEffect = _gameRef.Content.Load<Effect>("Graphics/Shaders/Edge");

            _effect = new BasicEffect(_gameRef.GraphicsDevice)
            {
                Projection = Matrix.CreateOrthographicOffCenter(
                0, _gameRef.GraphicsDevice.Viewport.Width, _gameRef.GraphicsDevice.Viewport.Height, 0, 0, 1),
                VertexColorEnabled = true,
                DiffuseColor = new Vector3(0, 1, 0),
                Alpha = 0.5f
            };

            if (_vertices != null)
                Triangulate();
        }
Exemplo n.º 33
0
        public BossPart(
            DnK gameRef,
            Boss bossRef,
            List<Player> playerList,
            MoverManager moverManager, 
            List<BulletPattern> bulletPatterns, 
            Color color, 
            float initialHealth,
            int iteration = 50, 
            float step = 25,
            List<Turret> turrets = null,
            PolygonShape polygonShape = null,
            bool mainPart = false)
            : base(gameRef)
        {
            _bossRef = bossRef;
            _mainPart = mainPart;
            _players = playerList;
            _moverManager = moverManager;
            _bulletPatterns = bulletPatterns ?? new List<BulletPattern>();

            _health = initialHealth;
            _displayHp = false;
            _color = color;

            _iteration = iteration;
            _step = step;

            _accelerationDecreaseFactor = 0.00075f;

            _turrets = turrets ?? new List<Turret>();
            _polygonShape = polygonShape;
            _collisionBoxesHp = new Dictionary<CollisionConvexPolygon, float>();
            _targetPosition = Vector2.Zero;
            _targetAngle = 0f;
        }
Exemplo n.º 34
0
        public BossPart(
            DnK gameRef,
            Boss bossRef,
            List <Player> playerList,
            MoverManager moverManager,
            List <BulletPattern> bulletPatterns,
            Color color,
            float initialHealth,
            int iteration             = 50,
            float step                = 25,
            List <Turret> turrets     = null,
            PolygonShape polygonShape = null,
            bool mainPart             = false)
            : base(gameRef)
        {
            _bossRef        = bossRef;
            _mainPart       = mainPart;
            _players        = playerList;
            _moverManager   = moverManager;
            _bulletPatterns = bulletPatterns ?? new List <BulletPattern>();

            _health    = initialHealth;
            _displayHp = false;
            _color     = color;

            _iteration = iteration;
            _step      = step;

            _accelerationDecreaseFactor = 0.00075f;

            _turrets          = turrets ?? new List <Turret>();
            _polygonShape     = polygonShape;
            _collisionBoxesHp = new Dictionary <CollisionConvexPolygon, float>();
            _targetPosition   = Vector2.Zero;
            _targetAngle      = 0f;
        }
Exemplo n.º 35
0
 public MoverManager(DnK game)
 {
     _gameRef = game;
 }
Exemplo n.º 36
0
 public MoverManager(DnK game)
 {
     _gameRef = game;
 }
Exemplo n.º 37
0
 protected Entity(DnK game)
 {
     Game = game;
 }
Exemplo n.º 38
0
 protected SpriteEntity(DnK gameRef) : base(gameRef)
 {
 }
Exemplo n.º 39
0
 protected BulletLauncherEntity(DnK gameRef)
     : base(gameRef)
 {
     Bullets = new List <BaseBullet>();
 }
Exemplo n.º 40
0
 public Laser(DnK game, Vector2 start, Vector2 end, float thickness = 1) : base(game)
 {
     _start     = start;
     _end       = end;
     _thickness = thickness;
 }
 protected BulletLauncherEntity(DnK game)
     : base(game)
 {
     Bullets = new List<BaseBullet>();
 }
Exemplo n.º 42
0
 protected SpriteEntity(DnK gameRef)
     : base(gameRef)
 {
 }
Exemplo n.º 43
0
 protected Entity(DnK game)
 {
     Game = game;
 }