예제 #1
0
        // 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;
        }
예제 #2
0
        public static BatEnemyRepresentation CreateBatRepresentation(BatEnemy enemy, EnemyEvent enemyEvent, ContentManager content)
        {
            BatEnemyRepresentation enemyRepresentation = new BatEnemyRepresentation(enemy, enemyEvent);
            enemyRepresentation.LoadContent(content);

            return enemyRepresentation;
        }
예제 #3
0
        public static BatEnemyRepresentation CreateBatRepresentation(BatEnemy enemy, EnemyEvent enemyEvent, ContentManager content)
        {
            BatEnemyRepresentation enemyRepresentation = new BatEnemyRepresentation(enemy, enemyEvent);

            enemyRepresentation.LoadContent(content);

            return(enemyRepresentation);
        }
예제 #4
0
        // constructor
        public EnemyBehavior(EnemyEvent enemyEvent)
        {
            if (!typeof(T).IsEnum)
            {
                throw new ArgumentException("T must be an enumerated type");
            }

            this.enemyEvent = enemyEvent;
        }
예제 #5
0
        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);
        }
예제 #6
0
        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;
        }
예제 #7
0
        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);
        }
예제 #8
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);
        }
예제 #9
0
 // Constructor
 public BatEnemyRepresentation(BatEnemy enemy, EnemyEvent enemyEvent)
     : base(enemy, enemyEvent)
 {
 }
예제 #10
0
파일: Map.cs 프로젝트: psykano/STFU-xna
 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);
 }
예제 #11
0
 // Constructor
 public WalkerEnemyRepresentation(WalkerEnemy enemy, EnemyEvent enemyEvent)
     : base(enemy, enemyEvent)
 {
 }
예제 #12
0
        public static WalkerEnemyRepresentation CreateWalkerRepresentation(WalkerEnemy enemy, EnemyEvent enemyEvent, ContentManager content)
        {
            WalkerEnemyRepresentation enemyRepresentation = new WalkerEnemyRepresentation(enemy, enemyEvent);
            enemyRepresentation.LoadContent(content);

            return enemyRepresentation;
        }
예제 #13
0
        public static WalkerEnemyRepresentation CreateWalkerRepresentation(WalkerEnemy enemy, EnemyEvent enemyEvent, ContentManager content)
        {
            WalkerEnemyRepresentation enemyRepresentation = new WalkerEnemyRepresentation(enemy, enemyEvent);

            enemyRepresentation.LoadContent(content);

            return(enemyRepresentation);
        }