Esempio n. 1
0
        public void BoundCameraOffsetAndZoom(HackGameBoard board)
        {
            if (cameraOffset.X > 0.0f)
            {
                cameraOffset.X = 0.0f;
            }
            if (cameraOffset.Y > 0.0f)
            {
                cameraOffset.Y = 0.0f;
            }

            Vector2 boardmax = board.GetMaxCameraOffsetBottomRight(cameraZoom, board.GetGame().GraphicsDevice);

            if (cameraOffset.X < boardmax.X)
            {
                cameraOffset.X = boardmax.X;
            }

            if (cameraOffset.Y < boardmax.Y)
            {
                cameraOffset.Y = boardmax.Y;
            }

            float minZoom = board.GetMinZoom(board.GetGame().GraphicsDevice);

            if (cameraZoom < minZoom)
            {
                cameraZoom = minZoom;
            }
            if (cameraZoom > 1.5f)
            {
                cameraZoom = 1.5f;
            }
        }
Esempio n. 2
0
        private void UpdateActiveState(GameTime time, HackGameBoard board, HackNodeGameBoardMedia drawing)
        {
            switch (currentAIState)
            {
                case HackGameAgent_AI_State.HackGameAgent_AI_State_Wander:
                    Wander_Update(time, board);
                    break;
            }

            if (StartPing_Update)
            {
                //be sure we're in a node.
                if (board.InBoard(getCurrentBoardLocation()) && board.GetElementAtPoint(getCurrentBoardLocation()).type == HackGameBoardElementBaseType.HackGameBoardElementBaseType_Node)
                {
                    //do some other stuff here.
                    StartPing_Draw = true;
                    StartPing_Update = false;
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Load graphics content for the game.
        /// </summary>
        public override void LoadContent()
        {
            if (content == null)
                content = new ContentManager(ScreenManager.Game.Services, "Content");

            ourGame = ((Game1)(ScreenManager.Game));

            gameFont = content.Load<SpriteFont>("gamefont");

            drawing = new HackNodeGameBoardMedia(ScreenManager.Game, content);
            board = new HackGameBoard((Game1)ScreenManager.Game, this, drawing);

            //USE YOUR CURRENT WAVE TO LOAD UP A NEW MAP.

            board.LoadWave(ourGame);
            player = new HackGameAgent_Player(board);
            board.AddAgent(player);

            int maxtrails = 50;
            float maxAlpha = 0.85f;
            float minAlpha = 0.00f;
            for (int i = 0; i < maxtrails; i++)
            {
                HackGameAgent_Trail t = new HackGameAgent_Trail(board, MathHelper.Lerp(minAlpha, maxAlpha, (float)(maxtrails-i)/maxtrails), drawing.PlayerTexture);
                if (i % 2 != 0 || i < 5)
                {
                    t.SetCurrentState(HackGameAgent.HackGameAgent_State.HackGameAgent_State_Inactive);
                }
                player.AddTrail(t);
                board.AddAgent(t);
            }
            ScreenManager.Game.ResetElapsedTime();

            ourGame.LoadStopTime = DateTime.Now;
            ourGame.LoadTime = (float)(ourGame.LoadStopTime.Ticks - ourGame.LoadStartTime.Ticks) / (float)TimeSpan.TicksPerSecond;
        }
Esempio n. 4
0
        public void SetCameraOffsetAndZoom(Vector2 newcameraOffset, float newZoom, HackGameBoard board)
        {
            lastcameraZoom = cameraZoom;
            lastCameraOffset = cameraOffset;

            cameraOffset.X = newcameraOffset.X;
            cameraOffset.Y = newcameraOffset.Y;

            cameraZoom = newZoom;

            BoundCameraOffsetAndZoom(board);
        }
Esempio n. 5
0
 public override void OnAgentExit(HackGameAgent agent, HackGameBoard board, HackGameBoardElement_Node node)
 {
 }
Esempio n. 6
0
 public override void UpdateState(GameTime time, HackGameBoard board, HackGameBoardElement_Node node)
 {
     pulseEffect.Update(time);
 }
Esempio n. 7
0
        public override void OnAgentEnter(HackGameAgent agent, HackGameBoard board, HackGameBoardElement_Node node)
        {
            if (!fired && agent is HackGameAgent_Player)
            {
                fired = true;
                drawFire = true;

                HackGameAgent_Projectile_Mortar mortar = new HackGameAgent_Projectile_Mortar(board);
                board.AddAgent(mortar);
            }
        }
Esempio n. 8
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);
                }
            }
        }
Esempio n. 9
0
 public abstract bool Update(GameTime time, HackGameBoard board);
Esempio n. 10
0
 public bool Update(GameTime time, HackGameBoard board)
 {
     return (trigger.Update(time, board));
 }
