public GameWorld()
        {
            hero = new Hero();
            player = new Player(hero);
            infoPanel = new InfoPanel(hero);
            eManager = new EnemyManager(hero);
            laser = new Laser(hero);

            stop = false;
            accelerationTimer = new Timer(15);
            SpeedReference = StartSpeed;
            Speed = SpeedReference;

            onscreen = new Queue<GameWorldRegion>();
            upcoming = new Queue<GameWorldRegion>();

            // set the enemy manager for the weapon
            hero.setEnemies(eManager.getEnemies());

            // first element on screen
            onscreen.Enqueue(new Space(hero, eManager.getEnemies(), leftEdge));

            // fill the rest of the exisiting screen
            while (onscreen.Last().rightEdge() <= rightEdge)
            {
                onscreen.Enqueue(nextElement(onscreen));
            }

            // prep upcoming elements
            upcoming.Enqueue(nextElement(onscreen));
        }
Ejemplo n.º 2
0
 public Enemy(Vector2 center, float width, float height, Hero hero)
     : base(center, width, height)
 {
     this.hero = hero;
     setColor(Game.randomColor());
     enemyState = EnemyState.BEGIN;
     timer = new Timer(behaviorChangeTime);
 }
        public Explosion(Hero h, Enemy e)
        {
            splash = new XNACS1Circle(e.getPosition().Center, splashRadius);
            timer = new Timer(duration);
            splash.Color = h.getColor();
            splash.Visible = false;
            splash.RemoveFromAutoDrawSet();

            emitter = new ExplosionEmitter(e.getPosition().Center, duration, 0.6f, h.getColor());
            emitter.DrawHalo(20);
            emitter.AutoRemoveDeadParticles = true;
        }
Ejemplo n.º 4
0
 public Trail(Character character)
 {
     this.character = character;
     this.trail = new Queue<Footprint>();
     this.pool = new Queue<Footprint>();
     this.timer = new Timer(interval);
 }
 public void reset(float time, DeactivateDelegate d)
 {
     initialTime = time;
     timer = new Timer(time);
     deactivate = d;
 }
        public PowerUpMeter(int sequenceNumber, Color color)
        {
            initialTime = 0f;
            timer = new Timer(0);
            float padding = 1f;
            float height = GameWorld.panelSize;
            float width = height;
            float startingPoint = GameWorld.leftEdge + 25f;
            float offset = startingPoint + (sequenceNumber + 1) * (padding) + sequenceNumber * width + width / 2;

            box = new XNACS1Rectangle(new Vector2(offset, GameWorld.topEdge + (GameWorld.panelSize / 2)), width, height);
            box.Texture = "PowerUp_Box1";

            initialMeterHeight = height / 1.8f;
            meter = new XNACS1Rectangle(box.Center, width / 1.8f, initialMeterHeight);
            meter.Color = color;
            deactivate = null;
        }
 public EnemyManager(Hero hero)
 {
     this.hero = hero;
     enemies = new List<Enemy>();
     newEnemyTimer = new Timer(enemyFrequency);
 }