Ejemplo n.º 1
0
        public override void DrawSelf(SpriteBatch sb, HackGameBoardElement_Node node, HackNodeGameBoardMedia gameboarddrawing, Vector2 Nodedrawpos, float zoom)
        {
            if (active)
            {
                if (StartPing_Draw)
                {
                    node.AddUIElement(gameboarddrawing.PingTexture, 1.5f, new Vector2(41.0f * zoom, 41.0f * zoom), new Vector2(41.0f * zoom, 41.0f * zoom), new Color(1.0f, 1.0f, 1.0f, 0.0f), new Color(0.0f, 0, 0, 0), 0.2f, 2.0f, 0.0f);
                    //gameboarddrawing.PlayerPingSound.Play();
                    StartPing_Draw = false;
                }
            }

                if (StartFlash_Draw)
                {
                    FlashNew();
                    StartFlash_Draw = false;
                }

            Vector2 newdrawpos = new Vector2(Nodedrawpos.X + (HackGameBoard.elementSize * zoom / 2.0f - HackGameBoard.elementSize * zoom * lerp.CurrentScale() / 2.0f), Nodedrawpos.Y);

            sb.Draw(gameboarddrawing.ExitTexture, newdrawpos + lerp.CurrentPosition() * zoom, null, lerp.CurrentColor(), 0, Vector2.Zero, zoom * lerp.CurrentScale(), SpriteEffects.None, 0);
        }
Ejemplo n.º 2
0
 public abstract void DrawBeingKilledState(HackNodeGameBoardMedia gameboarddrawing, SpriteBatch sb, Vector2 drawPos, float zoom);
Ejemplo n.º 3
0
        public override void DrawSelf(SpriteBatch sb, HackGameBoardElement_Node node, HackNodeGameBoardMedia gameboarddrawing, Vector2 Nodedrawpos, float zoom)
        {
            Color drawColor = Color.White;
            Texture2D tex = null;

            if (Empty)
            {
                drawColor = new Color(.05f, .05f, .05f);
            }

            switch(LootColor)
            {
                case HackGameBoardNodeContent_Loot_Color.HackGameBoardNodeContent_Loot_Color_Blue:
                    tex = gameboarddrawing.Loot_Blue_Texture;
                    break;

                case HackGameBoardNodeContent_Loot_Color.HackGameBoardNodeContent_Loot_Color_Black:
                    tex = gameboarddrawing.Loot_Black_Texture;
                    break;

                case HackGameBoardNodeContent_Loot_Color.HackGameBoardNodeContent_Loot_Color_Yellow:
                    tex = gameboarddrawing.Loot_Yellow_Texture;
                    break;
            }

            sb.Draw(tex, Nodedrawpos, null, drawColor, 0, Vector2.Zero, zoom, SpriteEffects.None, 0);

            //draw the 2x/4x
            if (valueMultiplier == 2.0f)
            {
                sb.Draw(gameboarddrawing.Loot_2x_Score_Texture, Nodedrawpos, null, drawColor, 0, Vector2.Zero, zoom * pulseEffect.CurrentScale(), SpriteEffects.None, 0);
            }

            else if (valueMultiplier == 4.0f)
            {
                sb.Draw(gameboarddrawing.Loot_4x_Score_Texture, Nodedrawpos, null, drawColor, 0, Vector2.Zero, zoom * pulseEffect.CurrentScale(), SpriteEffects.None, 0);
            }

            //draw the timing ring
            //0-10% - 0
            //11-35% - 1
            //36-60% - 2
            //61-85% - 3
            //86-100% - 4
            if (!Empty && PlayerHacking != null)
            {
                if (PlayerHacking.IsHacking() == true)
                {
                Texture2D timingTex = null;

                float pctTiming = HackTimerMax != 0.0f ? 1.0f - (HackTimerRemaining / HackTimerMax) : 0.0f;
                {
                    if (pctTiming <= .1f)
                    {
                        timingTex = gameboarddrawing.TimingRingEmpty;
                    }
                    else if (pctTiming > .1f && pctTiming <= .35f)
                    {
                        timingTex = gameboarddrawing.TimingRing1_4;
                    }
                    else if (pctTiming > .35f && pctTiming <= .60f)
                    {
                        timingTex = gameboarddrawing.TimingRing2_4;
                    }
                    else if (pctTiming > .60f && pctTiming <= .85f)
                    {
                        timingTex = gameboarddrawing.TimingRing3_4;
                    }
                    else if (pctTiming > .85f)
                    {
                        timingTex = gameboarddrawing.TimingRingComplete;
                    }
                }

                sb.Draw(timingTex, Nodedrawpos, null, Color.White, 0, Vector2.Zero, zoom, SpriteEffects.None, 0);

                }
            }

            //draw the $ amount
            if (!Empty)
            {

                drawOffsetX = (int)(HackGameBoard.elementSize * zoom / 2.0f - (gameboarddrawing.LootAmount_Font.MeasureString(valuestring.outputstring).X) * zoom / 2.0f);

                if (lerp != null && lerp.IsAlive())
                {
                    drawOffsetX = (int)(HackGameBoard.elementSize / 2.0f - (gameboarddrawing.LootAmount_Font.MeasureString(valuestring.outputstring).X * lerp.CurrentScale()) / 2.0f);
                    sb.DrawString(gameboarddrawing.LootAmount_Font, valuestring.outputstring, Nodedrawpos + new Vector2(drawOffsetX, -20.0f * zoom) + lerp.CurrentPosition(), lerp.CurrentColor(), 0, Vector2.Zero, lerp.CurrentScale() * zoom, SpriteEffects.None, 0);
                }

                else
                {
                    sb.DrawString(gameboarddrawing.LootAmount_Font, valuestring.outputstring, Nodedrawpos + new Vector2(drawOffsetX, -20.0f * zoom), Color.White, 0, Vector2.Zero, zoom, SpriteEffects.None, 1);
                }
            }
        }
