public TextSystem(DungeonCrawlerGame game) { _game = game; _actorTextComponent = _game.ActorTextComponent; _playerComponent = _game.PlayerComponent; _enemyComponent = _game.EnemyComponent; }
/// <summary> /// Creates a new NetworkSystem for a game /// </summary> /// <param name="game">The game this NetworkSystem belongs to</param> public NetworkSystem(DungeonCrawlerGame game) { this.game = game; menuSprite = game.Content.Load <Texture2D>("Spritesheets/menuSelect"); spriteFont = game.Content.Load <SpriteFont>("Spritefonts/Pescadero"); menuSelectSound = game.Content.Load <SoundEffect>("Sounds/MenuSelect"); this.spriteBatch = new SpriteBatch(game.GraphicsDevice); searchingForAvailableSessions = false; currentSessionName = "No Sessions Found"; TextLocations = new Vector2[] { new Vector2(550, 230), //Select Mode new Vector2(400, 330), //Create Session new Vector2(700, 330), //Join Session new Vector2(400, 530), //Create Go new Vector2(700, 430), //Join Session Name new Vector2(700, 530) //Join Go }; menuSpriteLocation = TextLocations[1] - new Vector2(10, 0); whiteRectangle = new Texture2D(game.GraphicsDevice, 1, 1); whiteRectangle.SetData(new[] { Color.White }); whiteRectLoc = new Rectangle(350, 200, 600, 400); greyRectLoc = new Rectangle(345, 195, 610, 410); }
new public void Add(uint entityID, AgroGain component) { base.Add(entityID, component); DungeonCrawlerGame game = DungeonCrawlerGame.game; game.EnemyAISystem.SetTarget(component.EnemyID, component.PlayerID); }
public Credits(DungeonCrawlerGame game) { _font = game.Content.Load<SpriteFont>("SpriteFonts/Pescadero");; _position = new Vector2(50); Done = false; _currentIndex = 0; _displayText = true; _timer = 0; }
public Credits(DungeonCrawlerGame game) { _font = game.Content.Load <SpriteFont>("SpriteFonts/Pescadero");; _position = new Vector2(50); Done = false; _currentIndex = 0; _displayText = true; _timer = 0; }
/// <summary> /// Creates a new HUDSystem. /// </summary> /// <param name="game">Parent game.</param> public HUDSystem(DungeonCrawlerGame game) { _game = game; _content = game.Content; _playerComponent = game.PlayerComponent; _p1 = new HUDSprite { Show = false }; _p2 = new HUDSprite { Show = false }; _p3 = new HUDSprite { Show = false }; _p4 = new HUDSprite { Show = false }; }
/// <summary> /// Creates a new quest log system /// </summary> /// <param name="Game">A reference to the dungeon crawler game</param> public QuestLogSystem(DungeonCrawlerGame Game) { game = Game; spriteBatch = new SpriteBatch(game.GraphicsDevice); spriteFont = game.Content.Load <SpriteFont>("Spritefonts/Pescadero"); questLog = game.Content.Load <Texture2D>("Spritesheets/QuestLog"); questLogLocation = new Rectangle(600, 65, 376, 593); questLogTextLocation = new Vector2(questLogLocation.X + 45, questLogLocation.Y + 90); displayLog = false; displayGoals = false; }
new public void Add(uint entityID, ChangeVisibility component) { base.Add(entityID, component); DungeonCrawlerGame game = DungeonCrawlerGame.game; Sprite playerSprite = game.SpriteComponent[component.TargetID]; playerSprite.SpriteColor = component.newColor; playerSprite.UseDifferentColor = true; game.SpriteComponent[component.TargetID] = playerSprite; }
public GameStart(DungeonCrawlerGame game) { _mainSpriteSheet = game.Content.Load<Texture2D>("Spritesheets/TitleScreen"); _font = game.Content.Load<SpriteFont>("SpriteFonts/BoldPescadero"); _mainPosition = new Vector2(0); _fontPosition = new Vector2(1000, 100); _drawFont = true; _timer = 0; }
new public void Add(uint entityID, Fear component) { DungeonCrawlerGame game = DungeonCrawlerGame.game; if (game.EnemyComponent.Contains(component.TargetID)) { Enemy enemy = game.EnemyComponent[component.TargetID]; enemy.State = enemy.State | EnemyState.Scared; } }
public GameStart(DungeonCrawlerGame game) { _mainSpriteSheet = game.Content.Load <Texture2D>("Spritesheets/TitleScreen"); _font = game.Content.Load <SpriteFont>("SpriteFonts/BoldPescadero"); _mainPosition = new Vector2(0); _fontPosition = new Vector2(1000, 100); _drawFont = true; _timer = 0; }
/// <summary> /// Creates this system. /// </summary> /// <param name="game"></param> public WeaponSystem(DungeonCrawlerGame game) { _game = game; //To simplfy some things, I'm keeping a reference to components I often use. _collisionComponent = _game.CollisionComponent; _equipmentComponent = _game.EquipmentComponent; _playerInfoComponent = _game.PlayerInfoComponent; _weaponComponent = _game.WeaponComponent; _weaponSpriteComponent = _game.WeaponSpriteComponent; _positionComponent = _game.PositionComponent; }
new public void Add(uint entityID, AgroDrop component) { base.Add(entityID, component); DungeonCrawlerGame game = DungeonCrawlerGame.game; EnemyAI enemyAI = game.EnemyAIComponent[component.EnemyID]; enemyAI.NoTargetList.Add(component.PlayerID); game.EnemyAIComponent[component.EnemyID] = enemyAI; game.EnemyAISystem.GetDifferentTarget(component.EnemyID); }
/// <summary> /// Creates a new HUDSystem. /// </summary> /// <param name="game">Parent game.</param> public HUDSystem(DungeonCrawlerGame game) { _game = game; _content = game.Content; _playerComponent = game.PlayerComponent; spriteBatch = new SpriteBatch(game.GraphicsDevice); _p1 = new HUDSprite { Show = false }; _p2 = new HUDSprite { Show = false }; _p3 = new HUDSprite { Show = false }; _p4 = new HUDSprite { Show = false }; }
new public void Remove(uint entityID) { DungeonCrawlerGame game = DungeonCrawlerGame.game; ChangeVisibility component = game.ChangeVisibilityComponent[entityID]; Sprite playerSprite = game.SpriteComponent[component.TargetID]; playerSprite.SpriteColor = Color.White; playerSprite.UseDifferentColor = false; game.SpriteComponent[component.TargetID] = playerSprite; base.Remove(entityID); }
new public void Remove(uint entityID) { DungeonCrawlerGame game = DungeonCrawlerGame.game; AgroDrop component = game.AgroDropComponent[entityID]; EnemyAI enemyAI = game.EnemyAIComponent[component.EnemyID]; enemyAI.NoTargetList.Remove(component.PlayerID); game.EnemyAIComponent[component.EnemyID] = enemyAI; game.EnemyAISystem.GetClosestTarget(component.EnemyID); base.Remove(entityID); }
/// <summary> /// Constructs a new RenderingSystem /// </summary> /// <param name="game">The game this system belongs to</param> public RenderingSystem(DungeonCrawlerGame game) { this.game = game; this.spriteBatch = new SpriteBatch(game.GraphicsDevice); this._actorTextFont = game.Content.Load <SpriteFont>("SpriteFonts/Pescadero"); #if DEBUG _debugTexture = new Texture2D(game.GraphicsDevice, 1, 1); Color[] data = new Color[1]; //for (int i = 0; i < data.Length; ++i) { data[i] = Color.Red; data[i].A /= 2; } //_debugTexture.SetData(data); #endif }
/// <summary> /// Constructs a new RenderingSystem /// </summary> /// <param name="game">The game this system belongs to</param> public RenderingSystem(DungeonCrawlerGame game) { this.game = game; this.spriteBatch = new SpriteBatch(game.GraphicsDevice); this._actorTextFont = game.Content.Load<SpriteFont>("SpriteFonts/Pescadero"); #if DEBUG _debugTexture = new Texture2D(game.GraphicsDevice, 1, 1); Color[] data = new Color[1]; //for (int i = 0; i < data.Length; ++i) { data[i] = Color.Red; data[i].A /= 2; } //_debugTexture.SetData(data); #endif }
/// <summary> /// Creates a new quest log system /// </summary> /// <param name="Game">A reference to the dungeon crawler game</param> public QuestLogSystem(DungeonCrawlerGame Game) { game = Game; spriteBatch = new SpriteBatch(game.GraphicsDevice); nameFont = game.Content.Load<SpriteFont>("Spritefonts/BoldPescadero"); descriptionFont = game.Content.Load<SpriteFont>("Spritefonts/Pescadero"); questLog = game.Content.Load<Texture2D>("Spritesheets/QuestLog"); questLogLocation = new Rectangle(600, 65, 376, 593); questLogTextLocation = new Vector2(questLogLocation.X + 45, questLogLocation.Y + 90); displayLog = false; displayGoals = false; }
/// <summary> /// Creates a new NetworkSystem for a game /// </summary> /// <param name="game">The game this NetworkSystem belongs to</param> public NetworkSystem(DungeonCrawlerGame game) { this.game = game; menuSprite = game.Content.Load<Texture2D>("Spritesheets/menuSelect"); spriteFont = game.Content.Load<SpriteFont>("Spritefonts/Pescadero"); menuSelectSound = game.Content.Load<SoundEffect>("Sounds/MenuSelect"); this.spriteBatch = new SpriteBatch(game.GraphicsDevice); searchingForAvailableSessions = false; currentSessionName = "No Sessions Found"; TextLocations = new Vector2[] { new Vector2(550, 230), //Select Mode new Vector2(400, 330), //Create Session new Vector2(700, 330), //Join Session new Vector2(400, 530), //Create Go new Vector2(700, 430), //Join Session Name new Vector2(700, 530) //Join Go }; menuSpriteLocation = TextLocations[1] - new Vector2(10, 0); whiteRectangle = new Texture2D(game.GraphicsDevice, 1, 1); whiteRectangle.SetData(new[] { Color.White }); whiteRectLoc = new Rectangle(350, 200, 600, 400); greyRectLoc = new Rectangle(345, 195, 610, 410); }
/// <summary> /// Creates a new MovementSystem /// </summary> /// <param name="game">The game this system belongs to</param> public InputSystem(DungeonCrawlerGame game) { this.game = game; oldGamePadState = new GamePadState[4]; }
/// <summary> /// Creates a new RoomFactory instance /// </summary> /// <param name="game"></param> public WallFactory(DungeonCrawlerGame game) { this.game = game; }
/// <summary> /// Creates a new Factory. /// </summary> /// <param name="game"></param> public WeaponFactory(DungeonCrawlerGame game) { _game = game; }
/// <summary> /// Creates a new RoomFactory instance /// </summary> /// <param name="game"></param> public DoorFactory(DungeonCrawlerGame game) { this.game = game; }
/// <summary> /// Constructors /// </summary> /// <param name="game"></param> public SkillProjectileFactory(DungeonCrawlerGame game) { this.game = game; }
/// <summary> /// Creates a new Room Changing System /// </summary> /// <param name="game">The Dungeon Crawler Game</param> public RoomChangingSystem(DungeonCrawlerGame game) { loadingTime = 0; this.game = game; }
/// <summary> /// Constructs a new RenderingSystem /// </summary> /// <param name="game">The game this system belongs to</param> public RenderingSystem(DungeonCrawlerGame game) { this.game = game; this.spriteBatch = new SpriteBatch(game.GraphicsDevice); }
/// <summary> /// Creates a new collision system. /// </summary> /// <param name="game">The game this systems belongs to.</param> public CollisionSystem(DungeonCrawlerGame game) { _game = game; }
/// <summary> /// Creates Entities from aggregates (collections of components) /// </summary> /// <param name="aggregate">The specific aggreage to create</param> /// <param name="playerIndex">The player index for this player</param> /// <param name="aggregate">The game save that we are creating</param> public uint CreateFromAggregate(Aggregate aggregate, PlayerIndex playerIndex, string fileName, out DungeonCrawlerGame.CharacterSaveFile gameSave) { gameSave = new DungeonCrawlerGame.CharacterSaveFile(); uint entityID = 0xFFFFFF; Texture2D spriteSheet; Position position; Movement movement; Sprite sprite; SpriteAnimation spriteAnimation; //MovementSprite movementSprite; Collideable collideable; Local local; Player player; PlayerInfo info; Stats stats = new Stats(); HUDAggregateFactory hudagg = new HUDAggregateFactory(game); InvAggregateFactory invagg = new InvAggregateFactory(game); //Miscelaneous modifyers for the potential ability modifiers //Placeholders for racial/class bonuses and item bonuses. int miscMeleeAttack = 0; int miscRangedAttack = 0; int miscMeleeSpeed = 0; int miscAccuracy = 0; int miscMeleeDef = 0; int miscRangedDef = 0; int miscSpell = 0; int miscHealth = 0; switch (aggregate) { /**************************************** * Fairy * *************************************/ case Aggregate.FairyPlayer: entityID = Entity.NextEntity(); spriteSheet = game.Content.Load<Texture2D>("Spritesheets/wind_fae"); spriteSheet.Name = "Spritesheets/wind_fae"; position = new Position() { EntityID = entityID, Center = new Vector2(400, 150), Radius = 32f, }; game.PositionComponent[entityID] = position; collideable = new Collideable() { EntityID = entityID, Bounds = new CircleBounds(position.Center, position.Radius) }; game.CollisionComponent[entityID] = collideable; movement = new Movement() { EntityID = entityID, Direction = new Vector2(0, 1), Speed = 200f, }; game.MovementComponent[entityID] = movement; /* movementSprite = new MovementSprite() { EntityID = entityID, Facing = Facing.South, SpriteSheet = spriteSheet, SpriteBounds = new Rectangle(0, 0, 64, 64), Timer = 0f, }; game.MovementSpriteComponent[entityID] = movementSprite; */ spriteAnimation = new SpriteAnimation() { EntityID = entityID, FramesPerSecond = 10, IsLooping = true, IsPlaying = true, TimePassed = 0f, CurrentFrame = 0, CurrentAnimationRow = 0 }; game.SpriteAnimationComponent[entityID] = spriteAnimation; sprite = new Sprite() { EntityID = entityID, SpriteBounds = new Rectangle(0, 0, 64, 64), SpriteSheet = spriteSheet }; game.SpriteComponent[entityID] = sprite; local = new Local() { EntityID = entityID, }; game.LocalComponent[entityID] = local; //This will add a stats section for the player in the stats component stats = new Stats() { EntityID = entityID, //So here we just define our base values. Total sum is 50 //The base stats are 10 across the board Strength = 4, Stamina = 10, Agility = 10, Intelligence = 16, Defense = 10 }; game.StatsComponent[entityID] = stats; player = new Player() { EntityID = entityID, PlayerIndex = playerIndex, PlayerRace = aggregate, abilityModifiers = new AbilityModifiers() { meleeDamageReduction = miscMeleeDef + (int)((stats.Defense - 10) / 2), rangedDamageReduction = miscRangedDef + (int)((stats.Defense - 10) / 2), meleeAttackBonus = miscMeleeAttack + (int)((stats.Strength - 10) / 2), RangedAttackBonus = miscRangedAttack + (int)((stats.Agility - 10) / 2), MeleeAttackSpeed = miscMeleeSpeed + (int)((stats.Strength - 10) / 2), Accuracy = miscAccuracy + (int)((stats.Agility - 10) / 2), SpellBonus = miscSpell + (int)((stats.Intelligence - 10) / 2), HealthBonus = miscHealth + (int)((stats.Stamina - 10) / 2), } }; game.PlayerComponent[entityID] = player; info = new PlayerInfo() { Health = 100, Psi = 100, State = PlayerState.Default, }; game.PlayerInfoComponent[entityID] = info; break; /**************************************** * Cultist * *************************************/ case Aggregate.CultistPlayer: entityID = Entity.NextEntity(); spriteSheet = game.Content.Load<Texture2D>("Spritesheets/Cultist"); spriteSheet.Name = "Spritesheets/Cultist"; position = new Position() { EntityID = entityID, Center = new Vector2(400, 150), Radius = 32f, }; game.PositionComponent[entityID] = position; collideable = new Collideable() { EntityID = entityID, Bounds = new CircleBounds(position.Center, position.Radius) }; game.CollisionComponent[entityID] = collideable; movement = new Movement() { EntityID = entityID, Direction = new Vector2(0, 1), Speed = 200f, }; game.MovementComponent[entityID] = movement; //movementSprite = new MovementSprite() { // EntityID = entityID, // Facing = Facing.South, // SpriteSheet = spriteSheet, // SpriteBounds = new Rectangle(0, 0, 64, 64), // Timer = 0f, //}; //game.MovementSpriteComponent[entityID] = movementSprite; spriteAnimation = new SpriteAnimation() { EntityID = entityID, FramesPerSecond = 10, IsLooping = true, IsPlaying = true, TimePassed = 0f, CurrentFrame = 0, CurrentAnimationRow = 0 }; game.SpriteAnimationComponent[entityID] = spriteAnimation; sprite = new Sprite() { EntityID = entityID, SpriteBounds = new Rectangle(0, 0, 64, 64), SpriteSheet = spriteSheet }; game.SpriteComponent[entityID] = sprite; local = new Local() { EntityID = entityID, }; game.LocalComponent[entityID] = local; //This will add a stats section for the player in the stats component stats = new Stats() { EntityID = entityID, //So here we just define our base values. Total sum is 50 //The base stats are 10 across the board Strength = 4, Stamina = 10, Agility = 10, Intelligence = 16, Defense = 10 }; player = new Player() { EntityID = entityID, PlayerIndex = playerIndex, PlayerRace = aggregate, abilityModifiers = new AbilityModifiers() { meleeDamageReduction = miscMeleeDef + (int)((stats.Defense - 10) / 2), rangedDamageReduction = miscRangedDef + (int)((stats.Defense - 10) / 2), meleeAttackBonus = miscMeleeAttack + (int)((stats.Strength - 10) / 2), RangedAttackBonus = miscRangedAttack + (int)((stats.Agility - 10) / 2), MeleeAttackSpeed = miscMeleeSpeed + (int)((stats.Strength - 10) / 2), Accuracy = miscAccuracy + (int)((stats.Agility - 10) / 2), SpellBonus = miscSpell + (int)((stats.Intelligence - 10) / 2), HealthBonus = miscHealth + (int)((stats.Stamina - 10) / 2), } }; info = new PlayerInfo() { Health = 100, Psi = 100, State = PlayerState.Default, }; game.PlayerInfoComponent[entityID] = info; game.PlayerComponent[entityID] = player; //Create HUD hudagg.CreateHUD(player); //create Inv invagg.CreateInv(player); break; /**************************************** * Cyborg - Added by adam Clark * *************************************/ case Aggregate.CyborgPlayer: entityID = Entity.NextEntity(); spriteSheet = game.Content.Load<Texture2D>("Spritesheets/cyborg"); spriteSheet.Name = "Spritesheets/cyborg"; position = new Position() { EntityID = entityID, Center = new Vector2(400, 150), Radius = 32f, }; game.PositionComponent[entityID] = position; collideable = new Collideable() { EntityID = entityID, Bounds = new CircleBounds(position.Center, position.Radius) }; game.CollisionComponent[entityID] = collideable; movement = new Movement() { EntityID = entityID, Direction = new Vector2(0, 1), Speed = 200f, }; game.MovementComponent[entityID] = movement; /*movementSprite = new MovementSprite() { EntityID = entityID, Facing = Facing.South, SpriteSheet = spriteSheet, SpriteBounds = new Rectangle(0, 0, 64, 64), Timer = 0f, }; game.MovementSpriteComponent[entityID] = movementSprite;*/ spriteAnimation = new SpriteAnimation() { EntityID = entityID, FramesPerSecond = 10, IsLooping = true, IsPlaying = true, TimePassed = 0f, CurrentFrame = 0, CurrentAnimationRow = 0 }; game.SpriteAnimationComponent[entityID] = spriteAnimation; sprite = new Sprite() { EntityID = entityID, SpriteBounds = new Rectangle(0, 0, 64, 64), SpriteSheet = spriteSheet }; game.SpriteComponent[entityID] = sprite; local = new Local() { EntityID = entityID, }; game.LocalComponent[entityID] = local; //This will add a stats section for the player in the stats component stats = new Stats() { EntityID = entityID, //So here we just define our base values. Total sum is 50 //The base stats are 10 across the board Strength = 13, Stamina = 12, Agility = 13, Intelligence = 0, Defense = 12 }; game.StatsComponent[entityID] = stats; player = new Player() { EntityID = entityID, PlayerIndex = playerIndex, PlayerRace = aggregate, }; info = new PlayerInfo() { Health = 100, Psi = 100, State = PlayerState.Default, }; game.PlayerInfoComponent[entityID] = info; game.PlayerComponent[entityID] = player; //create HUD hudagg.CreateHUD(player); //create Inv invagg.CreateInv(player); break; /******************************************************************************* * Earthian * Done by Andrew Bellinder. I added the character's sprite and his skill sprites * ******************************************************************************/ case Aggregate.EarthianPlayer: entityID = Entity.NextEntity(); spriteSheet = game.Content.Load<Texture2D>("Spritesheets/Earthian2x"); spriteSheet.Name = "Spritesheets/Earthian2x"; position = new Position() { EntityID = entityID, Center = new Vector2(400, 150), Radius = 32f, }; game.PositionComponent[entityID] = position; collideable = new Collideable() { EntityID = entityID, Bounds = new CircleBounds(position.Center, position.Radius) }; game.CollisionComponent[entityID] = collideable; movement = new Movement() { EntityID = entityID, Direction = new Vector2(0, 1), Speed = 200f, }; game.MovementComponent[entityID] = movement; /* movementSprite = new MovementSprite() { EntityID = entityID, Facing = Facing.South, SpriteSheet = spriteSheet, SpriteBounds = new Rectangle(0, 0, 64, 64), Timer = 0f, }; game.MovementSpriteComponent[entityID] = movementSprite; */ spriteAnimation = new SpriteAnimation() { EntityID = entityID, FramesPerSecond = 10, IsLooping = true, IsPlaying = true, TimePassed = 0f, CurrentFrame = 0, CurrentAnimationRow = 0 }; game.SpriteAnimationComponent[entityID] = spriteAnimation; sprite = new Sprite() { EntityID = entityID, SpriteBounds = new Rectangle(0, 0, 64, 64), SpriteSheet = spriteSheet }; game.SpriteComponent[entityID] = sprite; local = new Local() { EntityID = entityID, }; game.LocalComponent[entityID] = local; //This will add a stats section for the player in the stats component stats = new Stats() { EntityID = entityID, //So here we just define our base values. Total sum is 50 //The base stats are 10 across the board Strength = 10, Stamina = 10, Agility = 10, Intelligence = 10, Defense = 10 }; game.StatsComponent[entityID] = stats; player = new Player() { EntityID = entityID, PlayerIndex = playerIndex, PlayerRace = aggregate, abilityModifiers = new AbilityModifiers() { meleeDamageReduction = miscMeleeDef + (int)((stats.Defense - 10) / 2), rangedDamageReduction = miscRangedDef + (int)((stats.Defense - 10) / 2), meleeAttackBonus = miscMeleeAttack + (int)((stats.Strength - 10) / 2), RangedAttackBonus = miscRangedAttack + (int)((stats.Agility - 10) / 2), MeleeAttackSpeed = miscMeleeSpeed + (int)((stats.Strength - 10) / 2), Accuracy = miscAccuracy + (int)((stats.Agility - 10) / 2), SpellBonus = miscSpell + (int)((stats.Intelligence - 10) / 2), HealthBonus = miscHealth + (int)((stats.Stamina - 10) / 2), } }; game.PlayerComponent[entityID] = player; info = new PlayerInfo() { Health = 100, Psi = 100, State = PlayerState.Default, }; game.PlayerInfoComponent[entityID] = info; //Create HUD hudagg.CreateHUD(player); //create Inv invagg.CreateInv(player); break; /**************************************** * Gargranian by Michael Fountain * *************************************/ case Aggregate.GargranianPlayer: entityID = Entity.NextEntity(); spriteSheet = game.Content.Load<Texture2D>("Spritesheets/gargranian"); spriteSheet.Name = "Spritesheets/gargranian"; position = new Position() { EntityID = entityID, Center = new Vector2(400, 150), Radius = 32f, }; game.PositionComponent[entityID] = position; collideable = new Collideable() { EntityID = entityID, Bounds = new CircleBounds(position.Center, position.Radius) }; game.CollisionComponent[entityID] = collideable; movement = new Movement() { EntityID = entityID, Direction = new Vector2(0, 1), Speed = 200f, }; game.MovementComponent[entityID] = movement; /* movementSprite = new MovementSprite() { EntityID = entityID, Facing = Facing.South, SpriteSheet = spriteSheet, SpriteBounds = new Rectangle(0, 0, 64, 64), Timer = 0f, }; game.MovementSpriteComponent[entityID] = movementSprite; */ spriteAnimation = new SpriteAnimation() { EntityID = entityID, FramesPerSecond = 10, IsLooping = true, IsPlaying = true, TimePassed = 0f, CurrentFrame = 0, CurrentAnimationRow = 0 }; game.SpriteAnimationComponent[entityID] = spriteAnimation; sprite = new Sprite() { EntityID = entityID, SpriteBounds = new Rectangle(0, 0, 64, 64), SpriteSheet = spriteSheet }; game.SpriteComponent[entityID] = sprite; local = new Local() { EntityID = entityID, }; game.LocalComponent[entityID] = local; //This will add a stats section for the player in the stats component stats = new Stats() { EntityID = entityID, //So here we just define our base values. Total sum is 50 //The base stats are 10 across the board Strength = 4, Stamina = 10, Agility = 10, Intelligence = 14, Defense = 12 }; game.StatsComponent[entityID] = stats; player = new Player() { EntityID = entityID, PlayerIndex = playerIndex, PlayerRace = aggregate, }; game.PlayerComponent[entityID] = player; info = new PlayerInfo() { Health = 100, Psi = 100, State = PlayerState.Default, }; game.PlayerInfoComponent[entityID] = info; //Create HUD hudagg.CreateHUD(player); //create Inv invagg.CreateInv(player); break; /**************************************** * Space Pirate * Done by Austin Murphy and I also have posted the 9 sprites for my skills that are listed in the design document. * *************************************/ case Aggregate.SpacePiratePlayer: entityID = Entity.NextEntity(); spriteSheet = game.Content.Load<Texture2D>("Spritesheets/SpacePBig"); spriteSheet.Name = "Spritesheets/SpacePBig"; position = new Position() { EntityID = entityID, Center = new Vector2(400, 150), Radius = 32f, }; game.PositionComponent[entityID] = position; collideable = new Collideable() { EntityID = entityID, Bounds = new CircleBounds(position.Center, position.Radius) }; game.CollisionComponent[entityID] = collideable; movement = new Movement() { EntityID = entityID, Direction = new Vector2(0, 1), Speed = 200f, }; game.MovementComponent[entityID] = movement; /* movementSprite = new MovementSprite() { EntityID = entityID, Facing = Facing.South, SpriteSheet = spriteSheet, SpriteBounds = new Rectangle(0, 0, 64, 64), Timer = 0f, }; game.MovementSpriteComponent[entityID] = movementSprite; */ spriteAnimation = new SpriteAnimation() { EntityID = entityID, FramesPerSecond = 10, IsLooping = true, IsPlaying = true, TimePassed = 0f, CurrentFrame = 0, CurrentAnimationRow = 0 }; game.SpriteAnimationComponent[entityID] = spriteAnimation; sprite = new Sprite() { EntityID = entityID, SpriteBounds = new Rectangle(0, 0, 64, 64), SpriteSheet = spriteSheet }; game.SpriteComponent[entityID] = sprite; local = new Local() { EntityID = entityID, }; game.LocalComponent[entityID] = local; //This will add a stats section for the player in the stats component stats = new Stats() { EntityID = entityID, //So here we just define our base values. Total sum is 50 //The base stats are 10 across the board Strength = 5, Stamina = 5, Agility = 25, Intelligence = 5, Defense = 5 }; game.StatsComponent[entityID] = stats; player = new Player() { EntityID = entityID, PlayerIndex = playerIndex, PlayerRace = aggregate, }; game.PlayerComponent[entityID] = player; info = new PlayerInfo() { Health = 100, Psi = 100, State = PlayerState.Default, }; game.PlayerInfoComponent[entityID] = info; //Create HUD hudagg.CreateHUD(player); //create Inv invagg.CreateInv(player); break; /**************************************** * Zombie * written by Matthew Hart * *************************************/ case Aggregate.ZombiePlayer: entityID = Entity.NextEntity(); spriteSheet = game.Content.Load<Texture2D>("Spritesheets/MzombieBx2"); spriteSheet.Name = "Spritesheets/MzombieBx2"; //Placeholder values miscMeleeAttack = 5; miscMeleeDef = 5; miscRangedDef = -5; position = new Position() { EntityID = entityID, Center = new Vector2(400, 150), Radius = 32f, }; game.PositionComponent[entityID] = position; collideable = new Collideable() { EntityID = entityID, Bounds = new CircleBounds(position.Center, position.Radius) }; game.CollisionComponent[entityID] = collideable; movement = new Movement() { EntityID = entityID, Direction = new Vector2(0, 1), Speed = 200f, }; game.MovementComponent[entityID] = movement; /* movementSprite = new MovementSprite() { EntityID = entityID, Facing = Facing.South, SpriteSheet = spriteSheet, SpriteBounds = new Rectangle(0, 0, 64, 64), Timer = 0f, }; game.MovementSpriteComponent[entityID] = movementSprite; */ spriteAnimation = new SpriteAnimation() { EntityID = entityID, FramesPerSecond = 10, IsLooping = true, IsPlaying = true, TimePassed = 0f, CurrentFrame = 0, CurrentAnimationRow = 0 }; game.SpriteAnimationComponent[entityID] = spriteAnimation; sprite = new Sprite() { EntityID = entityID, SpriteBounds = new Rectangle(0, 0, 64, 64), SpriteSheet = spriteSheet }; game.SpriteComponent[entityID] = sprite; local = new Local() { EntityID = entityID, }; game.LocalComponent[entityID] = local; //This will add a stats section for the player in the stats component stats = new Stats() { EntityID = entityID, //So here we just define our base values. Total sum is 50 //The base stats are 10 across the board Strength = 16, Stamina = 5, Agility = 5, Intelligence = 10, Defense = 14 }; game.StatsComponent[entityID] = stats; player = new Player() { EntityID = entityID, PlayerIndex = playerIndex, PlayerRace = aggregate, abilityModifiers = new AbilityModifiers() { meleeDamageReduction = miscMeleeDef + (int)((stats.Defense - 10) / 2), rangedDamageReduction = miscRangedDef + (int)((stats.Defense - 10) / 2), meleeAttackBonus = miscMeleeAttack + (int)((stats.Strength - 10) / 2), RangedAttackBonus = miscRangedAttack + (int)((stats.Agility - 10) / 2), MeleeAttackSpeed = miscMeleeSpeed + (int)((stats.Strength - 10) / 2), Accuracy = miscAccuracy + (int)((stats.Agility - 10) / 2), SpellBonus = miscSpell + (int)((stats.Intelligence - 10) / 2), HealthBonus = miscHealth + (int)((stats.Stamina - 10) / 2), } }; game.PlayerComponent[entityID] = player; info = new PlayerInfo() { Health = 100, Psi = 100, State = PlayerState.Default, }; game.PlayerInfoComponent[entityID] = info; //Create HUD hudagg.CreateHUD(player); //create Inv invagg.CreateInv(player); break; default: throw new Exception("Unknown type."); } // Store all of the data into the game save gameSave.aggregate = (int)aggregate; gameSave.health = 100; gameSave.psi = 100; gameSave.stats = stats; gameSave.Level = 1; gameSave.charAnimation = spriteSheet.Name; gameSave.fileName = fileName; info.FileName = fileName; string questString = "Proceed to the next room. This can be accomplished by walking through the doorway to your left."; Quest newQuest = new Quest() { EntityID = entityID, questName = QuestName.ReachNextRoom, questStatus = QuestStatus.InProgress, questGoals = new String[(int)Math.Ceiling(questString.Length / 33.0)], }; string[] strings = questString.Split(' '); string newstring = ""; int i = 0; int j = 0; while (j < newQuest.questGoals.Length) { if (i < strings.Length) { newstring += strings[i] + " "; i++; } if (i >= strings.Length) { newQuest.questGoals[j] = newstring; break; } if (newstring.Length + strings[i].Length >= 33 ) { newQuest.questGoals[j] = newstring; newstring = ""; j++; } } game.QuestComponent[entityID] = newQuest; return entityID; }
/// <summary> /// Creates a new AggregateFactory instance /// </summary> /// <param name="game"></param> public AggregateFactory(DungeonCrawlerGame game) { this.game = game; }
public EngineeringOffenseSystem(DungeonCrawlerGame game) { _game = game; turretTimer = 0; trapTimer = 0; }
/// <summary> /// Creates a new Factory. /// </summary> /// <param name="game"></param> public EnemyFactory(DungeonCrawlerGame game) { _game = game; }
/// <summary> /// Creates a new Factory. /// </summary> /// <param name="game"></param> public NPCFactory(DungeonCrawlerGame game) { _game = game; }
/// <summary> /// Creates a new MovementSystem /// </summary> /// <param name="game">The game this system belongs to</param> public EnemyAISystem(DungeonCrawlerGame game) { this.game = game; }
new public void Add(uint entityID, Buff component) { base.Add(entityID, component); DungeonCrawlerGame game = DungeonCrawlerGame.game; if (game.StatsComponent.Contains(component.TargetID)) { Stats stats = game.StatsComponent[component.TargetID]; if (component.Stamina != 0) { stats.Stamina += component.Stamina; } if (game.PlayerInfoComponent.Contains(component.TargetID)) { PlayerInfo playerInfo = game.PlayerInfoComponent[component.TargetID]; if (component.ResistPoison != 0) { int amount = component.ResistPoison; if (component.isPercentResistPoison) { amount = (amount * stats.PoisonResistanceBase) / 100; } playerInfo.PoisonResistance += amount; } if (component.AttackMelee != 0) { int amount = component.AttackMelee; if (component.isPercentResistPoison) { amount = (amount * stats.AttackMeleeBase) / 100; } playerInfo.AttackMelee += amount; } if (component.AttackRanged != 0) { int amount = component.AttackRanged; if (component.isPercentResistPoison) { amount = (amount * stats.AttackRangedBase) / 100; } playerInfo.AttackRanged += amount; } if (component.DefenseMelee != 0) { int amount = component.DefenseMelee; if (component.isPercentResistPoison) { amount = (amount * stats.DefenseMeleeBase) / 100; } playerInfo.DefenseMelee += amount; } if (component.DefenseRanged != 0) { int amount = component.DefenseRanged; if (component.isPercentResistPoison) { amount = (amount * stats.DefenseRangedBase) / 100; } playerInfo.DefenseRanged += amount; } if (component.WeaponStrength != 0) { int amount = component.WeaponStrength; if (component.isPercentResistPoison) { amount = (amount * stats.WeaponStrengthBase) / 100; } playerInfo.WeaponStrength += amount; } if (component.WeaponAccuracy != 0) { int amount = component.WeaponAccuracy; if (component.isPercentResistPoison) { amount = (amount * stats.WeaponAccuracyBase) / 100; } playerInfo.WeaponAccuracy += amount; } if (component.WeaponSpeed != 0) { int amount = component.WeaponSpeed; if (component.isPercentResistPoison) { amount = (amount * stats.WeaponSpeedBase) / 100; } playerInfo.WeaponSpeed += amount; } if (component.AttackSpeed != 0) { int amount = component.AttackSpeed; if (component.isPercentResistPoison) { amount = (amount * stats.AttackSpeedBase) / 100; } playerInfo.AttackSpeed += amount; } if (component.Health != 0) { int amount = component.Health; if (component.isPercentHealth) { amount = (amount * stats.HealthBase) / 100; } playerInfo.Health += amount; } if (component.Psi != 0) { int amount = component.Psi; if (component.isPercentHealth) { amount = (amount * stats.PsiBase) / 100; } playerInfo.PsiOrFatigue += amount; } if (component.Fatigue != 0) { int amount = component.Fatigue; if (component.isPercentHealth) { amount = (amount * stats.FatigueBase) / 100; } playerInfo.PsiOrFatigue += amount; } } game.StatsComponent[component.TargetID] = stats; } if (game.MovementComponent.Contains(component.TargetID)) { if (component.MovementSpeed != 0) { Movement movementInstance = game.MovementComponent[component.TargetID]; movementInstance.Speed += component.MovementSpeed; game.MovementComponent[component.TargetID] = movementInstance; } } }
/// <summary> /// Constructors /// </summary> /// <param name="game"></param> public SkillEntityFactory(DungeonCrawlerGame game) { this.game = game; }
public SkillSystem(DungeonCrawlerGame game) { this._game = game; }
/// <summary> /// Creates a new MovementSystem /// </summary> /// <param name="game">The game this system belongs to</param> public InputSystem(DungeonCrawlerGame game) { this._game = game; }
/// <summary> /// Creates a new Factory. /// </summary> /// <param name="game"></param> public CollectibleFactory(DungeonCrawlerGame game) { _game = game; }
public SkillSystem(DungeonCrawlerGame game) { this._game = game; rand = new Random(); }
/// <summary> /// Creates a new MovementSystem /// </summary> /// <param name="game">The game this system belongs to</param> public GarbagemanSystem(DungeonCrawlerGame game) { this.game = game; garbageSchedule = new Stack <KeyValuePair <uint, ComponentType> >(); }
/// <summary> /// Creates Entities from aggregates (collections of components) /// </summary> /// <param name="aggregate">The specific aggreage to create</param> public uint CreateFromGameSave(DungeonCrawlerGame.CharacterSaveFile gameSave, PlayerIndex playerIndex) { uint entityID = 0xFFFFFF; Texture2D spriteSheet; Position position; Movement movement; Sprite sprite; SpriteAnimation spriteAnimation; //MovementSprite movementSprite; Collideable collideable; Local local; Player player; PlayerInfo info; Stats stats = new Stats(); HUDAggregateFactory hudagg = new HUDAggregateFactory(game); InvAggregateFactory invagg = new InvAggregateFactory(game); //Miscelaneous modifyers for the potential ability modifiers //Placeholders for racial/class bonuses and item bonuses. int miscMeleeAttack = 0; int miscRangedAttack = 0; int miscMeleeSpeed = 0; int miscAccuracy = 0; int miscMeleeDef = 0; int miscRangedDef = 0; int miscSpell = 0; int miscHealth = 0; // Create the player { entityID = Entity.NextEntity(); spriteSheet = game.Content.Load<Texture2D>(gameSave.charAnimation); spriteSheet.Name = gameSave.charAnimation; position = new Position() { EntityID = entityID, Center = new Vector2(400, 150), Radius = 32f, }; game.PositionComponent[entityID] = position; collideable = new Collideable() { EntityID = entityID, Bounds = new CircleBounds(position.Center, position.Radius) }; game.CollisionComponent[entityID] = collideable; movement = new Movement() { EntityID = entityID, Direction = new Vector2(0, 1), Speed = 200f, }; game.MovementComponent[entityID] = movement; spriteAnimation = new SpriteAnimation() { EntityID = entityID, FramesPerSecond = 10, IsLooping = true, IsPlaying = true, TimePassed = 0f, CurrentFrame = 0, CurrentAnimationRow = 0 }; game.SpriteAnimationComponent[entityID] = spriteAnimation; sprite = new Sprite() { EntityID = entityID, SpriteBounds = new Rectangle(0, 0, 64, 64), SpriteSheet = spriteSheet }; game.SpriteComponent[entityID] = sprite; local = new Local() { EntityID = entityID, }; game.LocalComponent[entityID] = local; //This will add a stats section for the player in the stats component stats = new Stats() { EntityID = entityID, // Load from game save Strength = gameSave.stats.Strength, Stamina = gameSave.stats.Stamina, Agility = gameSave.stats.Agility, Intelligence = gameSave.stats.Intelligence, Defense = gameSave.stats.Defense }; game.StatsComponent[entityID] = stats; player = new Player() { EntityID = entityID, PlayerIndex = playerIndex, PlayerRace = (Aggregate)gameSave.aggregate, abilityModifiers = new AbilityModifiers() { meleeDamageReduction = miscMeleeDef + (int)((stats.Defense - 10) / 2), rangedDamageReduction = miscRangedDef + (int)((stats.Defense - 10) / 2), meleeAttackBonus = miscMeleeAttack + (int)((stats.Strength - 10) / 2), RangedAttackBonus = miscRangedAttack + (int)((stats.Agility - 10) / 2), MeleeAttackSpeed = miscMeleeSpeed + (int)((stats.Strength - 10) / 2), Accuracy = miscAccuracy + (int)((stats.Agility - 10) / 2), SpellBonus = miscSpell + (int)((stats.Intelligence - 10) / 2), HealthBonus = miscHealth + (int)((stats.Stamina - 10) / 2), } }; game.PlayerComponent[entityID] = player; info = new PlayerInfo() { Health = 100, Psi = 100, State = PlayerState.Default, }; game.PlayerInfoComponent[entityID] = info; game.PlayerComponent[entityID] = player; //Create HUD hudagg.CreateHUD(player); //create Inv invagg.CreateInv(player); } string questString = "Proceed to the next room. This can be accomplished by walking through the doorway to your left."; Quest newQuest = new Quest() { EntityID = entityID, questName = QuestName.ReachNextRoom, questStatus = QuestStatus.InProgress, questGoals = new String[(int)Math.Ceiling(questString.Length / 33.0)], }; string[] strings = questString.Split(' '); string newstring = ""; int i = 0; int j = 0; while (j < newQuest.questGoals.Length) { if (i < strings.Length) { newstring += strings[i] + " "; i++; } if (i >= strings.Length) { newQuest.questGoals[j] = newstring; break; } if (newstring.Length + strings[i].Length >= 33) { newQuest.questGoals[j] = newstring; newstring = ""; j++; } } game.QuestComponent[entityID] = newQuest; return entityID; }
/// <summary> /// Creates a new MovementSystem /// </summary> /// <param name="game">The game this system belongs to</param> public MovementSystem(DungeonCrawlerGame game) { this.game = game; }
/// <summary> /// Constructors /// </summary> /// <param name="game"></param> public SkillDeployableFactory(DungeonCrawlerGame game) { this.game = game; }
/// <summary> /// Constructors /// </summary> /// <param name="game"></param> public SkillAoEFactory(DungeonCrawlerGame game) { this.game = game; }
/// <summary> /// Creates a new MovementSystem /// </summary> /// <param name="game">The game this system belongs to</param> public EnemyAISystem(DungeonCrawlerGame game) { this.game = game; this.rand = new Random(); }