/// <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; }
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); } }
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); } }
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); } }