Ejemplo n.º 4
0
 public override void DrawCurrentState(HackNodeGameBoardMedia gameboarddrawing, SpriteBatch sb, Vector2 drawPos, float zoom)
 {
     switch (GetCurrentState())
     {
         case HackGameAgent_State.HackGameAgent_State_SpawningIn:
             DrawSpawningInState(gameboarddrawing, sb, drawPos, zoom);
             break;
         case HackGameAgent_State.HackGameAgent_State_Active:
             DrawActiveState(gameboarddrawing, sb, drawPos, zoom);
             break;
         case HackGameAgent_State.HackGameAgent_State_BeingKilled:
             DrawBeingKilledState(gameboarddrawing, sb, drawPos, zoom);
             break;
     }
     base.DrawCurrentState(gameboarddrawing, sb, drawPos, zoom);
 }
Ejemplo n.º 5
0
        public void DrawSelf(HackNodeGameBoardMedia drawing, SpriteBatch spriteBatch, GraphicsDevice GraphicsDevice, HackGameAgent_Player player)
        {
            Vector2 offset = GetCurrentOffset();

            spriteBatch.Draw(drawing.LowerUI_Shell, DrawLocation_Shell + offset, Color.White);
            //spriteBatch.Draw(drawing.LowerUI_AlertShell, DrawLocation_AlertShell + offset, Color.White);
            //spriteBatch.Draw(drawing.LowerUI_BonusShell, DrawLocation_BonusShell + offset, Color.White);

            //Draw the numbers
            spriteBatch.DrawString(drawing.LowerUI_Score_Font, scorestring.outputstring, DrawLocation_ScoreText + offset, Color.Red);

            //Draw the alert lights
            //spriteBatch.Draw(AlertLightOne_Flash.IsOn() ? drawing.LowerUI_Alert_Light_On : drawing.LowerUI_Alert_Light_Off, DrawLocation_AlertLightOne + offset, Color.White);
            //spriteBatch.Draw(AlertLightTwo_Flash.IsOn() ? drawing.LowerUI_Alert_Light_On : drawing.LowerUI_Alert_Light_Off, DrawLocation_AlertLightTwo + offset, Color.White);
            //spriteBatch.Draw(AlertLightThree_Flash.IsOn() ? drawing.LowerUI_Alert_Light_On : drawing.LowerUI_Alert_Light_Off, DrawLocation_AlertLightThree + offset, Color.White);

            //Draw the target slice
            float currentTargetCompletion = 0.0f;
            if (board != null && board.GetTargetCashToExit() > 0)
            {
                currentTargetCompletion = (float)((double)(GetScore()) / (double)(board.GetTargetCashToExit()));
            }

            Texture2D chosenTargetSprite;
            if (currentTargetCompletion >= 1.0f)
            {
                chosenTargetSprite = drawing.TargetSlice_100_Percent;
            }
            else if (currentTargetCompletion >= 0.75f)
            {
                chosenTargetSprite = drawing.TargetSlice_75_Percent;
            }
            else if (currentTargetCompletion >= 0.50f)
            {
                chosenTargetSprite = drawing.TargetSlice_50_Percent;
            }
            else if (currentTargetCompletion >= 0.25f)
            {
                chosenTargetSprite = drawing.TargetSlice_25_Percent;
            }
            else
            {
                chosenTargetSprite = drawing.TargetSlice_0_Percent;
            }

            if (chosenTargetSprite != null)
            {
                spriteBatch.Draw(chosenTargetSprite, DrawLocation_TargetSlices + offset, Color.White);
            }
        }
