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); }
public override void UpdateState(GameTime time, HackGameBoard board, HackGameBoardElement_Node node) { if (lerp != null && lerp.IsAlive()) { lerp.Update(time); } pulseEffect.Update(time); if (!Empty && PlayerHacking != null && PlayerHacking.IsHacking() == true) { HackTimerRemaining -= (float)time.ElapsedGameTime.TotalSeconds * board.GetSpeedUpFactor(); float pctTiming = HackTimerMax != 0.0f ? 1.0f - (HackTimerRemaining / HackTimerMax) : 0.0f; board.SetHackLoopSoundAmountComplete(pctTiming); HackBackgroundTextUpdateTimer -= (float)time.ElapsedGameTime.TotalSeconds; if (HackBackgroundTextUpdateTimer <= 0) { HackBackgroundTextUpdateTimer = HackBackgroundTextUpdateTimerMax; //draw the right number of dots pctTiming = HackTimerMax != 0.0f ? 1.0f - (HackTimerRemaining / HackTimerMax) : 0.0f; int numdots = HackBackgroundMaxDrawDots - (int)((float)HackBackgroundMaxDrawDots * pctTiming);//blah hackbackgroundstringbuilder.Remove(0, hackbackgroundstringbuilder.Length); for(int i = 0; i < numdots; i++) { hackbackgroundstringbuilder.Append(board.r.NextDouble() > 0.5f ? '0' : '1'); } board.AddBackgroundTextStandard(new StringBuilder(hackbackgroundstringbuilder.ToString()), 0); //have to create a copy in order for it to be unique in the list } if (HackTimerRemaining <= 0.0f) { Empty = true; PlayerHacking.SetHacking(false); PlayerHacking.HackSuccess(); board.StopHackLoopSound(); board.PlayHackSuccessSound(); board.AwardNodeContents(this); //board.PopUpScoreboard(4.0f); board.AddBackgroundTextAward(new StringBuilder("CRACKER SUCCESSFUL"), 0); board.AddBackgroundTextAward(new StringBuilder("CONTENTS UNENCRYPTED"), 0.25f); board.AddBackgroundTextAward(new StringBuilder("DELETING TRACES"), 0.5f); } } }
public void AffectNearbyAIs(HackGameBoard board) { HackGameAgent[] agents = board.GetAgents(); for (int i = 0; i < agents.Length; i++) { if (agents[i] is HackGameAgent_AI && agents[i].GetCurrentState() == HackGameAgent_State.HackGameAgent_State_Active) { if ((agents[i].getCurrentBoardLocation() == getCurrentBoardLocation() && agents[i].getTtoDestination() < multimissileSplashDamageThreshhold) || (agents[i].getDestinationBoardLocation() == getCurrentBoardLocation() && agents[i].getTtoDestination() > 1.0 - multimissileSplashDamageThreshhold)) { agents[i].Kill(0); 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); } } } }