예제 #1
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;
     }
 }
예제 #2
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;
     }
 }
예제 #3
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);
            }
        }