Ejemplo n.º 6
0
 private void DrawBeingKilledState(HackNodeGameBoardMedia gameboarddrawing, SpriteBatch sb, Vector2 drawPos, float zoom)
 {
     gameboarddrawing.explosion.AddParticles(drawPos + new Vector2(41.0f * zoom, 41.0f * zoom), Vector2.Zero);
     gameboarddrawing.AIDeathParticles.AddParticles(drawPos + new Vector2(41.0f * zoom, 41.0f * zoom), Vector2.Zero);
     gameboarddrawing.ExplosionSound.Play();
     SetToRemove();
 }
Ejemplo n.º 7
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;
                }
            }
        }
Ejemplo n.º 8
0
 public override void DrawActiveState(HackNodeGameBoardMedia gameboarddrawing, SpriteBatch sb, Vector2 drawPos, float zoom)
 {
     sb.Draw(gameboarddrawing.ProjectileTexture, drawPos + lerp.CurrentPosition(), null, lerp.CurrentColor(), 0.0f, Vector2.Zero, zoom * lerp.CurrentScale(), SpriteEffects.None, 0);
 }
Ejemplo n.º 9
0
 public override void UpdateActiveState(GameTime time, HackGameBoard board, HackNodeGameBoardMedia drawing)
 {
     lerp.Update(time);
         if (!lerp.IsAlive())
         {
             //it has landed. create an explosion and hurt stuff.
             AffectNearbyAIs(ourBoard);
             Kill(0);
         }
 }
Ejemplo n.º 10
0
 public override void DrawBeingKilledState(HackNodeGameBoardMedia gameboarddrawing, SpriteBatch sb, Vector2 drawPos, float zoom)
 {
     //nothing
 }
