Пример #1
0
 public override void Update(GameTime gameTime)
 {
     float seconds = gameTime.getSeconds(Hero.HERO_TIMESCALE);
     base.Update(gameTime);
     if(!hero.Alive && bombs.Count > 0)
         bombs.Clear();
 }
Пример #2
0
        public override void Update(GameTime gameTime)
        {
            float seconds = gameTime.getSeconds(Hero.HERO_TIMESCALE);

            if (bursting)
            {
                timeInBurst += seconds;
                if (timeInBurst >= BURST_DURATION)
                {
                    moveSpeedMultiplier = 1f;
                    burstRecharge = 0;
                    bursting = false;
                }
            }
            else if (burstRecharge < BURST_COOLDOWN)
            {
                burstRecharge += seconds*hero.powerupCooldownModifier;
            }

            if (Hero.HERO_TIMESCALE > 0f)
            {
                switch (hero.direction)
                {
                    case Direction.Up:
                        leftBoosterOffset = new Vector2(-6, 12);
                        rightBoosterOffset = new Vector2(6, 12);
                        boosterAngle = (float)Math.PI / 2;
                        break;
                    case Direction.Down:
                        leftBoosterOffset = new Vector2(6, -12);
                        rightBoosterOffset = new Vector2(-6, -12);
                        boosterAngle = (float)Math.PI * 3 / 2;
                        break;
                    case Direction.Left:
                        leftBoosterOffset = new Vector2(12, 6);
                        rightBoosterOffset = new Vector2(12, -6);
                        boosterAngle = 0;
                        break;
                    case Direction.Right:
                        leftBoosterOffset = new Vector2(-12, -6);
                        rightBoosterOffset = new Vector2(-12, 6);
                        boosterAngle = (float)Math.PI;
                        break;
                }
            }

            leftBooster.angle = boosterAngle;
            rightBooster.angle = boosterAngle;

            if (seconds > 0)
            {
                leftBooster.Update(gameTime);
                rightBooster.Update(gameTime);
            }
            Vector2 nextHeroPos = hero.position + hero.movement; //use next frame's hero position to stick the particle emitter to the hero better
            leftBooster.position = nextHeroPos + leftBoosterOffset;
            rightBooster.position = nextHeroPos + rightBoosterOffset;
        }
Пример #3
0
 public void Update(GameTime gameTime)
 {
     actionTimer += gameTime.getSeconds();
     if (actionTimer >= directionTimes[actionIndex])
     {
         actionIndex = (actionIndex + 1) % actionCount;
         actionTimer = 0;
     }
 }
Пример #4
0
        public override void Update(GameTime gameTime)
        {
            float seconds = gameTime.getSeconds(Hero.HERO_TIMESCALE);
            bombTimer += seconds * hero.powerupCooldownModifier;

            for(int i = 0; i < bombs.Count; i++)
            {
                Bomb b = bombs[i];
                b.Update(gameTime);
                if(b.timeAlive >= b.timeToExplode)
                {
                    bombs.RemoveAt(i);
                    i--;
                }
            }
        }
Пример #5
0
        public override void Update(GameTime gameTime)
        {
            float seconds = gameTime.getSeconds();
            Vector2 scrollTarget;

            if (Vector2.Distance(targetEntity.position, otherEntity.position) <= MaxDistanceBetweenEntities)
            {
                Vector2 centerBetween = Vector2.Lerp(targetEntity.position, otherEntity.position, 0.5f);
                scrollTarget = centerBetween;
            }
            else
            {
                Vector2 unitVectorBetween = (otherEntity.position - targetEntity.position);
                unitVectorBetween.Normalize();
                Vector2 maxDistanceFromTargetEntityTowardsOther = targetEntity.position + (unitVectorBetween * (MaxDistanceBetweenEntities / 2));
                scrollTarget = maxDistanceFromTargetEntityTowardsOther;
            }
            scrollCameraToTarget(scrollTarget, seconds);
        }
