public static ObjectAction SpawnBarrageEnemy( IMathExpression xMillis, Dictionary <string, DTDanmakuImage> spriteNameToImageDictionary, Dictionary <string, EnemyObjectTemplate> enemyObjectTemplates, Dictionary <string, DTDanmakuSound> soundNameToSoundDictionary, GuidGenerator guidGenerator) { // Should be called first so it sets the "can shoot" variable that the shootBullet action will need ObjectAction moveAction = GetMoveAndSetCanShootVariableAction( xMillis: xMillis, guidGenerator: guidGenerator); ObjectAction shootAction = GetShootBulletAction( spriteNameToImageDictionary: spriteNameToImageDictionary, enemyObjectTemplates: enemyObjectTemplates, guidGenerator: guidGenerator); ObjectAction destroyAction = ObjectActionGenerator.DestroyWhenHpIsZeroAndMaybeDropPowerUp( chanceToDropPowerUpInMilliPercent: 15 * 1000, spriteNameToImageDictionary: spriteNameToImageDictionary, enemyObjectTemplates: enemyObjectTemplates, soundNameToSoundDictionary: soundNameToSoundDictionary, guidGenerator: guidGenerator); string spriteName = guidGenerator.NextGuid(); spriteNameToImageDictionary.Add(spriteName, DTDanmakuImage.BarrageEnemyShip); List <ObjectBox> damageBoxes = new List <ObjectBox>(); damageBoxes.Add(new ObjectBox(lowerXMillis: -46500, upperXMillis: 46500, lowerYMillis: 0, upperYMillis: 40000)); damageBoxes.Add(new ObjectBox(lowerXMillis: -31500, upperXMillis: 31500, lowerYMillis: -35000, upperYMillis: 30000)); List <ObjectBox> collisionBoxes = new List <ObjectBox>(); collisionBoxes.Add(new ObjectBox(lowerXMillis: -10000, upperXMillis: 10000, lowerYMillis: -25000, upperYMillis: 25000)); collisionBoxes.Add(new ObjectBox(lowerXMillis: -25000, upperXMillis: 25000, lowerYMillis: -10000, upperYMillis: 10000)); EnemyObjectTemplate enemyObjectTemplate = EnemyObjectTemplate.Enemy( action: ObjectAction.Union(moveAction, shootAction, destroyAction), initialMilliHP: MathExpression.Add(MathExpression.Constant(38000), MathExpression.RandomInteger(MathExpression.Constant(10000))), damageBoxes: damageBoxes, collisionBoxes: collisionBoxes, spriteName: spriteName); string templateName = guidGenerator.NextGuid(); enemyObjectTemplates.Add(templateName, enemyObjectTemplate); return(ObjectAction.SpawnChild( childXMillis: MathExpression.Constant(-1000 * 1000), childYMillis: MathExpression.Constant(-1000 * 1000), childObjectTemplateName: templateName, childInitialNumericVariables: null, childInitialBooleanVariables: null)); }
public static ObjectAction SpawnEliteOrbiterEnemy( IMathExpression xMillis, Dictionary <string, DTDanmakuImage> spriteNameToImageDictionary, Dictionary <string, EnemyObjectTemplate> enemyObjectTemplates, Dictionary <string, DTDanmakuSound> soundNameToSoundDictionary, GuidGenerator guidGenerator) { ObjectAction moveAction = GetMoveAction( xMillis: xMillis); ObjectAction destroyAction = ObjectActionGenerator.DestroyWhenHpIsZeroAndMaybeDropPowerUp( chanceToDropPowerUpInMilliPercent: 15 * 1000, spriteNameToImageDictionary: spriteNameToImageDictionary, enemyObjectTemplates: enemyObjectTemplates, soundNameToSoundDictionary: soundNameToSoundDictionary, guidGenerator: guidGenerator); string spriteName = guidGenerator.NextGuid(); spriteNameToImageDictionary.Add(spriteName, DTDanmakuImage.EliteOrbiterEnemyShip); List <ObjectBox> damageBoxes = new List <ObjectBox>(); damageBoxes.Add(new ObjectBox(lowerXMillis: -68000, upperXMillis: 68000, lowerYMillis: -30000, upperYMillis: 50000)); damageBoxes.Add(new ObjectBox(lowerXMillis: -46000, upperXMillis: 46000, lowerYMillis: -48000, upperYMillis: 68000)); damageBoxes.Add(new ObjectBox(lowerXMillis: -26000, upperXMillis: 26000, lowerYMillis: -68000, upperYMillis: 74000)); List <ObjectBox> collisionBoxes = new List <ObjectBox>(); collisionBoxes.Add(new ObjectBox(lowerXMillis: -58000, upperXMillis: 58000, lowerYMillis: -35000, upperYMillis: 50000)); ObjectAction spawnOrbiterSatellitesAction = GetSpawnOrbiterSatellitesAction( spriteNameToImageDictionary: spriteNameToImageDictionary, enemyObjectTemplates: enemyObjectTemplates, guidGenerator: guidGenerator); EnemyObjectTemplate enemyObjectTemplate = EnemyObjectTemplate.Enemy( action: ObjectAction.Union(moveAction, spawnOrbiterSatellitesAction, destroyAction), initialMilliHP: MathExpression.Add(MathExpression.Constant(45000), MathExpression.RandomInteger(MathExpression.Constant(15000))), damageBoxes: damageBoxes, collisionBoxes: collisionBoxes, spriteName: spriteName); string templateName = guidGenerator.NextGuid(); enemyObjectTemplates.Add(templateName, enemyObjectTemplate); return(ObjectAction.SpawnChild( childXMillis: MathExpression.Constant(-1000 * 1000), childYMillis: MathExpression.Constant(-1000 * 1000), childObjectTemplateName: templateName, childInitialNumericVariables: null, childInitialBooleanVariables: null)); }