Esempio n. 11
0
 public HackGameAgent_Collapser(HackGameBoard board, float secondsToCollapse, Point location)
     : base(board)
 {
     collapseTimeSeconds = secondsToCollapse;
     setCurrentBoardLocation(location, board);
 }
Esempio n. 12
0
        private void Wander_Ping(HackGameBoard board)
        {
            board.AddBackgroundTextEmergency(new StringBuilder("AI #3180 PING..."), 0);
            board.AddBackgroundTextEmergency(new StringBuilder("AI RESOLVE OK"), 0.75f);

            StartPing_Update = true;
            //move right away to analyze.
            wanderSubState = HackGameAgent_AI_Wander_SubState.HackGameAgent_AI_State_Wander_Substate_AnalyzePing;
        }
Esempio n. 13
0
 private void Wander_Loiter(HackGameBoard board)
 {
     // for now, just move.
     SetRandomDestination(board);
 }
Esempio n. 14
0
 private void Wander_AnalyzePing(HackGameBoard board)
 {
     //move right away to loiter.
     wanderSubState = HackGameAgent_AI_Wander_SubState.HackGameAgent_AI_State_Wander_Substate_Loiter;
 }
Esempio n. 15
0
 private void UpdateSpawningInState(GameTime time, HackGameBoard board, HackNodeGameBoardMedia drawing)
 {
     spawnInData.totalTimer -= (float)time.ElapsedGameTime.TotalSeconds;
     if (spawnInData.totalTimer <= 0)
     {
         this.SetCurrentState(HackGameAgent_State.HackGameAgent_State_Active);
     }
     else
     {
         if (spawnInData.flashing)
         {
             spawnInData.dropInFlash.Update(time);
         }
         else
         {
             spawnInData.dropInLerp.Update(time);
             if (!spawnInData.dropInLerp.IsAlive())
             {
                 spawnInData.DrawImpact = true;
                 spawnInData.StartFlashing();
                 board.AddBackgroundTextEmergency(new StringBuilder("[WARNING] AI ACTIVATING"), 0);
                 board.AddBackgroundTextEmergency(new StringBuilder("SENSORS PICKING UP ICE"), 0.5f);
                 board.AddBackgroundTextEmergency(new StringBuilder("DANGER-DANGER-DANGER"), 0.25f);
             }
         }
     }
 }
Esempio n. 16
0
 public override void OnAgentExit(HackGameAgent agent, HackGameBoard board, HackGameBoardElement_Node node)
 {
     if (agent is HackGameAgent_Player)
     {
         ((HackGameAgent_Player)(agent)).SetHacking(false);
         PlayerHacking = null;
         board.GetMedia().StopHackLoopSound();
         //reset timer
         HackTimerRemaining = HackTimerMax;
         HackBackgroundTextUpdateTimer = 0.0f;
     }
 }
Esempio n. 17
0
 public override void OnAgentStay(HackGameAgent agent, HackGameBoard board, HackGameBoardElement_Node node)
 {
     if (!Empty && agent is HackGameAgent_Player)
     {
         PlayerHacking = (HackGameAgent_Player)agent;
         PlayerHacking.SetHacking(true);
         //our first time in!
         board.GetMedia().StartHackLoopSound();
         HackBackgroundTextUpdateTimer = HackBackgroundTextUpdateTimerMax;
     }
 }
Esempio n. 18
0
 public override bool Update(GameTime time, HackGameBoard board)
 {
     if (board.GetScore() >= targetscore)
         return true;
     return false;
 }
Esempio n. 19
0
 public override void OnAgentEnter(HackGameAgent agent, HackGameBoard board, HackGameBoardElement_Node node)
 {
     if (!fired && agent is HackGameAgent_Player)
     {
         fired = true;
         drawFire = true;
     }
 }
Esempio n. 20
0
 public override bool Update(GameTime time, HackGameBoard board)
 {
     if (timeremainingseconds > 0)
     {
         timeremainingseconds -= (float)time.ElapsedGameTime.TotalSeconds;
         if (timeremainingseconds <= 0)
         {
             return true;
         }
         else
         {
             return false;
         }
     }
     return true;
 }
Esempio n. 21
0
        public override void OnAgentEnter(HackGameAgent agent, HackGameBoard board, HackGameBoardElement_Node node)
        {
            if (!fired && agent is HackGameAgent_Player)
            {
                fired = true;
                drawFire = true;

                HackGameAgent_Projectile_Multimissile multi_north = new HackGameAgent_Projectile_Multimissile(board, HackGameAgent.MovementDirection.MovementDirection_North);
                board.AddAgent(multi_north);
                HackGameAgent_Projectile_Multimissile multi_south = new HackGameAgent_Projectile_Multimissile(board, HackGameAgent.MovementDirection.MovementDirection_South);
                board.AddAgent(multi_south);
                HackGameAgent_Projectile_Multimissile multi_east = new HackGameAgent_Projectile_Multimissile(board, HackGameAgent.MovementDirection.MovementDirection_East);
                board.AddAgent(multi_east);
                HackGameAgent_Projectile_Multimissile multi_west = new HackGameAgent_Projectile_Multimissile(board, HackGameAgent.MovementDirection.MovementDirection_West);
                board.AddAgent(multi_west);
            }
        }