Пример #6
0
        public override void Update(GameTime gameTime)
        {
            if (!hero.Alive)
            {
                toRemove = true;
                return;
            }
            if (activated) {
                float seconds = gameTime.getSeconds(Hero.HERO_TIMESCALE);
                if (timer < ADRENALINE_TIME) {
                    hero.powerupCooldownModifier *= modifier;
                    timer += seconds;
                }
                else {
                    toRemove = true;
                }

                adrenalineEmitter.position = hero.position; //updates particle emitter
                adrenalineEmitter.Update(gameTime);
            }
        }
Пример #7
0
        public override void Update(GameTime gameTime)
        {
            if (!hero.Alive)
            {
                toRemove = true;
                return;
            }

            if (activated)
            {
                float seconds = gameTime.getSeconds(Hero.HERO_TIMESCALE);
                if (secsPassed < BOOST_SECS)
                {
                    secsPassed += seconds;
                    hero.globalMoveSpeedMultiplier *= SPEED_BOOST;
                }
                else
                    toRemove = true;

                speedEmitter.position = hero.position; //updates particle emitter
                speedEmitter.Update(gameTime);
            }
        }
Пример #8
0
        public void Update(GameTime gameTime, bool collide)
        {
            active = collide;
            switch (hero.direction)
            {
                case Direction.Up:
                    position.X = hero.position.X;
                    position.Y = hero.position.Y - offset;
                    break;
                case Direction.Down:
                    position.X = hero.position.X;
                    position.Y = hero.position.Y + offset;
                    break;
                case Direction.Left:
                    position.X = hero.position.X - offset;
                    position.Y = hero.position.Y;
                    break;
                case Direction.Right:
                    position.X = hero.position.X + offset;
                    position.Y = hero.position.Y;
                    break;
            }

            updateCurrentLevelAndTile();
            float seconds = gameTime.getSeconds(Hero.HERO_TIMESCALE);
            if (active)
                foreach (Enemy e in RetroGame.getLevels()[levelX, levelY].enemies)
                    if (hitbox.intersects(e.hitbox))
                    {
                        e.hitBy(hero, damagePerSecond * seconds);
                    }

            flameEmitter.position = position;
            flameEmitter.active = collide;
            flameEmitter.Update(gameTime);
            base.Update(gameTime);
        }
Пример #9
0
 public override void Update(GameTime gameTime)
 {
     float seconds = gameTime.getSeconds(Hero.HERO_TIMESCALE);
     base.Update(gameTime);
     if (!hero.Alive)
         return;
     if (bombs.Count > 0)
     {
         tickTimer += seconds;
         for(tickStage = 0; tickStage < TICK_STAGE_TIMES.Length; tickStage++) //terribly ugly loop... oh well
         {
             if (bombs[0].timeAlive < TICK_STAGE_TIMES[tickStage])
                 break;
         }
         tickStage--;
         Console.WriteLine("timealive=" + bombs[0].timeAlive + " stage=" + tickStage);
         tickInterval = TICK_INTERVALS[tickStage];
         if (tickTimer >= tickInterval)
         {
             tickTimer = 0;
             SoundManager.PlaySoundOnce("BombTick", playInReverseDuringReverse: true);
         }
     }
 }
Пример #10
0
 public override void Update(GameTime gameTime)
 {
     float seconds = gameTime.getSeconds();
     scrolling = false;
     scrollCamera(seconds);
 }
