// Constructor public BatEnemy(World world, EnemyEvent enemyEvent) : base(world, enemyEvent) { // Load resources ConfigFile configFile = GetEnemyConfigFile(); screenWidth = configFile.SettingGroups[initSettings].Settings["screenWidth"].GetValueAsFloat(); screenHeight = configFile.SettingGroups[initSettings].Settings["screenHeight"].GetValueAsFloat(); flyPercent = configFile.SettingGroups[initSettings].Settings["flyPercent"].GetValueAsFloat(); sightForPlayerDistance = configFile.SettingGroups[initSettings].Settings["sightForPlayerDistance"].GetValueAsFloat(); sightForWallDistance = configFile.SettingGroups[initSettings].Settings["sightForWallDistance"].GetValueAsFloat(); sightForPlayerAngle = configFile.SettingGroups[initSettings].Settings["sightForPlayerAngle"].GetValueAsFloat(); sightForPlayerAngleOffset = configFile.SettingGroups[initSettings].Settings["sightForPlayerAngleOffset"].GetValueAsFloat(); enemySightDelay = configFile.SettingGroups[initSettings].Settings["enemySightDelay"].GetValueAsFloat(); turnAroundTimerDelay = configFile.SettingGroups[initSettings].Settings["turnAroundTimerDelay"].GetValueAsFloat(); divePixelOffset = configFile.SettingGroups[initSettings].Settings["divePixelOffset"].GetValueAsFloat(); this.FacingRight = false; this.Behavior = new EnemyBehavior <BatBehavior>(enemyEvent); Vision = new EnemyVision(sightForPlayerDistance, enemySightDelay); Movement = new EnemyMovement(turnAroundTimerDelay); flapTimer = new Timer(); flapTimerDelay = 0.25f; diveTimer = new Timer(); diveTimerDelay = 0.5f; }
public static BatEnemyRepresentation CreateBatRepresentation(BatEnemy enemy, EnemyEvent enemyEvent, ContentManager content) { BatEnemyRepresentation enemyRepresentation = new BatEnemyRepresentation(enemy, enemyEvent); enemyRepresentation.LoadContent(content); return enemyRepresentation; }
public static BatEnemyRepresentation CreateBatRepresentation(BatEnemy enemy, EnemyEvent enemyEvent, ContentManager content) { BatEnemyRepresentation enemyRepresentation = new BatEnemyRepresentation(enemy, enemyEvent); enemyRepresentation.LoadContent(content); return(enemyRepresentation); }
// constructor public EnemyBehavior(EnemyEvent enemyEvent) { if (!typeof(T).IsEnum) { throw new ArgumentException("T must be an enumerated type"); } this.enemyEvent = enemyEvent; }
private void spawnBatEnemyAt(int x, int y) { EnemyEvent enemyEvent = new EnemyEvent(); Vector2 tilePosition = calculateTilePosition(x, y); BatEnemy enemy = EnemyFactory.CreateBatEntity(world, enemyEvent, tilePosition); BatEnemyRepresentation enemyRepresentation = EnemyFactory.CreateBatRepresentation(enemy, enemyEvent, representationManager.Content); BatEnemyController enemyController = EnemyFactory.CreateBatController(enemy); spawnEnemy(enemy, enemyRepresentation, enemyController); }
public static WalkerEnemy CreateWalkerEntity(World world, EnemyEvent enemyEvent, Vector2 enemyPosition) { ConfigFile configFile = Enemy.GetEnemyConfigFile(); int health = configFile.SettingGroups[walkerGeneralSettings].Settings["health"].GetValueAsInt(); float hitDelay = configFile.SettingGroups[walkerGeneralSettings].Settings["hitDelay"].GetValueAsFloat(); float recoveryDelay = configFile.SettingGroups[walkerGeneralSettings].Settings["recoveryDelay"].GetValueAsFloat(); WalkerEnemy enemy = new WalkerEnemy(world, enemyEvent); enemy.SetUpEnemy(enemyPosition, health, hitDelay, recoveryDelay); return enemy; }
public static BatEnemy CreateBatEntity(World world, EnemyEvent enemyEvent, Vector2 enemyPosition) { ConfigFile configFile = Enemy.GetEnemyConfigFile(); int health = configFile.SettingGroups[batGeneralSettings].Settings["health"].GetValueAsInt(); float hitDelay = configFile.SettingGroups[batGeneralSettings].Settings["hitDelay"].GetValueAsFloat(); float recoveryDelay = configFile.SettingGroups[batGeneralSettings].Settings["recoveryDelay"].GetValueAsFloat(); BatEnemy enemy = new BatEnemy(world, enemyEvent); enemy.SetUpEnemy(enemyPosition, health, hitDelay, recoveryDelay); return(enemy); }
// Constructor public WalkerEnemy(World world, EnemyEvent enemyEvent) : base(world, enemyEvent) { // Load resources ConfigFile configFile = GetEnemyConfigFile(); screenWidth = configFile.SettingGroups[initSettings].Settings["screenWidth"].GetValueAsFloat(); screenHeight = configFile.SettingGroups[initSettings].Settings["screenHeight"].GetValueAsFloat(); walkPercent = configFile.SettingGroups[initSettings].Settings["walkPercent"].GetValueAsFloat(); sightForPlayerDistance = configFile.SettingGroups[initSettings].Settings["sightForPlayerDistance"].GetValueAsFloat(); sightForGroundDistance = configFile.SettingGroups[initSettings].Settings["sightForGroundDistance"].GetValueAsFloat(); enemySightDelay = configFile.SettingGroups[initSettings].Settings["enemySightDelay"].GetValueAsFloat(); turnAroundTimerDelay = configFile.SettingGroups[initSettings].Settings["turnAroundTimerDelay"].GetValueAsFloat(); this.FacingRight = false; this.Behavior = new EnemyBehavior<WalkerBehavior>(enemyEvent); Vision = new EnemyVision(sightForPlayerDistance, enemySightDelay); Movement = new EnemyMovement(turnAroundTimerDelay); }
// Constructor public BatEnemyRepresentation(BatEnemy enemy, EnemyEvent enemyEvent) : base(enemy, enemyEvent) { }
private void spawnWalkerEnemyAt(int x, int y) { EnemyEvent enemyEvent = new EnemyEvent(); Vector2 tilePosition = calculateTilePosition(x, y); WalkerEnemy enemy = EnemyFactory.CreateWalkerEntity(world, enemyEvent, tilePosition); WalkerEnemyRepresentation enemyRepresentation = EnemyFactory.CreateWalkerRepresentation(enemy, enemyEvent, representationManager.Content); WalkerEnemyController enemyController = EnemyFactory.CreateWalkerController(enemy); spawnEnemy(enemy, enemyRepresentation, enemyController); }
// Constructor public WalkerEnemyRepresentation(WalkerEnemy enemy, EnemyEvent enemyEvent) : base(enemy, enemyEvent) { }
public static WalkerEnemyRepresentation CreateWalkerRepresentation(WalkerEnemy enemy, EnemyEvent enemyEvent, ContentManager content) { WalkerEnemyRepresentation enemyRepresentation = new WalkerEnemyRepresentation(enemy, enemyEvent); enemyRepresentation.LoadContent(content); return enemyRepresentation; }
public static WalkerEnemyRepresentation CreateWalkerRepresentation(WalkerEnemy enemy, EnemyEvent enemyEvent, ContentManager content) { WalkerEnemyRepresentation enemyRepresentation = new WalkerEnemyRepresentation(enemy, enemyEvent); enemyRepresentation.LoadContent(content); return(enemyRepresentation); }