Esempio n. 22
0
 public HackGameBoard_Scoring(HackGameBoard ourBoard)
 {
     board = ourBoard;
 }
Esempio n. 23
0
 public override void OnAgentEnter(HackGameAgent agent, HackGameBoard board, HackGameBoardElement_Node node)
 {
     if (agent is HackGameAgent_Player)
     {
         //YOU DID IT! EXIT!
         ((HackGameAgent_Player)agent).SetIsExiting();
         active = false;
     }
 }
Esempio n. 24
0
 /// <summary>
 /// Setup search
 /// </summary>
 /// <param name="mazeMap">Map to search</param>
 public void Initialize(HackGameBoard gameboard)
 {
     searchStatus = SearchStatus.Stopped;
     openList = new List<SearchNode>();
     closedList = new List<SearchNode>();
     paths = new Dictionary<Point, Point>();
     board = gameboard;
 }
Esempio n. 25
0
        public void UpdateState(GameTime time, HackGameBoard board)
        {
            if (timeBeforeStart > 0.0f)
                timeBeforeStart -= (float)time.ElapsedGameTime.TotalSeconds;

            if (timeBeforeStart <= 0.0f)
            {
                timeToLiveCurrent -= (float)time.ElapsedGameTime.TotalSeconds;

                float t = timeToLiveMax != 0.0f ? 1.0f - (timeToLiveCurrent / timeToLiveMax) : 0.0f;

                currentScale = startScale + ((endScale - startScale) * t);

                currentColor.R = (byte)(startColor.R + ((float)(endColor.R - startColor.R) * t));
                currentColor.G = (byte)(startColor.G + ((float)(endColor.G - startColor.G) * t));
                currentColor.B = (byte)(startColor.B + ((float)(endColor.B - startColor.B) * t));
                currentColor.A = (byte)(startColor.A + ((float)(endColor.A - startColor.A) * t));

                currentOffsetFromParent.X = startOffsetFromParent.X + ((endOffsetFromParent.X - startOffsetFromParent.X) * t);
                currentOffsetFromParent.Y = startOffsetFromParent.Y + ((endOffsetFromParent.Y - startOffsetFromParent.Y) * t);
            }
        }
Esempio n. 26
0
        public override void UpdateState(GameTime time, HackGameBoard board, HackGameBoardElement_Node node)
        {
            float floatt = (float)time.ElapsedGameTime.TotalSeconds;

            timeToNextPing -= floatt;
            if (timeToNextPing <= 0)
            {
                StartPing_Draw = true;
                timeToNextPing = timePerPing;
            }

            timeToNextFlash -= floatt;
            if (timeToNextFlash <= 0)
            {
                StartFlash_Draw = true;
                timeToNextFlash = timePerFlash;
            }

            if (lerp != null)
            {
                lerp.Update(time);
            }
        }
Esempio n. 27
0
 internal void LerpToCameraOffsetAndZoom(Vector2 newCam, float zoom, HackGameBoard hackGameBoard)
 {
     //TODO!
     throw new NotImplementedException();
 }
Esempio n. 28
0
 public abstract void OnAgentStay(HackGameAgent agent, HackGameBoard board, HackGameBoardElement_Node node);
Esempio n. 29
0
 public abstract void UpdateState(GameTime time, HackGameBoard board, HackGameBoardElement_Node node);
Esempio n. 30
0
        public void Wander_Update(GameTime time, HackGameBoard board)
        {
            if (this.getMovementDirection() != MovementDirection.MovementDirection_None)
            {
                setTtoDestination(getTtoDestination() + Wander_movementSpeed * (float)time.ElapsedGameTime.TotalSeconds * board.GetSpeedUpFactor());
            }

            else if (nextBoardElementDestinations.Count > 0)
            {
                setDestinationBoardLocation(nextBoardElementDestinations.Pop(), board);
            }

            else
            {
                // we are in the "arrived" sub-mode.
                switch (wanderSubState)
                {
                    case HackGameAgent_AI_Wander_SubState.HackGameAgent_AI_State_Wander_Substate_Ping:
                        Wander_Ping(board);
                        break;
                    case HackGameAgent_AI_Wander_SubState.HackGameAgent_AI_State_Wander_Substate_AnalyzePing:
                        Wander_AnalyzePing(board);
                        break;
                    case HackGameAgent_AI_Wander_SubState.HackGameAgent_AI_State_Wander_Substate_Loiter:
                        Wander_Loiter(board);
                        break;
                }
            }
        }