Пример #11
0
        public override void Update(GameTime gameTime)
        {
            float seconds = gameTime.getSeconds(Hero.HERO_TIMESCALE);
            if (hero.Alive)
            {
                if (bursting)
                {
                    leftBoosterFiring.active = true;
                    rightBoosterFiring.active = true;
                    leftBoosterIdle.active = false;
                    rightBoosterIdle.active = false;
                }
                else
                {
                    leftBoosterIdle.active = true;
                    rightBoosterIdle.active = true;
                    leftBoosterFiring.active = false;
                    rightBoosterFiring.active = false;
                }
            }
            else
            {
                leftBoosterIdle.active = false;
                rightBoosterIdle.active = false;
                leftBoosterFiring.active = false;
                rightBoosterFiring.active = false;
            }

            if (bursting)
            {
                float speed = hero.movement.Length();
                leftBoosterFiring.valueToDeath = BOOSTER_LENGTH * (1 + speed / (Hero.MOVE_SPEED * seconds));
                rightBoosterFiring.valueToDeath = BOOSTER_LENGTH * (1 + speed / (Hero.MOVE_SPEED * seconds));
                hero.globalMoveSpeedMultiplier *= moveSpeedMultiplier;
            }

            if (burstRecharge >= BURST_COOLDOWN)
            {
                leftBoosterIdle.valueToDeath = 12;
                rightBoosterIdle.valueToDeath = 12;
                leftBoosterIdle.startColor = BOOST_IDLE_RECHARGED_COLOR;
                rightBoosterIdle.startColor = BOOST_IDLE_RECHARGED_COLOR;
            }
            else
            {
                leftBoosterIdle.valueToDeath = 10;
                rightBoosterIdle.valueToDeath = 10;
                leftBoosterIdle.startColor = BOOST_IDLE_NOT_RECHARGED_COLOR;
                rightBoosterIdle.startColor = BOOST_IDLE_NOT_RECHARGED_COLOR;
            }

            base.Update(gameTime);
            leftBoosterFiring.angle = boosterAngle;
            rightBoosterFiring.angle = boosterAngle;

            if (seconds > 0)
            {
                leftBoosterFiring.Update(gameTime);
                rightBoosterFiring.Update(gameTime);
            }
            Vector2 nextHeroPos = hero.position + hero.movement; //use next frame's hero position to stick the particle emitter to the hero better
            leftBoosterFiring.position = nextHeroPos + leftBoosterOffset;
            rightBoosterFiring.position = nextHeroPos + rightBoosterOffset;
        }
Пример #12
0
 public static void Update(GameTime gameTime)
 {
     float seconds = gameTime.getSeconds();
     bool coop = RetroGame.NUM_PLAYERS == 2;
     int newPosition;
     if (!coop)
     {
         currentSoloHighscore.score = RetroGame.Score;
         for (newPosition = currentHighscorePosition; newPosition > 0; newPosition--)
         {
             if (currentSoloHighscore.score >= highscoresSolo[newPosition - 1].score)
                 continue;
             break;
         }
         if (newPosition != currentHighscorePosition)
         {
             if (currentHighscorePosition < HIGHSCORE_COUNT)
                 highscoresSolo.RemoveAt(currentHighscorePosition);
             else
                 highscoresSolo.RemoveAt(HIGHSCORE_COUNT - 1);
             highscoresSolo.Insert(newPosition, currentSoloHighscore);
             currentHighscorePosition = newPosition;
         }
     }
     else
     {
         currentCoopHighscore.score = RetroGame.Score;
         for (newPosition = currentHighscorePosition; newPosition > 0; newPosition--)
         {
             if (currentCoopHighscore.score >= highscoresCoop[newPosition - 1].score)
                 continue;
             break;
         }
         if (newPosition != currentHighscorePosition)
         {
             if (currentHighscorePosition < HIGHSCORE_COUNT)
                 highscoresCoop.RemoveAt(currentHighscorePosition);
             else
                 highscoresCoop.RemoveAt(HIGHSCORE_COUNT - 1);
             highscoresCoop.Insert(newPosition, currentCoopHighscore);
             currentHighscorePosition = newPosition;
         }
     }
     currentHighscoreColorInterp += seconds * currentHighscoreColorInterpModifier * CURRENT_HIGHSCORE_COLOR_SPEED;
     if (currentHighscoreColorInterp > 1 || currentHighscoreColorInterp < 0)
     {
         currentHighscoreColorInterpModifier *= -1;
         currentHighscoreColorInterp = MathHelper.Clamp(currentHighscoreColorInterp, 0, 1);
     }
     currentHighscoreColor = Color.Lerp(CURRENT_HIGHSCORE_REGULAR_COLOR, CURRENT_HIGHSCORE_HIGHLIGHTED_COLOR, currentHighscoreColorInterp);
 }
