Beispiel #1
0
        public override void UpdateState(GameTime time, HackGameBoard board, HackGameBoardElement_Node node)
        {
            if (lerp != null && lerp.IsAlive())
            {
                lerp.Update(time);
            }

            pulseEffect.Update(time);

            if (!Empty && PlayerHacking != null && PlayerHacking.IsHacking() == true)
            {
                HackTimerRemaining -= (float)time.ElapsedGameTime.TotalSeconds * board.GetSpeedUpFactor();
                float pctTiming = HackTimerMax != 0.0f ? 1.0f - (HackTimerRemaining / HackTimerMax) : 0.0f;
                board.SetHackLoopSoundAmountComplete(pctTiming);
                HackBackgroundTextUpdateTimer -= (float)time.ElapsedGameTime.TotalSeconds;
                if (HackBackgroundTextUpdateTimer <= 0)
                {
                    HackBackgroundTextUpdateTimer = HackBackgroundTextUpdateTimerMax;

                    //draw the right number of dots
                    pctTiming = HackTimerMax != 0.0f ? 1.0f - (HackTimerRemaining / HackTimerMax) : 0.0f;
                    int numdots = HackBackgroundMaxDrawDots - (int)((float)HackBackgroundMaxDrawDots * pctTiming);//blah
                    hackbackgroundstringbuilder.Remove(0, hackbackgroundstringbuilder.Length);
                    for(int i = 0; i < numdots; i++)
                    {
                        hackbackgroundstringbuilder.Append(board.r.NextDouble() > 0.5f ? '0' : '1');
                    }
                    board.AddBackgroundTextStandard(new StringBuilder(hackbackgroundstringbuilder.ToString()), 0); //have to create a copy in order for it to be unique in the list
                }
                if (HackTimerRemaining <= 0.0f)
                {
                    Empty = true;
                    PlayerHacking.SetHacking(false);
                    PlayerHacking.HackSuccess();
                    board.StopHackLoopSound();
                    board.PlayHackSuccessSound();
                    board.AwardNodeContents(this);
                    //board.PopUpScoreboard(4.0f);

                    board.AddBackgroundTextAward(new StringBuilder("CRACKER SUCCESSFUL"), 0);
                    board.AddBackgroundTextAward(new StringBuilder("CONTENTS UNENCRYPTED"), 0.25f);
                    board.AddBackgroundTextAward(new StringBuilder("DELETING TRACES"), 0.5f);
                }
            }
        }