Ejemplo n.º 11
0
        public override void UpdateActiveState(GameTime time, HackGameBoard board, HackNodeGameBoardMedia drawing)
        {
            lerp.Update(time);
            if (!lerp.IsAlive())
            {
                int totalspawned = 0;
                //spawn all the awesome fragments.
                foreach (Point p in mortarFragmentTargets)
                {
                    Point destinationPoint = new Point(currentBoardElementLocation.X + p.X, currentBoardElementLocation.Y + p.Y);
                    if (ourBoard != null && ourBoard.IsNodeAlive(ourBoard, destinationPoint))
                    {
                        HackGameBoardElement el = ourBoard.GetElementAtPoint(destinationPoint);
                        if (el.type == HackGameBoardElementBaseType.HackGameBoardElementBaseType_Node ||
                            el.type == HackGameBoardElementBaseType.HackGameBoardElementBaseType_Bridge_EW ||
                            el.type == HackGameBoardElementBaseType.HackGameBoardElementBaseType_Bridge_NS)
                        {
                            //fire off a mortar fragment at this node
                            HackGameAgent_Projectile_MortarFragment fragment = new HackGameAgent_Projectile_MortarFragment(board, destinationPoint, MathHelper.Lerp(fragmentFallTimeStartMin, fragmentFallTimeStartMax, (float)ourBoard.r.NextDouble()));
                            board.AddAgent(fragment);
                            totalspawned++;
                        }
                    }
                }

                if (totalspawned > 0)
                {
                    board.GetMedia().MortarFallSound.Play();
                }

                Kill(0);
            }
        }
Ejemplo n.º 12
0
 public override void UpdateActiveState(GameTime time, HackGameBoard board, HackNodeGameBoardMedia drawing)
 {
     pingTimer.Update(time);
     if (!pingTimer.IsAlive())
     {
         pingTimer.Reset(heatseeker_pingTime);
         playPing = true;
     }
     if (this.getMovementDirection() != MovementDirection.MovementDirection_None)
     {
         setTtoDestination(getTtoDestination() + heatseeker_movementSpeed * (float)time.ElapsedGameTime.TotalSeconds * board.GetSpeedUpFactor());
     }
     else if (nextBoardElementDestinations.Count > 0)
     {
         setDestinationBoardLocation(nextBoardElementDestinations.Pop(), board);
     }
 }
Ejemplo n.º 13
0
 public override void DrawActiveState(HackNodeGameBoardMedia gameboarddrawing, SpriteBatch sb, Vector2 drawPos, float zoom)
 {
     if (playPing)
     {
         playPing = false;
         AddUIElement(gameboarddrawing.PingTexture, 0.25f, new Vector2(41.0f, 41.0f), new Vector2(41.0f, 41.0f), new Color(1.0f, 0.4f, 0, 0.0f), new Color(0.0f, 0, 0, 0), 0.2f, 0.8f, 0.0f);
         gameboarddrawing.ProximityAlertSound.Play();
     }
     sb.Draw(gameboarddrawing.ProjectileTexture, drawPos, null, Color.White, 0.0f, Vector2.Zero, zoom, SpriteEffects.None, 0);
 }
Ejemplo n.º 14
0
 public abstract void UpdateActiveState(GameTime time, HackGameBoard board, HackNodeGameBoardMedia drawing);
Ejemplo n.º 15
0
        public override void UpdateState(GameTime time, HackGameBoard board, HackNodeGameBoardMedia drawing)
        {
            switch (GetCurrentState())
            {
                case HackGameAgent_State.HackGameAgent_State_SpawningIn:
                    UpdateSpawningInState(time, board, drawing);
                    break;
                case HackGameAgent_State.HackGameAgent_State_Active:
                    UpdateActiveState(time, board, drawing);
                    break;
            }

            base.UpdateState(time, board, drawing);
        }
Ejemplo n.º 16
0
 private void UpdateSpawningInState(GameTime time, HackGameBoard board, HackNodeGameBoardMedia drawing)
 {
     timeToStart -= (float)time.ElapsedGameTime.TotalSeconds;
         if (timeToStart <= 0)
         {
             SetCurrentState(HackGameAgent_State.HackGameAgent_State_Active);
         }
 }