Пример #13
0
        public static void UpdateReverse(GameTime gameTime)
        {
            float seconds = gameTime.getSeconds();
            secsSinceLastRetroPort = 0;

            bool isNewFrame = false;
            int RETROPORT_FRAMES = histories.Count;
            float framePerc = currentFrame / RETROPORT_FRAMES;
            float frameVelocity = getFrameVelocity(framePerc);
            float oldFrame = currentFrame;
            currentFrame += frameVelocity * seconds;
            if ((int)currentFrame != (int)oldFrame)
                isNewFrame = true;

            int frameIndex = RETROPORT_FRAMES - (int)currentFrame - 1;
            float interpolation = currentFrame - (int)currentFrame;
            History currentHistory = null;
            History nextHistory = null;
            if (frameIndex >= 0)
            {
                currentHistory = histories.ElementAt(frameIndex);
            }
            else
            {
                CancelRevert();
                return;
            }

            if (frameIndex > 0)
            {
                nextHistory = histories.ElementAt(frameIndex - 1);
            }

            foreach (IReversible reversible in currentHistory.mementos.Keys)
            {
                IMemento nextFrame = null;
                if (nextHistory != null && nextHistory.mementos.ContainsKey(reversible))
                    nextFrame = nextHistory.mementos[reversible];
                currentHistory.mementos[reversible].Apply(interpolation, isNewFrame, nextFrame);
            }
            currentHistory.retroGameMemento.Apply(interpolation, isNewFrame, (nextHistory != null) ? nextHistory.retroGameMemento : null);
            currentHistory.riotGuardWallMemento.Apply(interpolation, isNewFrame, (nextHistory != null) ? nextHistory.riotGuardWallMemento : null);
            currentHistory.soundManagerMemento.Apply(interpolation, isNewFrame, (nextHistory != null) ? nextHistory.soundManagerMemento : null);

            LevelManagerScreen topScreen = RetroGame.TopLevelManagerScreen;
            topScreen.currentEffect = Effects.RewindDistortion;
            topScreen.currentEffect.CurrentTechnique = topScreen.currentEffect.Techniques["DistortRight"];
            topScreen.currentEffect.Parameters["waveFrequency"].SetValue(DISTORTION_WAVE_FREQUENCY);
            topScreen.currentEffect.Parameters["granularity"].SetValue(DISTORTION_WAVE_GRANULARITY);
            topScreen.currentEffect.Parameters["waveOffset"].SetValue(DISTORTION_WAVE_OFFSET);
            waveAmplitude = 2 * frameVelocity / FRAME_VELOCITY_MAX;
            topScreen.currentEffect.Parameters["waveAmplitude"].SetValue((DISTORTION_WAVE_AMPLITUDE_BASE * waveAmplitude) - DISTORTION_WAVE_OFFSET);
            phaseOffset = framePerc * 2;
            topScreen.currentEffect.Parameters["phaseOffset"].SetValue(phaseOffset);
            topScreen.drawEffects = true;
        }
Пример #14
0
        public static void UpdateForward(GameTime gameTime)
        {
            float seconds = gameTime.getSeconds();
            secsSinceLastRetroPort += seconds;

            History history = new History();
            foreach (IReversible reversible in registeredReversibles)
            {
                history.mementos[reversible] = reversible.GenerateMementoFromCurrentFrame();
            }
            history.retroGameMemento = RetroGame.GenerateMementoFromCurrentFrame();
            history.riotGuardWallMemento = RiotGuardWall.GenerateMementoFromCurrentFrame();
            history.soundManagerMemento = SoundManager.GenerateMementoFromCurrentFrame();
            histories.Enqueue(history);

            if (secsSinceLastRetroPort >= RETROPORT_BASE_SECS)
            {
                LastHistory = histories.Dequeue();
            }
            else
            {
                LastHistory = null;
            }
        }
Пример #15
0
        public override void Update(GameTime gameTime)
        {
            float seconds = gameTime.getSeconds();

            if (SoundManager.TargetVolume != BACKGROUND_MUSIC_VOLUME)
                SoundManager.SetMusicVolume(BACKGROUND_MUSIC_VOLUME);
            UpdateControls(bindings, gameTime);

            arrowDistance += seconds * ARROW_DISTANCE_VELOCITY * arrowVelocityModifier;
            if(arrowDistance >= ARROW_DISTANCE_MAX || arrowDistance <= ARROW_DISTANCE_MIN)
                arrowVelocityModifier *= -1;

            if (bindingsMenuInstructionsNotifyTime < BINDINGS_INSTRUCTIONS_NOTIFY_TIME)
            {
                bindingsMenuInstructionsNotifyTime += seconds;
            }
            bindingsMenuInstructionsColor = Color.Lerp(bindingsMenuInstructionsError ? BINDINGS_INSTRUCTIONS_ERROR_COLOR : BINDINGS_INSTRUCTIONS_NOTIFY_COLOR, BINDINGS_INSTRUCTIONS_IDLE_COLOR, bindingsMenuInstructionsNotifyTime / BINDINGS_INSTRUCTIONS_NOTIFY_TIME);
        }
