protected bool ShouldUseMine(ManagerHelper mH) { if (mH.GetGametype() is CaptureTheFlag) { CaptureTheFlag tempGametype = (CaptureTheFlag)mH.GetGametype(); if (tempGametype.GetEnemyBase(affiliation).GetMyFlag().GetCaptor() == this) { return(true); } } else if (mH.GetGametype() is Assault) { Assault tempGametype = (Assault)mH.GetGametype(); if (tempGametype.GetAttacker() == affiliation && tempGametype.GetEnemyBase(affiliation).GetMyFlag().GetCaptor() == this) { return(true); } } else if (mH.GetGametype() is Conquest) { Conquest tempGametype = (Conquest)mH.GetGametype(); foreach (ConquestBase point in tempGametype.GetBases()) { if (point.affiliation != affiliation && PathHelper.DistanceSquared(GetOriginPosition(), point.GetOriginPosition()) < awareness * awareness) { return(true); } } } else if (mH.GetGametype() is Deathmatch) { Deathmatch tempGametype = (Deathmatch)mH.GetGametype(); foreach (Claimable claimable in tempGametype.GetClaimables()) { if (PathHelper.DistanceSquared(GetOriginPosition(), claimable.GetOriginPosition()) < awareness * awareness) { return(true); } } } //Default int numEnemies = 0; foreach (NPC agent in mH.GetNPCManager().GetNPCs()) { if (agent.GetAffiliation() != affiliation && NPCManager.IsNPCInRadius(agent, GetOriginPosition(), awareness)) { numEnemies++; } } return(numEnemies > 2); }
public void GenerateWinnerString() { NPC.AffliationTypes secondaryWinner = NPC.AffliationTypes.red; if (result.GetManagerHelper().GetGametype() is Assasssins) { Assasssins gametypeWinner = (Assasssins)result.GetManagerHelper().GetGametype(); NPC.AffliationTypes winner = gametypeWinner.GetWinner(); secondaryWinner = result.GetManagerHelper().GetGametype().GetSecondaryWinner(winner); switch (winner) { case NPC.AffliationTypes.red: winnerString = "Mustachio "; winnerFrameLeft = RED_INDEX; break; case NPC.AffliationTypes.blue: winnerString = "Aquoes "; winnerFrameLeft = BLUE_INDEX; break; case NPC.AffliationTypes.green: winnerString = "Terron "; winnerFrameLeft = GREEN_INDEX; break; case NPC.AffliationTypes.yellow: winnerString = "Dian "; winnerFrameLeft = YELLOW_INDEX; break; case NPC.AffliationTypes.same: winnerString = "Tie Game "; winnerSpriteRight = null; winnerSpriteLeft = null; break; } } else if (result.GetManagerHelper().GetGametype() is Assault) { Assault gametypeWinner = (Assault)result.GetManagerHelper().GetGametype(); NPC.AffliationTypes winner = gametypeWinner.GetWinnerEnd(); secondaryWinner = result.GetManagerHelper().GetGametype().GetSecondaryWinner(winner); switch (winner) { case NPC.AffliationTypes.red: winnerString = "Red Team "; winnerFrameLeft = RED_INDEX; break; case NPC.AffliationTypes.blue: winnerString = "Blue Team "; winnerFrameLeft = BLUE_INDEX; break; case NPC.AffliationTypes.green: winnerString = "Green Team "; winnerFrameLeft = GREEN_INDEX; break; case NPC.AffliationTypes.yellow: winnerString = "Yellow Team "; winnerFrameLeft = YELLOW_INDEX; break; case NPC.AffliationTypes.same: winnerString = "Tie Game "; winnerSpriteRight = null; winnerSpriteLeft = null; break; } } else if (result.GetManagerHelper().GetGametype() is CaptureTheFlag) { CaptureTheFlag gametypeWinner = (CaptureTheFlag)result.GetManagerHelper().GetGametype(); NPC.AffliationTypes winner = gametypeWinner.GetWinner(); secondaryWinner = result.GetManagerHelper().GetGametype().GetSecondaryWinner(winner); switch (winner) { case NPC.AffliationTypes.red: winnerString = "Red Team "; winnerFrameLeft = RED_INDEX; break; case NPC.AffliationTypes.blue: winnerString = "Blue Team "; winnerFrameLeft = BLUE_INDEX; break; case NPC.AffliationTypes.green: winnerString = "Green Team "; winnerFrameLeft = GREEN_INDEX; break; case NPC.AffliationTypes.yellow: winnerString = "Yellow Team "; winnerFrameLeft = YELLOW_INDEX; break; case NPC.AffliationTypes.same: winnerString = "Tie Game "; winnerSpriteRight = null; winnerSpriteLeft = null; break; } } else if (result.GetManagerHelper().GetGametype() is Conquest) { Conquest gametypeWinner = (Conquest)result.GetManagerHelper().GetGametype(); NPC.AffliationTypes winner = gametypeWinner.GetWinner(); secondaryWinner = result.GetManagerHelper().GetGametype().GetSecondaryWinner(winner); switch (winner) { case NPC.AffliationTypes.red: winnerString = "Red Team "; winnerFrameLeft = RED_INDEX; break; case NPC.AffliationTypes.blue: winnerString = "Blue Team "; winnerFrameLeft = BLUE_INDEX; break; case NPC.AffliationTypes.green: winnerString = "Green Team "; winnerFrameLeft = GREEN_INDEX; break; case NPC.AffliationTypes.yellow: winnerString = "Yellow Team "; winnerFrameLeft = YELLOW_INDEX; break; case NPC.AffliationTypes.same: winnerString = "Tie Game "; winnerSpriteRight = null; winnerSpriteLeft = null; break; } } else if (result.GetManagerHelper().GetGametype() is Deathmatch) { Deathmatch gametypeWinner = (Deathmatch)result.GetManagerHelper().GetGametype(); NPC.AffliationTypes winner = gametypeWinner.GetWinner(); secondaryWinner = result.GetManagerHelper().GetGametype().GetSecondaryWinner(winner); switch (winner) { case NPC.AffliationTypes.red: winnerString = "Red Team "; winnerFrameLeft = RED_INDEX; break; case NPC.AffliationTypes.blue: winnerString = "Blue Team "; winnerFrameLeft = BLUE_INDEX; break; case NPC.AffliationTypes.green: winnerString = "Green Team "; winnerFrameLeft = GREEN_INDEX; break; case NPC.AffliationTypes.yellow: winnerString = "Yellow Team "; winnerFrameLeft = YELLOW_INDEX; break; case NPC.AffliationTypes.same: winnerString = "Tie Game "; winnerSpriteRight = null; winnerSpriteLeft = null; break; } } else if (result.GetManagerHelper().GetGametype() is Survival) { Survival gametypeWinner = (Survival)result.GetManagerHelper().GetGametype(); NPC.AffliationTypes winner = gametypeWinner.GetWinner(); secondaryWinner = result.GetManagerHelper().GetGametype().GetSecondaryWinner(winner); switch (winner) { case NPC.AffliationTypes.red: winnerString = "Mustachio "; winnerFrameLeft = RED_INDEX; break; case NPC.AffliationTypes.blue: winnerString = "Aquoes "; winnerFrameLeft = BLUE_INDEX; break; case NPC.AffliationTypes.green: winnerString = "Terron "; winnerFrameLeft = GREEN_INDEX; break; case NPC.AffliationTypes.yellow: winnerString = "Dian "; winnerFrameLeft = YELLOW_INDEX; break; case NPC.AffliationTypes.same: winnerString = "Tie Game "; winnerSpriteRight = null; winnerSpriteLeft = null; break; } } if (result.GetManagerHelper().GetGametype().GetTeams().Count == 2) { switch (secondaryWinner) { case NPC.AffliationTypes.red: winnerFrameRight = RED_INDEX; break; case NPC.AffliationTypes.blue: winnerFrameRight = BLUE_INDEX; break; case NPC.AffliationTypes.green: winnerFrameRight = GREEN_INDEX; break; case NPC.AffliationTypes.yellow: winnerFrameRight = YELLOW_INDEX; break; } } else { winnerSpriteRight = null; } }