public static void FillWithMetadata(RangeEnemy enemy, RangeEnemyMetadata metadata, ContentManager contentManager) { ObstacleGameObject.FillWithMetadata(enemy, metadata, contentManager); enemy.AttackDamage = metadata.AttackDamage; enemy.AttackInterval = metadata.AttackInterval; enemy.AttackRange = metadata.AttackRange; enemy.BulletSpeed = metadata.BulletSpeed; enemy.BulletAssetName = metadata.BulletAssetName; if(!String.IsNullOrEmpty(metadata.CircleScriptAssetName)) { CircleMovementScript circleScript = CircleMovementScript.FromMetadata(contentManager.Load<CircleScriptMetadata>(metadata.CircleScriptAssetName)); circleScript.Target = enemy; enemy.AddScript(circleScript); } enemy.AddScript(new RangeEnemyAttackScript(300) { Combatant = enemy }); }
public static RangeEnemy FromMetadata(RangeEnemyMetadata metadata, ContentManager contentManager) { var enemy = new RangeEnemy(); FillWithMetadata(enemy, metadata, contentManager); return enemy; }