Пример #16
0
        public void UpdateEscape(GameTime gameTime)
        {
            float seconds = gameTime.getSeconds();

            //remove entities
            foreach (Collectable c in collectablesToRemove)
            {
                if (levels != null)
                {
                    Level l = levels[c.levelX, c.levelY];
                    if (l != null && l.collectables != null)
                        if (c is Prisoner)
                        {
                            l.removePrisoner((Prisoner) c);
                        }
                        else if (c is PowerupIcon)
                        {
                            l.removePowerup((PowerupIcon) c);
                        }
                        else
                        {
                            l.collectables.Remove(c);
                        }
                }
            }
            collectablesToRemove.Clear();
            foreach (Enemy e in enemiesToRemove)
            {
                foreach (Level l in levels)
                {
                    if (l != null)
                    {
                        l.enemies.Remove(e);
                    }
                }
            }
            enemiesToRemove.Clear();

            foreach (Hero hero in heroes)
                hero.Update(gameTime);

            foreach (Level l in CurrentLevels)
                l.UpdateEscape(gameTime);

            bool levelChanged = false;
            foreach (Hero hero in heroes)
                levelChanged |= hero.levelChanged;
            if (levelChanged)
            {
                createAndRemoveLevels();
                if(RetroGame.State == GameState.Arena)
                    RetroGame.EnterEscapeMode();
            }

            float mult = 0f;
            float currentZoomSpeed = Camera.zoomSpeed;
            #if DEBUG
            if (heroes[0].isDown(Keys.E))
                mult = 2.7f;
            else if (heroes[0].isDown(Keys.R))
                mult = -2.7f;
            Camera.targetZoom += Camera.zoomSpeed * mult * seconds;
            #endif
            if (mult != 0f)
                currentZoomSpeed = 5 * Camera.zoomSpeed;

            if (Camera.targetZoom - Camera.zoom > seconds * currentZoomSpeed)
                Camera.zoom += currentZoomSpeed * seconds;
            else if (Camera.targetZoom - Camera.zoom < -seconds * currentZoomSpeed)
                Camera.zoom -= currentZoomSpeed * seconds;
            else
                Camera.zoom = Camera.targetZoom;
            Camera.Update(gameTime);
        }
Пример #17
0
        public override void Update(GameTime gameTime)
        {
            float seconds = gameTime.getSeconds();

            if(SoundManager.TargetVolume != BACKGROUND_MUSIC_VOLUME)
                SoundManager.SetMusicVolumeSmooth(BACKGROUND_MUSIC_VOLUME);

            float prevStoreCharge = RetroGame.StoreCharge;
            if (!RiotGuardWall.IsWaiting)
                RetroGame.storeChargeTime += gameTime.getSeconds(1f);
            RetroGame.StoreCharge = RetroGame.storeChargeTime / RetroGame.STORE_CHARGE_TIME;
            if (prevStoreCharge < 1 && RetroGame.StoreCharge >= 1)
            {
                SoundManager.PlaySoundOnce("StoreChargedJingle");
            }

            currentEffect = null;
            drawEffects = false;
            switch (RetroGame.State)
            {
                case GameState.Arena:
                    levelManager.UpdateArena(gameTime);
                    break;
                case GameState.Escape:
                    levelManager.UpdateEscape(gameTime);
                    break;
            }
            RiotGuardWall.Update(gameTime);
            History.UpdateForward(gameTime);
            HUD.Update(gameTime);

            vignetteIntensity += seconds * VIGNETTE_PULSE_SPEED * vignetteMultiplier;
            if (vignetteIntensity >= VIGNETTE_MAX_INTENSITY)
            {
                vignetteMultiplier *= -1;
            }
            else if (vignetteIntensity < 0)
            {
                vignetteMultiplier = 0;
                drawVignette = false;
            }

            testEffectRadius += TEST_EFFECT_RADIUS_SPEED * testEffectRadiusMultiplier * seconds;
            if (testEffectRadius < TEST_EFFECT_RADIUS_MIN || testEffectRadius > TEST_EFFECT_RADIUS_MAX)
            {
                testEffectRadiusMultiplier *= -1;
            }
        }
