Esempio n. 1
0
        public Boss(SpriteBatch spriteBatch, Soul game, AudioManager audio, GameTime gameTime, string alias, EntityManager entityManager)
            : base(spriteBatch, game, Constants.BOSS_IDLE_FILENAME, new Vector2(Constants.BOSS_WIDTH, Constants.BOSS_HEIGHT), alias, EntityType.BOSS)
        {
            spriteIdle = new Sprite(spriteBatch, game, Constants.BOSS_IDLE_FILENAME);
            spriteShoot = new Sprite(spriteBatch, game, Constants.BOSS_SHOOT_FILENAME);
            spriteSpawn = new Sprite(spriteBatch, game, Constants.BOSS_SPAWN_FILENAME);
            spriteDeath = new Sprite(spriteBatch, game, Constants.BOSS_DEATH_FILENAME);

            this.sprite = spriteSpawn;
            this.animation.MaxFrames = 0;

            animation2 = new Animation(((int)(spriteShoot.X / dimension.X)) - 1);

            this.entityManager = entityManager;
            weapon = new BossWeapon(spriteBatch, game, sprite.Y);
            weapon.Damage = damage;
            offset = Vector2.Zero;

            this.random = new Random();
            hitFx = new HitFX(game);
            velocity.X = 5;
            this.audio = audio;

            fireRate = burst;
            burstPause = int.Parse(game.constants.getValue("BOSS", "BURSTPAUSE"));
        }
Esempio n. 2
0
        public Entity(SpriteBatch spriteBatch, Soul game, string filename, Vector2 dimension, string alias, EntityType type)
        {
            sprite = new Sprite(spriteBatch, game, filename);
            screenBoundaries = new Rectangle(0, 0, Constants.RESOLUTION_VIRTUAL_WIDTH, Constants.RESOLUTION_VIRTUAL_HEIGHT);
            this.alias = alias;
            this.dimension = dimension;
            offset.X = dimension.X * 0.5f;
            offset.Y = dimension.Y * 0.5f;
            this.type = type;
            animation = new Animation(((int)(sprite.X / dimension.X)) - 1);
            this.game = game;
            this.spriteBatch = spriteBatch;

            //IniFile config = new IniFile("Content\\Config\\config.ini");
            //config.parse();
            debug = bool.Parse(game.config.getValue("Debug","Hitbox"));

            bool varyingEntity = false;
            List<String> varyingEntities = new List<string>();
            varyingEntities.Add("BLUE_BLOOD_VESSEL");
            varyingEntities.Add("RED_BLOOD_VESSEL");
            varyingEntities.Add("PURPLE_BLOOD_VESSEL");
            varyingEntities.Add("DARK_THOUGHT");
            varyingEntities.Add("DARK_WHISPER");
            varyingEntities.Add("INNER_DEMON");
            varyingEntities.Add("LESSER_DEMON");
            varyingEntities.Add("NIGHTMARE");
            varyingEntities.Add("PLAYER");
            varyingEntities.Add("BOSS");
            foreach (String entityType in varyingEntities)
            {
                if (type.ToString().Equals(entityType))
                {
                    varyingEntity = true;
                }
            }

            if (varyingEntity)
            {
                //IniFile ini = new IniFile("Content\\Config\\constants.ini");
                //ini.parse();
                health = int.Parse(game.constants.getValue(type.ToString(), "HEALTH"));

                if (type.ToString().Equals("PLAYER"))
                {
                    maxHealth = int.Parse(game.constants.getValue(type.ToString(), "MAXHEALTH"));
                }

                if (!type.ToString().Equals("BOSS"))
                {
                    hitRadius = int.Parse(game.constants.getValue(type.ToString(), "RADIUS"));
                    maxVelocity = new Vector2(float.Parse(game.constants.getValue(type.ToString(), "SPEED")), float.Parse(game.constants.getValue(type.ToString(), "SPEED")));
                }

                if (!type.ToString().Equals("INNER_DEMON") && !type.ToString().Equals("LESSER_DEMON") && !type.ToString().Equals("BOSS"))
                {
                    damage = int.Parse(game.constants.getValue(type.ToString(), "DAMAGE"));
                }
                if (type.ToString().Equals("DARK_THOUGHT") || type.ToString().Equals("PLAYER"))
                {
                    fireRate = float.Parse(game.constants.getValue(type.ToString(), "RATE"));
                }
                if (type.ToString().Equals("DARK_THOUGHT") || type.ToString().Equals("BOSS"))
                {
                    burst = int.Parse(game.constants.getValue(type.ToString(), "BURSTPERIOD"));
                }
                if (type.ToString().Equals("INNER_DEMON") || type.ToString().Equals("BOSS"))
                {
                    minSpawn = int.Parse(game.constants.getValue(type.ToString(), "MINSPAWN"));
                    maxSpawn = int.Parse(game.constants.getValue(type.ToString(), "MAXSPAWN"));
                }
                if (type.ToString().Equals("DARK_WHISPER"))
                {
                    spikeDamage = int.Parse(game.constants.getValue(type.ToString(), "SPIKEDAMAGE"));
                    spikeSpeed = int.Parse(game.constants.getValue(type.ToString(), "SPIKESPEED"));
                    spikeRange = int.Parse(game.constants.getValue(type.ToString(), "SPIKERANGE"));
                }
            }
        }