Ejemplo n.º 17
0
        private void DrawActiveState(HackNodeGameBoardMedia gameboarddrawing, SpriteBatch sb, Vector2 drawPos, float zoom)
        {
            //because we have to rotate these guys using a center origin,
            //we have to apply a backward draw shift.
            Vector2 scaleVector = Vector2.Zero;
            scaleVector.X += drawPos.X + 40.0f * zoom;
            scaleVector.Y += drawPos.Y + 40.0f * zoom;

            float rotation = 0.0f; //default north
            switch (this.getStoredMovementDirection())
            {
                case MovementDirection.MovementDirection_South:
                    rotation = MathHelper.ToRadians(180.0f);
                    break;
                case MovementDirection.MovementDirection_West:
                    rotation = MathHelper.ToRadians(270.0f);
                    break;
                case MovementDirection.MovementDirection_East:
                    rotation = MathHelper.ToRadians(90.0f);
                    break;
                default:
                    break;
            }
            sb.Draw(gameboarddrawing.AITexture, scaleVector, null, Color.White, rotation, new Vector2(40.0f, 40.0f), zoom, SpriteEffects.None, 0);

            if (StartPing_Draw)
            {
                AddUIElement(gameboarddrawing.PingTexture, 1.0f, new Vector2(41.0f, 41.0f), new Vector2(41.0f, 41.0f), new Color(1.0f, 0.0f, 0, 0.0f), new Color(0.0f, 0, 0, 0), 0.2f, 1.5f, 0.0f);
                StartPing_Draw = false;
            }
        }
Ejemplo n.º 18
0
 public override void DrawActiveState(HackNodeGameBoardMedia gameboarddrawing, SpriteBatch sb, Vector2 drawPos, float zoom)
 {
     sb.Draw(gameboarddrawing.ProjectileTexture, drawPos, null, Color.White, 0.0f, Vector2.Zero, zoom, SpriteEffects.None, 0);
 }
Ejemplo n.º 19
0
        private void DrawSpawningInState(HackNodeGameBoardMedia gameboarddrawing, SpriteBatch sb, Vector2 drawPos, float zoom)
        {
            if (spawnInData.StartSpawnSound)
            {
                gameboarddrawing.WhooshSound.Play();
                spawnInData.StartSpawnSound = false;
            }
            if (spawnInData.DrawImpact)
            {
                AddUIElement(gameboarddrawing.PingTexture, 1.0f, new Vector2(41.0f * zoom, 41.0f * zoom), new Vector2(41.0f * zoom, 41.0f * zoom), new Color(1.0f, 0.0f, 0, 0.0f), new Color(0.0f, 0, 0, 0), 0.2f, 2.5f, 0.0f);
                spawnInData.DrawImpact = false;
                gameboarddrawing.ThumpSound.Play();
            }

            if (spawnInData.flashing)
            {
                if (spawnInData.dropInFlash.IsOn())
                {
                    sb.Draw(gameboarddrawing.AITexture, drawPos, null, Color.White, 0.0f, Vector2.Zero, zoom, SpriteEffects.None, 0);
                }
            }

            else
            {
                sb.Draw(gameboarddrawing.AITexture, drawPos, null, Color.White, 0.0f, Vector2.Zero, zoom * spawnInData.dropInLerp.CurrentScale(), SpriteEffects.None, 0);
            }
        }
Ejemplo n.º 20
0
 public override void DrawBeingKilledState(HackNodeGameBoardMedia gameboarddrawing, SpriteBatch sb, Vector2 drawPos, float zoom)
 {
     if (killEffectPlayed == false)
     {
         killEffectPlayed = true;
         gameboarddrawing.explosion.AddParticles(drawPos + new Vector2(41.0f * zoom, 41.0f * zoom), Vector2.Zero);
         gameboarddrawing.ExplosionSound.Play();
         SetToRemove();
     }
 }
Ejemplo n.º 21
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);
             }
         }
     }
 }
Ejemplo n.º 22
0
 public override void UpdateActiveState(GameTime time, HackGameBoard board, HackNodeGameBoardMedia drawing)
 {
     if (this.getMovementDirection() != MovementDirection.MovementDirection_None)
     {
         setTtoDestination(getTtoDestination() + multimissile_movementSpeed * (float)time.ElapsedGameTime.TotalSeconds * board.GetSpeedUpFactor());
     }
     else if (nextBoardElementDestinations.Count > 0)
     {
         setDestinationBoardLocation(nextBoardElementDestinations.Pop(), board);
     }
 }