Пример #18
0
        public override void Update(GameTime gameTime)
        {
            float seconds = gameTime.getSeconds();

            timeSinceLastTurn += seconds;
            float time = timeSinceLastTurn;
            if (timeSinceLastTurn > TIME_PER_TURN)
            {
                timeSinceLastTurn = 0;
                switch (RetroGame.rand.Next(10))
                {
                    case 0:
                        rotation = 0;
                        break;
                    case 1:
                        rotation = (float)Math.PI / 2;
                        break;
                    case 2:
                        rotation = (float)Math.PI;
                        break;
                    case 3:
                        rotation = (float)Math.PI * 3 / 2;
                        break;
                    default:
                        timeSinceLastTurn = time;
                        break;
                }
            }

            flashingTime += seconds;
            if (flashingTime >= flashingDelays[flashingIndex])
            {
                drawHelp = !drawHelp;
                flashingTime -= flashingDelays[flashingIndex];
                flashingIndex = (flashingIndex + 1) % FLASHING_SEQUENCE_ELEMENTS;
            }

            base.Update(gameTime);
        }
Пример #19
0
 public void Update(GameTime gameTime)
 {
     float timeModifier = 1f;
     float seconds = gameTime.getSeconds() * timeModifier;
     totalSeconds += seconds;
     particlesDeadThisFrame = 0;
     Update(totalSeconds, seconds, false);
 }
Пример #20
0
 public override void Update(GameTime gameTime)
 {
     float seconds = gameTime.getSeconds();
     absoluteCenter = targetEntity.position;
     scrollCameraToTarget(absoluteCenter, seconds);
 }
Пример #21
0
        public override void Update(GameTime gameTime)
        {
            float seconds = gameTime.getSeconds(Hero.HERO_TIMESCALE);
            rescueTimer += seconds * hero.powerupCooldownModifier; //keeps track of cooldown

            if (rescueEmitter == null)
            {
                initializeRescueEmitter();
                rescueEmitter.active = false;
            }
            else
            {
                if (!rescueEmitter.active)
                    rescueEmitter.position = hero.position; //updates particle emitter
                rescueEmitter.Update(gameTime);
                if (rescueEmitter.isFinished())
                    rescueEmitter = null;
            }

            if (endEmitter == null)
            {
                initializeEndEmitter();
            }
            else
            {
                endEmitter.Update(gameTime);
                if (endEmitter.isFinished())
                    endEmitter = null;
            }
        }
Пример #22
0
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);
            float seconds = gameTime.getSeconds();
            switch (mode)
            {
                case MenuScreenMode.TransitioningIn:
                    {
                        folderPositionRelative = MathHelper.Clamp(folderPositionRelative -= FOLDER_SCREEN_VELOCITY_RELATIVE * seconds, FOLDER_SCREEN_POSITION_RELATIVE_SHOWN, FOLDER_SCREEN_POSITION_RELATIVE_HIDDEN);
                        folderPosition = new Vector2(0.5f, folderPositionRelative) * RetroGame.screenSize;

                        float interp = (FOLDER_SCREEN_POSITION_RELATIVE_HIDDEN - folderPositionRelative) / (FOLDER_SCREEN_POSITION_RELATIVE_HIDDEN - FOLDER_SCREEN_POSITION_RELATIVE_SHOWN);
                        folderRotation = FOLDER_ROTATION_HIDDEN * (1 - interp) + FOLDER_ROTATION_SHOWN * interp;

                        if (interp == 1)
                        {
                            mode = MenuScreenMode.Active;
                        }
                        else if (interp == 0)
                        {
                            RetroGame.PopScreen();
                        }
                    }
                    break;
            }
        }
