public BackgroundSnowflake(XmasHell game) { _game = game; _position = new Vector2(GameConfig.VirtualResolution.X / 2f, 0f); _size = new Point(20, 20); _speed = 100f; }
public GameScreen(XmasHell game) : base(game) { ShouldBeStackInHistory = true; GameManager.GameDifficulty = GetRank; _player = new Player(game); }
public ScreenManager(XmasHell game) { _game = game; _screens = new List <Screen>(); _currentScreen = null; _screenHistory = new Stack <Screen>(); }
public Screen(XmasHell game) { Game = game; _neverShown = true; ShouldBeStackInHistory = true; Name = GetType().Name; }
public CustomSpriterAnimator( XmasHell game, SpriterEntity entity, IProviderFactory <ISprite, SoundEffect> providerFactory = null, Stack <SpriteDrawInfo> drawInfoPool = null ) : base(entity, providerFactory, drawInfoPool) { _game = game; _providerFactory = providerFactory; _drawInfoPool = drawInfoPool; _hiddenTextures = new List <string>(); _textureSwapMap = new Dictionary <string, Texture2D>(); _pointTexture = new TextureSprite(TextureUtil.CreateCircle(_game.GraphicsDevice, 1, Color.Cyan)); if (entity.ObjectInfos != null) { foreach (SpriterObjectInfo objInfo in entity.ObjectInfos) { if (objInfo.ObjectType != SpriterObjectType.Box) { continue; } _boxTextures[objInfo.Name] = new TextureSprite(TextureUtil.CreateRectangle(_game.GraphicsDevice, (int)objInfo.Width, (int)objInfo.Height, Color.Cyan)); } } }
public Player(XmasHell game) { _game = game; _currentDirection = Vector2.Zero; _idleAnimationTimer = new CountdownTimer(5); _idleAnimationTimer.Stop(); _idleAnimationTimer.Completed += (sender, args) => { Console.WriteLine("PLAY IDLE"); CurrentAnimator.Play("Idle"); }; var playerHitboxTexture = Assets.GetTexture2D("Graphics/Sprites/Player/hitbox"); var animatorConfig = new Config { MetadataEnabled = false, EventsEnabled = false, PoolingEnabled = true, TagsEnabled = false, VarsEnabled = false, SoundsEnabled = false }; var factory = new DefaultProviderFactory <ISprite, SoundEffect>(animatorConfig, true); var loader = new SpriterContentLoader(_game.Content, "Graphics/Sprites/Player/player"); loader.Fill(factory); Stack <SpriteDrawInfo> drawInfoPool = new Stack <SpriteDrawInfo>(); foreach (var entity in loader.Spriter.Entities) { var animator = new CustomSpriterAnimator(_game, entity, factory, drawInfoPool); _animators.Add(animator); } CurrentAnimator = _animators.First(); var spriteSize = new Vector2(60, 82); CurrentAnimator.Position = new Vector2(spriteSize.X / 2f, spriteSize.Y / 2f); CurrentAnimator.Play("Idle"); CurrentAnimator.AnimationFinished += AnimationFinished; _hitboxSprite = new Sprite(playerHitboxTexture) { //Scale = new Vector2( // (GameConfig.PlayerHitboxRadius * 2f) / playerHitboxTexture.Width, // (GameConfig.PlayerHitboxRadius * 2f) / playerHitboxTexture.Height //) }; _hitbox = new CollisionCircle(this, Vector2.Zero, GameConfig.PlayerHitboxRadius); // Don't forget to set the player position delegate to the MoverManager _game.GameManager.MoverManager.SetPlayerPositionDelegate(Position); }
public GameScreen(XmasHell game) : base(game) { ShouldBeStackInHistory = true; GameManager.GameDifficulty = GetRank; Type = ScreenType.Game; _skipButtonVisible = false; _skippedEndGameAnimations = false; }
protected Boss(XmasHell game, BossType type, PositionDelegate playerPositionDelegate) { Game = game; BossType = type; _playerPositionDelegate = playerPositionDelegate; InitialPosition = new Vector2( Game.ViewportAdapter.VirtualWidth / 2f, Game.ViewportAdapter.VirtualHeight * 0.15f ); InitialLife = GameConfig.BossDefaultLife; // Behaviours Behaviours = new List <AbstractBossBehaviour>(); // BulletML BulletPatternFiles = new List <string>(); HitColor = Color.White * 0.5f; _hpBar = new Sprite( new TextureRegion2D( Assets.GetTexture2D("pixel"), 0, 0, GameConfig.VirtualResolution.X, 50 ) ) { Origin = Vector2.Zero, Color = Color.Red }; Game.SpriteBatchManager.Boss = this; Game.SpriteBatchManager.UISprites.Add(_hpBar); _timerLabel = new AbstractGuiLabel("00:00", Assets.GetFont("Graphics/Fonts/ui-small"), new Vector2(Game.ViewportAdapter.VirtualWidth / 2f, 25), Color.White, true); Game.SpriteBatchManager.UILabels.Add(_timerLabel); // To compute line/wall intersection _bottomWallLine = new Line( new Vector2(0f, GameConfig.VirtualResolution.Y), new Vector2(GameConfig.VirtualResolution.X, GameConfig.VirtualResolution.Y) ); _leftWallLine = new Line( new Vector2(0f, 0f), new Vector2(0f, GameConfig.VirtualResolution.Y) ); _rightWallLine = new Line( new Vector2(GameConfig.VirtualResolution.X, 0f), new Vector2(GameConfig.VirtualResolution.X, GameConfig.VirtualResolution.Y) ); _upWallLine = new Line( new Vector2(0f, 0f), new Vector2(GameConfig.VirtualResolution.X, 0f) ); }
public SnowRainBackground(XmasHell game) : base(game) { BackgroundEffect = Assets.GetShader("Graphics/Shaders/SnowRainBackground"); _snowflakeEffect = Assets.GetShader("Graphics/Shaders/Snowflake"); _backgroundSnowflakes = new List <BackgroundSnowflake> { new BackgroundSnowflake(game) }; }
public PerformanceManager(Game game) { _game = (XmasHell)game; _performanceInfo = new List <PerformanceStringData>(); _stopWatches = new Dictionary <PerformanceStopwatchType, Stopwatch>(); _maxPerformanceSample = GameConfig.PerformanceGraphMaxSample; _performanceData = new Dictionary <PerformanceStopwatchType, Queue <float> >(); _fpsData = new Queue <float>(_maxPerformanceSample); _performanceInfoPosition = Vector2.Zero; }
public GradientBackground(XmasHell game) : base(game) { BackgroundEffect = Assets.GetShader("Graphics/Shaders/AnimatedGradient"); BackgroundEffect.Parameters["uGradientPoint0Color"].SetValue(_brightColor.ToVector4()); BackgroundEffect.Parameters["uGradientPoint1Color"].SetValue(_darkColor.ToVector4()); BackgroundEffect.Parameters["uSpeed"].SetValue(0.5f); BackgroundEffect.Parameters["uInnerAmplitude"].SetValue(2.5f); BackgroundEffect.Parameters["uOuterAmplitude"].SetValue(1.5f); BackgroundEffect.Parameters["uResolution"].SetValue(GameConfig.VirtualResolution.ToVector2()); }
public XmasReindeer(XmasHell game, PositionDelegate playerPositionDelegate) : base(game, BossType.XmasReindeer, playerPositionDelegate) { // BulletML BulletPatternFiles.Add("XmasReindeer/pattern1"); // Behaviours Behaviours.Add(new XmasReindeerBehaviour1(this)); SpriterFilename = "Graphics/Sprites/Bosses/XmasReindeer/xmas-reindeer"; }
public BossDebug(XmasHell game, PositionDelegate playerPositionDelegate) : base(game, BossType.Debug, playerPositionDelegate) { // BulletML BulletPatternFiles.Add("BossDebug/pattern1"); // Behaviours Behaviours.Add(new BossDebugBehaviour1(this)); SpriterFilename = "Graphics/Sprites/Bosses/BossDebug/boss-debug"; }
public XmasTree(XmasHell game, PositionDelegate playerPositionDelegate) : base(game, BossType.XmasTree, playerPositionDelegate) { // BulletML BulletPatternFiles.Add("XmasTree/pattern1.1"); BulletPatternFiles.Add("XmasTree/pattern1.2"); // Behaviours Behaviours.Add(new XmasTreeBehaviour1(this)); SpriterFilename = "Graphics/Sprites/Bosses/XmasTree/xmas-tree"; }
public XmasLog(XmasHell game, PositionDelegate playerPositionDelegate) : base(game, BossType.XmasLog, playerPositionDelegate) { // BulletML BulletPatternFiles.Add("sample"); // Spriter SpriterFilename = "Graphics/Sprites/Bosses/XmasLog/xmas-log"; // Behaviours Behaviours.Add(new XmasLogBehaviour1(this)); }
public XmasGift(XmasHell game, PositionDelegate playerPositionDelegate) : base(game, BossType.XmasGift, playerPositionDelegate) { // Spriter SpriterFilename = "Graphics/Sprites/Bosses/XmasGift/xmas-gift"; // BulletML BulletPatternFiles.Add("sample"); // Behaviours Behaviours.Add(new XmasGiftBehaviour1(this, World)); }
public XmasCandy(XmasHell game, PositionDelegate playerPositionDelegate) : base(game, BossType.XmasCandy, playerPositionDelegate) { InitialLife = 500f; // BulletML BulletPatternFiles.Add("XmasCandy/pattern1"); BulletPatternFiles.Add("XmasCandy/pattern2"); // Behaviours Behaviours.Add(new XmasCandyBehaviour1(this)); Behaviours.Add(new XmasCandyBehaviour2(this)); Behaviours.Add(new XmasCandyBehaviour3(this)); SpriterFilename = "Graphics/Sprites/Bosses/XmasCandy/xmas-candy"; }
public XmasLog(XmasHell game, PositionDelegate playerPositionDelegate) : base(game, BossType.XmasLog, playerPositionDelegate) { // BulletML BulletPatternFiles.Add("XmasLog/pattern1"); // Spriter SpriterFilename = "Graphics/Sprites/Bosses/XmasLog/xmas-log"; // Behaviours Behaviours.Add(new XmasLogBehaviour1(this)); Behaviours.Add(new XmasLogBehaviour2(this)); Behaviours.Add(new XmasLogBehaviour3(this)); Behaviours.Add(new XmasLogBehaviour4(this)); InitialPosition = new Vector2(GameConfig.VirtualResolution.X / 2f, GameConfig.VirtualResolution.Y * 0.15f); }
public XmasBall(XmasHell game, PositionDelegate playerPositionDelegate) : base(game, BossType.XmasBall, playerPositionDelegate) { // BulletML BulletPatternFiles.Add("XmasBall/pattern1"); BulletPatternFiles.Add("XmasBall/pattern2"); BulletPatternFiles.Add("XmasBall/pattern3"); BulletPatternFiles.Add("XmasBall/pattern4"); // Behaviours Behaviours.Add(new XmasBallBehaviour1(this)); Behaviours.Add(new XmasBallBehaviour2(this)); Behaviours.Add(new XmasBallBehaviour3(this)); Behaviours.Add(new XmasBallBehaviour4(this)); SpriterFilename = "Graphics/Sprites/Bosses/XmasBall/xmas-ball"; }
public XmasSnowman(XmasHell game, PositionDelegate playerPositionDelegate) : base(game, BossType.XmasSnowman, playerPositionDelegate) { // BulletML BulletPatternFiles.Add("XmasSnowman/pattern1"); BulletPatternFiles.Add("XmasSnowman/pattern3_1"); BulletPatternFiles.Add("XmasSnowman/pattern3_2"); // Behaviours Behaviours.Add(new XmasSnowmanBehaviour1(this)); Behaviours.Add(new XmasSnowmanBehaviour2(this)); Behaviours.Add(new XmasSnowmanBehaviour3(this)); Behaviours.Add(new XmasSnowmanBehaviour4(this)); SpriterFilename = "Graphics/Sprites/Bosses/XmasSnowman/xmas-snowman"; InitialPosition = new Vector2(GameConfig.VirtualResolution.X / 2f, GameConfig.VirtualResolution.Y * 0.25f); }
public Bullet(XmasHell game, Vector2 position, float rotation, float speed) { _game = game; var defaultBulletTexture = BulletTypeUtils.BulletTypeToTexture(BulletType.Type2); Sprite = new Sprite(defaultBulletTexture) { Position = position, Rotation = rotation }; Speed = speed; Used = true; Hitbox = new CollisionCircle(this, Vector2.Zero, defaultBulletTexture.Width / 2f); _game.GameManager.CollisionWorld.AddPlayerBulletHitbox(Hitbox); _game.SpriteBatchManager.GameSprites.Add(Sprite); }
public XmasSnowflake(XmasHell game, PositionDelegate playerPositionDelegate) : base(game, BossType.XmasSnowflake, playerPositionDelegate) { // BulletML BulletPatternFiles.Add("XmasSnowflake/pattern1"); BulletPatternFiles.Add("XmasSnowflake/pattern2"); BulletPatternFiles.Add("XmasSnowflake/pattern3"); BulletPatternFiles.Add("XmasSnowflake/pattern4"); // Behaviours Behaviours.Add(new XmasSnowflakeBehaviour1(this)); Behaviours.Add(new XmasSnowflakeBehaviour2(this)); Behaviours.Add(new XmasSnowflakeBehaviour3(this)); Behaviours.Add(new XmasSnowflakeBehaviour4(this)); SpriterFilename = "Graphics/Sprites/Bosses/XmasSnowflake/xmas-snowflake"; InitializeDestroyedParticleEffect(); }
public static Boss CreateBoss(BossType type, XmasHell game, PositionDelegate playerPositionDelegate) { switch (type) { case BossType.Debug: return(new DebugBoss.BossDebug(game, playerPositionDelegate)); case BossType.XmasBall: return(new XmasBall.XmasBall(game, playerPositionDelegate)); case BossType.XmasBell: return(new XmasBell.XmasBell(game, playerPositionDelegate)); case BossType.XmasCandy: return(new XmasCandy.XmasCandy(game, playerPositionDelegate)); case BossType.XmasSnowflake: return(new XmasSnowflake.XmasSnowflake(game, playerPositionDelegate)); case BossType.XmasLog: return(new XmasLog.XmasLog(game, playerPositionDelegate)); case BossType.XmasTree: break; case BossType.XmasGift: return(new XmasGift.XmasGift(game, playerPositionDelegate)); case BossType.XmasReinder: break; case BossType.XmasSnowman: break; case BossType.XmasSanta: break; default: throw new ArgumentOutOfRangeException(nameof(type), type, null); } return(new XmasBall.XmasBall(game, playerPositionDelegate)); }
public Laser(XmasHell game, Line line, float scale = 1f) { _game = game; _line = line; _used = true; LoadContent(); _scale = new Vector2(scale, line.Distance() / _laserTexture.Height); var vertices = new List <Vector2> { Vector2.Zero, new Vector2(_laserTexture.Width, 0), new Vector2(_laserTexture.Width, _laserTexture.Height), new Vector2(0, _laserTexture.Height) }; _hitbox = new CollisionConvexPolygon(this, -_origin, vertices); _game.GameManager.CollisionWorld.AddBossBulletHitbox(_hitbox); }
public XmasBell(XmasHell game, PositionDelegate playerPositionDelegate) : base(game, BossType.XmasBell, playerPositionDelegate) { // Spriter SpriterFilename = "Graphics/Sprites/Bosses/XmasBell/xmas-bell"; // BulletML BulletPatternFiles.Add("XmasBell/pattern1"); BulletPatternFiles.Add("XmasBell/pattern2"); BulletPatternFiles.Add("XmasBell/pattern4"); BulletPatternFiles.Add("XmasBell/pattern5"); // Behaviours Behaviours.Add(new XmasBellBehaviour1(this)); Behaviours.Add(new XmasBellBehaviour2(this)); //Behaviours.Add(new XmasBellBehaviour3(this)); Behaviours.Add(new XmasBellBehaviour4(this)); Behaviours.Add(new XmasBellBehaviour5(this)); InitializeDestroyedParticleEffect(); }
protected Boss(XmasHell game, BossType type, PositionDelegate playerPositionDelegate) { Game = game; BossType = type; _playerPositionDelegate = playerPositionDelegate; InitialPosition = GameConfig.BossDefaultPosition; // Behaviours Behaviours = new List <AbstractBossBehaviour>(); // BulletML BulletPatternFiles = new List <string>(); HitColor = Color.White * 0.5f; HitBoxes = new List <CollisionElement>(); // To compute line/wall intersection _bottomWallLine = new Line( new Vector2(0f, GameConfig.VirtualResolution.Y), new Vector2(GameConfig.VirtualResolution.X, GameConfig.VirtualResolution.Y) ); _leftWallLine = new Line( new Vector2(0f, 0f), new Vector2(0f, GameConfig.VirtualResolution.Y) ); _rightWallLine = new Line( new Vector2(GameConfig.VirtualResolution.X, 0f), new Vector2(GameConfig.VirtualResolution.X, GameConfig.VirtualResolution.Y) ); _upWallLine = new Line( new Vector2(0f, 0f), new Vector2(GameConfig.VirtualResolution.X, 0f) ); }
public DebugScreen(XmasHell game) : base(game) { Type = ScreenType.Game; var particleEffect = new ParticleEffect { Name = "StartLaser", Emitters = new[] { new ParticleEmitter( Game.GameManager.ParticleManager.Pixel(), 500, TimeSpan.FromSeconds(10.5), Profile.Point(), true) { Parameters = new ParticleReleaseParameters { Speed = new Range <float>(10f, 500f), Quantity = 500, Rotation = new Range <float>(-1f, 1f), Scale = new Range <float>(3.0f, 6.0f), Color = Color.DarkGoldenrod.ToHsl() }, Modifiers = new IModifier[] { new RotationModifier { RotationRate = -2.1f } } } } }; game.GameManager.ParticleManager.EmitParticles(particleEffect, new Vector2(GameConfig.VirtualResolution.X, GameConfig.VirtualResolution.Y)); }
public DebugView(World _world, XmasHell game, float _ratio) { _debugView = new DebugViewXna(_world); _debugView.AppendFlags(FarseerPhysics.DebugViewFlags.DebugPanel); _debugView.DefaultShapeColor = Color.Red; _debugView.SleepingShapeColor = Color.DarkRed; _debugView.LoadContent(game.GraphicsDevice, game.Content); _debugView.AppendFlags(FarseerPhysics.DebugViewFlags.Shape); //_debugView.AppendFlags(FarseerPhysics.DebugViewFlags.PerformanceGraph); //_debugView.AppendFlags(FarseerPhysics.DebugViewFlags.AABB); //_debugView.AppendFlags(FarseerPhysics.DebugViewFlags.CenterOfMass); //_debugView.AppendFlags(FarseerPhysics.DebugViewFlags.ContactNormals); //_debugView.AppendFlags(FarseerPhysics.DebugViewFlags.ContactPoints); //_debugView.AppendFlags(FarseerPhysics.DebugViewFlags.Controllers); //_debugView.AppendFlags(FarseerPhysics.DebugViewFlags.Joint); //_debugView.AppendFlags(FarseerPhysics.DebugViewFlags.PolygonPoints); // //_debugView.AppendFlags(FarseerPhysics.DebugViewFlags.PolygonPoints); this.game = game; this._ratio = _ratio; Enabled = true; }
public Mover(XmasHell game, IBulletManager bulletManager, bool topBullet = false) : base(bulletManager) { _currentSpriteIndex = SpriteIndex; _game = game; TopBullet = topBullet; }
public CollisionWorld(XmasHell game) { _game = game; }