Ejemplo n.º 23
0
 public void DrawSelf(HackNodeGameBoardMedia drawing, SpriteBatch spriteBatch, GraphicsDevice GraphicsDevice, HackGameAgent_Player player)
 {
     if (newlyactive)
     {
         newlyactive = false;
         active = true;
         currentTickerPos = GraphicsDevice.Viewport.Width - tickerCharWidth;
         stringDrawLength = drawing.Ticker_Font.MeasureString(currentTicker).X;
         if (!overriding && newActiveTime <= 0)
         {
             drawing.StartMessageSound();
         }
     }
     if (active)
     {
         //Draw the ticker
         spriteBatch.DrawString(drawing.Ticker_Font, currentTicker, new Vector2(currentTickerPos, drawLocationY), Color.Red);
     }
 }
Ejemplo n.º 24
0
 private void DrawActiveState(HackNodeGameBoardMedia gameboarddrawing, SpriteBatch sb, Vector2 drawPos, float zoom)
 {
     if (visible)
     {
         sb.Draw(drawTexture, drawPos + new Vector2(41.0f * zoom, 41.0f * zoom), null, new Color(alphaLevel, alphaLevel, alphaLevel), 0.0f, new Vector2(41.0f, 41.0f), zoom * specialZoom, SpriteEffects.None, 0);
     }
 }
Ejemplo n.º 25
0
 public abstract void DrawSelf(SpriteBatch sb, HackGameBoardElement_Node node, HackNodeGameBoardMedia gameboarddrawing, Vector2 Nodedrawpos, float zoom);
Ejemplo n.º 26
0
 private void DrawSpawningInState(HackNodeGameBoardMedia gameboarddrawing, SpriteBatch sb, Vector2 drawPos, float zoom)
 {
     if (visible)
     {
         sb.Draw(drawTexture, drawPos, null, new Color(alphaLevel, alphaLevel, alphaLevel), 0.0f, Vector2.Zero, zoom * specialZoom, SpriteEffects.None, 0);
     }
 }
Ejemplo n.º 27
0
        public override void DrawSelf(SpriteBatch sb, HackGameBoardElement_Node node, HackNodeGameBoardMedia gameboarddrawing, Vector2 Nodedrawpos, float zoom)
        {
            if (drawFire == true)
            {
                drawFire = false;
                node.AddUIElement(gameboarddrawing.WeaponPingTexture, 0.75f, new Vector2(41.0f * zoom, 41.0f * zoom), new Vector2(41.0f * zoom, 41.0f * zoom), new Color(1.0f, 0.4f, 0.0f, 0.0f), new Color(1.0f, 1.0f, 0.0f, 0.0f), 0.2f, 4.0f, 0.0f);
                gameboarddrawing.MissileLaunchSound.Play();
            }

            if (!fired)
            {
                sb.Draw(gameboarddrawing.Weapon_Multimissile_texture, Nodedrawpos + new Vector2(40.0f * zoom, 40.0f * zoom), null, Color.White, 0, new Vector2(40.0f, 40.0f), pulseEffect.CurrentScale() * zoom, SpriteEffects.None, 0);
            }
        }