Пример #23
0
 public static void UpdateAcquired(GameTime gameTime)
 {
     float seconds = gameTime.getSeconds();
     bool acquiredIconInStorage = false;
     if (acquiredIcons.Count > 0)
     {
         for(int i = 0; i < acquiredIcons.Count; i++)
         {
             AcquiredIcon acquiredIcon = acquiredIcons[i];
             acquiredIcon.time += seconds;
             if (acquiredIcon.time >= ACQUIRED_FLASH_TIME)
             {
                 acquiredIcons.RemoveAt(i);
                 i--;
             }
             if (acquiredIcon.pos.X >= RetroGame.MAX_PLAYERS)
             {
                 acquiredIconInStorage = true;
             }
         }
     }
     shouldAlsoDrawStorageIcons = acquiredIconInStorage;
 }
Пример #24
0
        public override void Update(GameTime gameTime)
        {
            base.PreUpdate(gameTime);

            float seconds = gameTime.getSeconds(Hero.HERO_TIMESCALE);

            if (activated)
            {
                chargeTimer += seconds*hero.powerupCooldownModifier;
            }
            chargeEmitter.active = activated;
            if (chargeTimer < BULLET_CHARGE_TIME_SMALL)
            {
                chargeEmitter.active = false;
            }
            else if (chargeTimer >= BULLET_CHARGE_TIME_SMALL && chargeTimer < BULLET_CHARGE_TIME_MEDIUM)
            {
                if (!activated)
                {
                    Bullet b = new Bullet(this, "chargebullet1", PrebuiltEmitter.SmallBulletSparks, EMITTER_CHARGE_COLOR, hero.direction, Bullet.DISTANCE_LIMIT_CHARGE, (int)(BULLET_DAMAGE_CHARGE_SMALL * damageModifier));
                    ammo.Add(b);
                    b.scale = BULLET_SMALL_SCALE;
                    b.hitbox.originalRectangle.Height = (int)(BASE_BULLET_SIZE * BULLET_SMALL_SCALE);
                    b.hitbox.originalRectangle.Width = (int)(BASE_BULLET_SIZE * BULLET_SMALL_SCALE);
                    b.position = new Vector2(hero.position.X, hero.position.Y);
                    b.explosionEmitter.startSize = 1f;
                    b.explosionEmitter.endSize = 1f;
                    chargeTimer = 0;

                    FiredSound = "BulletTiny";
                    shotFired = true;
                }
                chargeEmitter.startSize = CHARGE_PARTICLES_SMALL_SCALE;
                Color c = CHARGE_COLOR_SMALL;
                chargeEmitter.startColor = c;
                c.A = 255;
                chargeEmitter.endColor = c;
            }
            else if (chargeTimer >= BULLET_CHARGE_TIME_MEDIUM && chargeTimer < BULLET_CHARGE_TIME_LARGE)
            {
                if (!activated)
                {
                    Bullet b = new Bullet(this, "chargebullet2", PrebuiltEmitter.MediumBulletSparks, EMITTER_CHARGE_COLOR, hero.direction, Bullet.DISTANCE_LIMIT_CHARGE, (int)(BULLET_DAMAGE_CHARGE_MEDIUM * damageModifier), true);
                    ammo.Add(b);
                    b.scale = BULLET_MEDIUM_SCALE;
                    b.hitbox.originalRectangle.Height = (int)(BASE_BULLET_SIZE * BULLET_MEDIUM_SCALE);
                    b.hitbox.originalRectangle.Width = (int)(BASE_BULLET_SIZE * BULLET_MEDIUM_SCALE);
                    b.position = new Vector2(hero.position.X, hero.position.Y);
                    b.explosionEmitter.startSize = 1f;
                    b.explosionEmitter.endSize = 1f;
                    chargeTimer = 0;

                    FiredSound = "BulletLight";
                    shotFired = true;
                }
                chargeEmitter.startSize = CHARGE_PARTICLES_MEDIUM_SCALE;
                Color c = CHARGE_COLOR_MEDIUM;
                chargeEmitter.startColor = c;
                c.A = 255;
                chargeEmitter.endColor = c;
            }
            else if (chargeTimer >= BULLET_CHARGE_TIME_LARGE)
            {
                if (!activated)
                {
                    Bullet b = new Bullet(this, "chargebullet3", PrebuiltEmitter.LargeBulletSparks, EMITTER_CHARGE_COLOR, hero.direction, Bullet.DISTANCE_LIMIT_CHARGE, (int)(BULLET_DAMAGE_CHARGE_LARGE * damageModifier), true);
                    ammo.Add(b);
                    b.scale = BULLET_LARGE_SCALE;
                    b.hitbox.originalRectangle.Height = (int)(BASE_BULLET_SIZE * BULLET_LARGE_SCALE);
                    b.hitbox.originalRectangle.Width = (int)(BASE_BULLET_SIZE * BULLET_LARGE_SCALE);
                    b.position = new Vector2(hero.position.X, hero.position.Y);
                    b.explosionEmitter.startSize = 1f;
                    b.explosionEmitter.endSize = 1f;
                    chargeTimer = 0;

                    FiredSound = "BulletStrong";
                    shotFired = true;
                }
                chargeEmitter.startSize = CHARGE_PARTICLES_LARGE_SCALE;
                Color c = CHARGE_COLOR_LARGE;
                chargeEmitter.startColor = c;
                c.A = 255;
                chargeEmitter.endColor = c;
            }

            chargeEmitter.position = hero.position;
            if (seconds > 0)
            {
                chargeEmitter.Update(gameTime);
            }

            base.PostUpdate(gameTime);
        }
