Beispiel #1
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;
     }
 }
Beispiel #2
0
 public override void OnAgentEnter(HackGameAgent agent, HackGameBoard board, HackGameBoardElement_Node node)
 {
     if (!fired && agent is HackGameAgent_Player)
     {
         fired = true;
         drawFire = true;
     }
 }
Beispiel #3
0
 public abstract void OnAgentStay(HackGameAgent agent, HackGameBoard board, HackGameBoardElement_Node node);
Beispiel #4
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;
     }
 }
Beispiel #5
0
        public override void HasCollidedWith(HackGameAgent otherAgent, HackGameBoard board)
        {
            /*
            //DEBUG! If player hits an AI, kill it!
            if (otherAgent is HackGameAgent_AI)
            {
                //GET HIM!
                otherAgent.Kill();
            }
             */

            if (otherAgent is HackGameAgent_AI)
            {
                this.Kill(0); //I'M DEAD!
            }
        }
Beispiel #6
0
        public override void EnteringNewState(HackGameAgent.HackGameAgent_State oldState, HackGameAgent.HackGameAgent_State newState)
        {
            if (newState == HackGameAgent_State.HackGameAgent_State_SpawningIn && oldState == HackGameAgent_State.HackGameAgent_State_Inactive)
            {
                spawnInData = new HackGameAgent_AI_StateData_SpawningIn();
            }

            if (newState == HackGameAgent_State.HackGameAgent_State_Active)
            {
                collapseTimer = new HackGameTimer(collapseTimeSeconds);
                activeFlasher = new FlashingElement(0.3f, true, FlashingElement.FlashingElement_OperationType.FlashingElement_OperationType_Normal);
                timerString = new StringBuilder();
                UpdateTimerString();
            }
        }
Beispiel #7
0
 public override void EnteringNewState(HackGameAgent.HackGameAgent_State oldState, HackGameAgent.HackGameAgent_State newState)
 {
 }
Beispiel #8
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;
     }
 }
Beispiel #9
0
        public override void HasCollidedWith(HackGameAgent otherAgent, HackGameBoard board)
        {
            if (otherAgent is HackGameAgent_AI && IsActive() && otherAgent.IsActive())
            {
                //KABOOM!
                otherAgent.Kill(0);
                //DON'T KILL SELF, KEEP GOING
                board.AddBackgroundTextAward(new StringBuilder("000000 000000 000000 00  00"), 0);
                board.AddBackgroundTextAward(new StringBuilder("0    0 0    0 0    0 0 00 0"), 0.1f);
                board.AddBackgroundTextAward(new StringBuilder("00000  0    0 0    0 0    0"), 0.1f);
                board.AddBackgroundTextAward(new StringBuilder("0    0 0    0 0    0 0    0"), 0.1f);
                board.AddBackgroundTextAward(new StringBuilder("000000 000000 000000 0    0"), 0.1f);
            }

            base.HasCollidedWith(otherAgent, board);
        }
Beispiel #10
0
        public virtual bool IsCollidingWith(HackGameAgent otherAgent)
        {
            if (otherAgent == this)
            {
                return false;
            }

            if (!this.IsActive() || !otherAgent.IsActive())
            {
                return false;
            }

            else
            {
                //start with the simplest case
                if (this.getMovementDirection() == MovementDirection.MovementDirection_None && otherAgent.getMovementDirection() == MovementDirection.MovementDirection_None
                    && this.currentBoardElementLocation == otherAgent.currentBoardElementLocation)
                {
                    return true;

                }
                else if (otherAgent.getMovementDirection() == MovementDirection.MovementDirection_None)
                {
                    //he's stationary, we just need to see if we're imminent to him and our distance to him is in tolerance
                    if (this.getMovementDirection() != MovementDirection.MovementDirection_None &&
                        this.currentBoardElementDestination == otherAgent.currentBoardElementLocation &&
                        this.getTtoDestination() > 1.0 - HackGameAgent.CollideTWindow)
                    {
                        return true;
                    }
                    return false;

                }
                else if (this.getMovementDirection() == MovementDirection.MovementDirection_None)
                {
                    //we're stationary, we just need to see if he's imminent to use and his distance to us is in tolerance
                    if (otherAgent.getMovementDirection() != MovementDirection.MovementDirection_None &&
                        otherAgent.currentBoardElementDestination == this.currentBoardElementLocation &&
                        otherAgent.getTtoDestination() > 1.0 - HackGameAgent.CollideTWindow)
                    {
                        return true;
                    }
                    return false;
                }
                else
                {
                    //well, we're both moving.
                    //so - if source and destination are both the same..
                    if (this.getCurrentBoardLocation() == otherAgent.getCurrentBoardLocation() &&
                        this.getDestinationBoardLocation() == otherAgent.getDestinationBoardLocation())
                    {
                        if (Math.Abs(this.getTtoDestination() - otherAgent.getTtoDestination()) < HackGameAgent.CollideTWindow)
                        {
                            return true;
                        }
                        return false;
                    }

                    //if we're coming from different places but destination is the same...
                    else if (this.getDestinationBoardLocation() == otherAgent.getDestinationBoardLocation())
                    {
                        //then two things must be true - we must each be w/in threshhold of destination and of each other.
                        if (this.getTtoDestination() < HackGameAgent.CollideTWindowCrossing && otherAgent.getTtoDestination() < HackGameAgent.CollideTWindowCrossing &&
                            Math.Abs(this.getTtoDestination() - otherAgent.getTtoDestination()) < HackGameAgent.CollideTWindowCrossing)
                        {
                            return true;
                        }
                        return false;

                    }

                    //if we're "swapping places" - a head-on collision
                    else if (this.getDestinationBoardLocation() == otherAgent.getCurrentBoardLocation() &&
                        otherAgent.getDestinationBoardLocation() == this.getCurrentBoardLocation())
                    {
                        //now you have to measure your T vs his 1.0 - T.
                        float fixedT = 1.0f - otherAgent.getTtoDestination();
                        if (Math.Abs(this.getTtoDestination() - fixedT) < HackGameAgent.CollideTWindow)
                        {
                            return true;
                        }
                        return false;
                    }

                    else
                    {
                        return false;
                    }
                }
            }
        }
