示例#1
0
 public HackGameAgent_Projectile_Multimissile(HackGameBoard b, MovementDirection fireDirection)
     : base(b)
 {
     killTimer = new HackGameTimer(lifeTimeMultimissile);
     ourBoard = b;
     setCurrentBoardLocation(ourBoard.GetPlayer().getCurrentBoardLocation(), b);
     //set direction
     permanentDirection = fireDirection;
     SetCurrentState(HackGameAgent_State.HackGameAgent_State_Active);
     if (!ChooseNextPoint())
     {
         SetToRemove();
     }
 }
示例#2
0
 public HackGameAgent_Projectile_Mortar(HackGameBoard b)
     : base(b)
 {
     ourBoard = b;
     setCurrentBoardLocation(ourBoard.GetPlayer().getCurrentBoardLocation(), b);
     SetCurrentState(HackGameAgent_State.HackGameAgent_State_Active);
     lerp = new HackGameForwardLerpDrawHelper(
         lerpOutTime, 1.0f, 10.0f, lerpOutTime, Color.White, Color.White, lerpOutTime, Vector2.Zero, Vector2.Zero, lerpOutTime);
 }
示例#3
0
 public HackGameAgent_Projectile_Heatseeker(HackGameBoard b)
     : base(b)
 {
     killTimer = new HackGameTimer(lifeTimeHeatseeker);
     ourBoard = b;
     setCurrentBoardLocation(ourBoard.GetPlayer().getCurrentBoardLocation(), b);
     //pick closest target
     target = PickClosestTarget(ourBoard);
     AlignToTarget(target, ourBoard);
     SetCurrentState(HackGameAgent_State.HackGameAgent_State_Active);
     pingTimer = new HackGameTimer(heatseeker_pingTime);
 }
示例#4
0
        private HackGameAgent PickClosestTarget(HackGameBoard ourBoard)
        {
            int maxdistance = int.MaxValue;
            int checkdist = 0;
            HackGameAgent currentTarget = null;
            Point playerLoc = ourBoard.GetPlayer().getCurrentBoardLocation();

            HackGameAgent[] targets = ourBoard.GetAgents();
            for (int i = 0; i < targets.Length; i++)
            {
                if (targets[i] is HackGameAgent_AI)
                {
                    checkdist = GetLengthToDestination(getCurrentBoardLocation(), targets[i].getCurrentBoardLocation(), ourBoard);
                    if (checkdist != -1 && checkdist < maxdistance)
                    {
                        maxdistance = checkdist;
                        currentTarget = targets[i];
                    }
                }
            }

            return currentTarget;
        }
示例#5
0
        private void UpdateExitingOutState(GameTime time, HackGameBoard board, HackNodeGameBoardMedia drawing)
        {
            if (exitOutData.Starting)
            {
                exitOutData.Starting = false;
                exitOutData.StartSpawnSound = true;
                Vector2 newCam = board.GetCameraOffsetToCenterOnElement(getCurrentBoardLocation(), board.GetScreen().GetCamera().GetCameraZoom(), board.GetGame().GraphicsDevice);
                board.GetScreen().GetCamera().SetCameraOffsetAndZoom(newCam, board.GetScreen().GetCamera().GetCameraZoom(), board);
                board.GetScreen().LockCamera();
                board.SetKilledAnim(board.GetPlayer().getCurrentBoardLocation());
                board.ClearBackgroundTextPending();
                board.FadeOutBackgroundText(3.0f);
                board.FreezeCollapseTimer();
                board.ticker.ClearOverride();
            }
            exitOutData.totalTimer -= (float)time.ElapsedGameTime.TotalSeconds;
            if (exitOutData.totalTimer <= 0)
            {
                SetCurrentState(HackGameAgent_State.HackGameAgent_State_Exited);

            }
            else
            {
                if (exitOutData.lerping)
                {
                    exitOutData.flyOutLerp.Update(time);
                }
                else
                {
                    exitOutData.flyOutFlash.Update(time);
                    exitOutData.flashTimer.Update(time);
                    if (!exitOutData.flashTimer.IsAlive())
                    {
                        exitOutData.StartLerping();
                        board.KillAllAI();
                        board.StartExitEffect();
                        exitOutData.DrawImpact = true;
                        exitOutData.StartSpawnSound = true;
                        board.EndCollapse();
                    }

                }
            }
        }