Пример #25
0
 public void UpdateArena(GameTime gameTime)
 {
     float seconds = gameTime.getSeconds();
     Camera.Update(gameTime);
     UpdateEscape(gameTime);
 }
Пример #26
0
 public static void UpdateCursorBobAnimation(GameTime gameTime)
 {
     float seconds = gameTime.getSeconds();
     for (int i = 0; i < cursorBobOffsets.Length; i++)
     {
         cursorBobOffsets[i] += BOB_OFFSET_VELOCITY * cursorBobMultipliers[i] * seconds;
         if (cursorBobOffsets[i] < MIN_BOB_OFFSET || cursorBobOffsets[i] >= MAX_BOB_OFFSET)
             cursorBobMultipliers[i] *= -1;
     }
 }
Пример #27
0
        public void UpdateRetro(GameTime gameTime)
        {
            float seconds = gameTime.getSeconds();
            // Remove non-revertible collectables still
            if (collectablesToRemove != null)
                foreach (Collectable c in collectablesToRemove)
                {
                    if (levels != null)
                    {
                        Level l = levels[c.levelX, c.levelY];
                        if (l != null && l.collectables != null)
                            if (c is Prisoner)
                            {
                                l.removePrisoner((Prisoner)c);
                            }
                            else if (c is PowerupIcon)
                            {
                                l.removePowerup((PowerupIcon)c);
                            }
                            else
                            {
                                l.collectables.Remove(c);
                            }
                    }
                }
            collectablesToRemove.Clear();
            // Update non-revertible collectables still
            foreach (Level l in CurrentLevels)
                l.UpdateRetro(gameTime);

            foreach (Hero hero in heroes)
                hero.updateCurrentLevelAndTile();
            createAndRemoveLevels();
            Camera.Update(gameTime);
        }
Пример #28
0
 public static void UpdateWarning(GameTime gameTime)
 {
     float seconds = gameTime.getSeconds();
     if (warning != "")
     {
         warningFlashTime += seconds;
         if (warningFlashTime >= WARNING_FLASH_TIME)
             warningFlashTime = WARNING_FLASH_TIME;
         float interp = warningFlashTime / WARNING_FLASH_TIME;
         warningColor = Color.Lerp(WARNING_INITIAL_COLOR, WARNING_FINAL_COLOR, interp);
     }
 }
Пример #29
0
 public override void Update(GameTime gameTime)
 {
     float seconds = gameTime.getSeconds(Hero.HERO_TIMESCALE);
     //Powerup logic here
 }
Пример #30
0
        public override void Update(GameTime gameTime)
        {
            float seconds = gameTime.getSeconds(Hero.HERO_TIMESCALE);

            hero.powerupCooldownModifier = modifier;
        }