Beispiel #11
0
 public virtual void HasCollidedWith(HackGameAgent otherAgent, HackGameBoard board)
 {
     //do nothing.
 }
Beispiel #12
0
        private void AlignToTarget(HackGameAgent target, HackGameBoard ourBoard)
        {
            if (target == null || !target.IsActive())
            {
                //WACKY MISSILE!
                target = null;
                SetRandomDestination(ourBoard);
            }
            else
            {
                //easy case - enemy is going to be at a node as his next immediate destination
                if (ourBoard.GetElementAtPoint(target.getDestinationBoardLocation()).type == HackGameBoardElementBaseType.HackGameBoardElementBaseType_Node)
                {
                    TryDestination(target.getDestinationBoardLocation(), ourBoard);
                }

                //harder case - enemy is on a bridge somewhere, not immediately headed for a node
                else
                {
                    //you need to find the target's next NODE it's going to hit.
                    bool found = false;
                    Stack<Point> nextDestinations = target.GetNextDestinations();
                    foreach (Point p in nextDestinations.Reverse())
                    {
                        if (ourBoard.GetElementAtPoint(p).type == HackGameBoardElementBaseType.HackGameBoardElementBaseType_Node)
                        {
                            TryDestination(p, ourBoard);
                            found = true;
                            break;
                        }
                    }
                    if (!found)
                    {
                        //WACKY MISSILE!
                        target = null;
                        SetRandomDestination(ourBoard);
                    }
                }
            }
        }
Beispiel #13
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);
 }
Beispiel #14
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);
            }
        }
Beispiel #15
0
        public void SetToOtherAgentData(HackGameAgent otherAgent)
        {
            this.setCurrentBoardLocation(otherAgent.getCurrentBoardLocation(), gameboard);
            this.setDestinationBoardLocation(otherAgent.getDestinationBoardLocation(), gameboard);
            this.setTtoDestination(otherAgent.getTtoDestination());
            this.SetCurrentState(otherAgent.GetCurrentState());

            if (otherAgent is HackGameAgent_Trail)
            {
                this.specialZoom = ((HackGameAgent_Trail)(otherAgent)).specialZoom;
            }
        }
Beispiel #16
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);
            }
        }
Beispiel #17
0
 public override void EnteringNewState(HackGameAgent.HackGameAgent_State oldState, HackGameAgent.HackGameAgent_State newState)
 {
     if (newState == HackGameAgent_State.HackGameAgent_State_SpawningIn && oldState == HackGameAgent_State.HackGameAgent_State_Inactive)
     {
         spawnInData = new HackGameAgent_AI_StateData_SpawningIn();
     }
 }
Beispiel #18
0
 public override void OnAgentExit(HackGameAgent agent, HackGameBoard board, HackGameBoardElement_Node node)
 {
 }
Beispiel #19
0
        public override void EnteringNewState(HackGameAgent.HackGameAgent_State oldState, HackGameAgent.HackGameAgent_State newState)
        {
            if (newState == HackGameAgent_State.HackGameAgent_State_SpawningIn && oldState == HackGameAgent_State.HackGameAgent_State_Inactive)
            {
                spawnInData = new HackGameAgent_Player_StateData_SpawningIn();
            }

            if (newState == HackGameAgent_State.HackGameAgent_State_ExitingOut)
            {
                exitOutData = new HackGameAgent_Player_StateData_ExitingOut();
            }
        }