Ejemplo n.º 28
0
        public virtual void UpdateState(GameTime time, HackGameBoard board, HackNodeGameBoardMedia drawing)
        {
            if (killTimer != null && killTimer.IsAlive())
            {
                killTimer.Update(time);
                if (!killTimer.IsAlive())
                {
                    SetCurrentState(HackGameAgent_State.HackGameAgent_State_BeingKilled);
                }
            }

            if (justStaying == true)
            {
                justStaying = false;
                HackGameBoardElement element = board.GetElementAtPoint(currentBoardElementLocation);
                if (element.type == HackGameBoardElementBaseType.HackGameBoardElementBaseType_Node)
                {
                    ((HackGameBoardElement_Node)(element)).OnAgentStay(this, board);
                }
            }

            if (justLeaving == true)
            {
                justLeaving = false;
                justStaying = false;
                HackGameBoardElement element = board.GetElementAtPoint(justLeavingNode);
                if (element.type == HackGameBoardElementBaseType.HackGameBoardElementBaseType_Node)
                {
                    ((HackGameBoardElement_Node)(element)).OnAgentExit(this, board);
                }
            }
            if (justArrived == true)
            {
                justArrived = false;
                justStaying = true;
                HackGameBoardElement element = board.GetElementAtPoint(currentBoardElementDestination);
                if (element.type == HackGameBoardElementBaseType.HackGameBoardElementBaseType_Node)
                {
                    ((HackGameBoardElement_Node)(element)).OnAgentEnter(this, board);
                }
                //kill self if on a lethal node
                if (element.IsLethal())
                {
                    Kill(0);
                }
            }

            //ui
            for (int i = 0; i < agentUISprites.Count; i++)
            {
                agentUISprites[i].UpdateState(time, board);
                if (!agentUISprites[i].Alive())
                {
                    agentUISprites.RemoveAt(i);
                }
            }

            //do not allow storedMovementDirection to "snap" north when an AI is at a destination
            MovementDirection currentMovementDirection = getMovementDirection();
            if (currentMovementDirection != MovementDirection.MovementDirection_None)
            {
                storedMovementDirection = getMovementDirection();
            }

            //update any trails
            if (trails != null && trails.Count > 1)
            {
                for (int i = trails.Count - 1; i > 0; i--)
                {
                    trails[i].SetToOtherAgentData(trails[i - 1]);
                }
            }
            if (trails != null && trails.Count > 0)
            {
                if (this is HackGameAgent_Player)
                {
                    trails[0].SetToPlayerData((HackGameAgent_Player)(this));
                }
                else
                {
                    trails[0].SetToOtherAgentData(this);
                }
            }
        }
Ejemplo n.º 29
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;
        }
Ejemplo n.º 30
0
        private void UpdateSpawningInState(GameTime time, HackGameBoard board, HackNodeGameBoardMedia drawing)
        {
            spawnInData.totalTimer -= (float)time.ElapsedGameTime.TotalSeconds;
            if (spawnInData.totalTimer <= 0)
            {
                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.AddBackgroundTextStandard(new StringBuilder("ACTIVATING ALL SYSTEMS"), 0);
                        board.AddBackgroundTextStandard(new StringBuilder("HACK SENSORS [OK]"), 1);
                        board.AddBackgroundTextStandard(new StringBuilder("HACK ATTACK [OK]"), 0.25f);
                        board.AddBackgroundTextStandard(new StringBuilder("HACK UNIT [OK]"), 0.25f);
                        board.AddBackgroundTextStandard(new StringBuilder("HACK SWEEP [OK]"), 0.25f);
                        board.AddBackgroundTextStandard(new StringBuilder("HACK TORPEDO [OK]"), 0.25f);
                        board.AddBackgroundTextStandard(new StringBuilder("HACK SENSORS [OK]"), 0.50f);
                        board.AddBackgroundTextStandard(new StringBuilder("HACK ATTACK [OK]"), 0.25f);
                        board.AddBackgroundTextStandard(new StringBuilder("HACK UNIT [OK]"), 0.25f);
                        board.AddBackgroundTextStandard(new StringBuilder("HACK SWEEP [OK]"), 0.25f);
                        board.AddBackgroundTextNewline(1.0f);
                        for (int i = 0; i < 10; i++)
                        {
                            board.AddBackgroundTextNewline(0.1f);
                        }
                        board.AddBackgroundTextStandard(new StringBuilder("ALL SYSTEMS GO!"), 0.5f);
                    }
                }
            }
        }