Esempio n. 1
0
        // 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);
        }