本文整理汇总了C#中Point.LoadContent方法的典型用法代码示例。如果您正苦于以下问题:C# Point.LoadContent方法的具体用法?C# Point.LoadContent怎么用?C# Point.LoadContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point
的用法示例。
在下文中一共展示了Point.LoadContent方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: KnockOutEnemies
//Knock out any enemy that you crash into
public static void KnockOutEnemies(BoundingSphere boundingSphere, Vector3 Position, int MaxRangeX, int MaxRangeZ, BaseEnemy[] enemies, ref int enemiesAmount, SwimmingObject[] fishes, int fishAmount, AudioLibrary audio, GameMode gameMode)
{
for (int i = 0; i < enemiesAmount; i++)
{
if (boundingSphere.Intersects(enemies[i].BoundingSphere))
{
PoseidonGame.audio.bodyHit.Play();
float healthiness = HydroBot.currentEnergy / GameConstants.PlayerStartingEnergy;
if (healthiness > 1) healthiness = 1.0f;
Vector3 oldPosition = enemies[i].Position;
Vector3 pushVector = enemies[i].Position - Position;
pushVector.Normalize();
//can't stun a submarine
if (!(enemies[i] is Submarine))
{
enemies[i].stunned = true;
enemies[i].stunnedStartTime = PoseidonGame.playTime.TotalSeconds;
if (HydroBot.sonicHipnotiseMode)
{
enemies[i].setHypnotise();
}
}
enemies[i].Position += (pushVector * GameConstants.ThorPushFactor);
enemies[i].Position.X = MathHelper.Clamp(enemies[i].Position.X, -MaxRangeX, MaxRangeX);
enemies[i].Position.Z = MathHelper.Clamp(enemies[i].Position.Z, -MaxRangeZ, MaxRangeZ);
enemies[i].BoundingSphere.Center = enemies[i].Position;
if (Collision.isBarrierVsBarrierCollision(enemies[i], enemies[i].BoundingSphere, fishes, fishAmount)
|| Collision.isBarrierVsBarrierCollision(enemies[i], enemies[i].BoundingSphere, enemies, enemiesAmount))
{
enemies[i].Position = oldPosition;
enemies[i].BoundingSphere.Center = oldPosition;
}
int healthloss = (int)(GameConstants.HermesDamage * healthiness * HydroBot.speed * HydroBot.speedUp * HydroBot.sandalPower);
enemies[i].health -= healthloss;
//audio.Shooting.Play();
//if (enemies[i].health <= 0)
//{
// if (enemies[i].isBigBoss == true) PlayGameScene.isBossKilled = true;
// for (int k = i + 1; k < enemiesAmount; k++)
// {
// enemies[k - 1] = enemies[k];
// }
// enemies[--enemiesAmount] = null;
// i--;
//}
Point point = new Point();
String point_string = "-" + healthloss.ToString() + "HP";
point.LoadContent(PoseidonGame.contentManager, point_string, enemies[i].Position, Color.DarkRed);
if (gameMode == GameMode.ShipWreck)
ShipWreckScene.points.Add(point);
else if (gameMode == GameMode.MainGame)
PlayGameScene.points.Add(point);
else if (gameMode == GameMode.SurvivalMode)
SurvivalGameScene.points.Add(point);
}
}
}
示例2: Update
public void Update(GameTime gameTime, Vector3 botPosition, ref List<Point> points)
{
EffectHelpers.GetEffectConfiguration(ref fogColor, ref ambientColor, ref diffuseColor, ref specularColor);
if (lastConstructionSwitchTime == TimeSpan.Zero)
{
lastConstructionSwitchTime = PoseidonGame.playTime;
}
if (underConstruction)
{
if (buildingSoundInstance.State == SoundState.Paused)
buildingSoundInstance.Resume();
if (buildingSoundInstance.State != SoundState.Playing)
{
buildingSoundInstance.Play();
}
//environment disturbance because of factory building
if (!sandDirturbedAnimationPlayed)
{
for (int k = 0; k < GameConstants.numSandParticles; k++)
particleManager.sandParticlesForFactory.AddParticle(Position, Vector3.Zero);
sandDirturbedAnimationPlayed = true;
}
Model = modelStates[constructionIndex];
underConstruction = (constructionIndex < (modelStates.Count - 1));
if (!underConstruction && buildingSoundInstance.State == SoundState.Playing) buildingSoundInstance.Stop();
if (PoseidonGame.playTime - lastConstructionSwitchTime >= constructionSwitchSpan)
{
//constructionIndex++;
constructionIndex += (int)((PoseidonGame.playTime - lastConstructionSwitchTime).TotalMilliseconds / constructionSwitchSpan.TotalMilliseconds);
if (constructionIndex >= modelStates.Count)
{
constructionIndex = modelStates.Count - 1;
}
lastConstructionSwitchTime = PoseidonGame.playTime;
}
return;
}
double processingTime = 12; //3 days
int fossilType = random.Next(100);
string point_string = "";
bool boneFound = false;
//Is strange rock finished processing?
for (int i = 0; i < listTimeRockProcessing.Count; i++)
{
if (PoseidonGame.playTime.TotalSeconds - listTimeRockProcessing[i] >= processingTime)
{
listTimeRockProcessing.RemoveAt(i);
//produce fossil/bone 75% of the times.
if (fossilType >= 74)
{
HydroBot.numTurtlePieces++;
point_string = "Research Centre found\na Meiolania Turtle fossil\nfrom the strange rock";
boneFound = true;
}
else if (fossilType >= 49)
{
HydroBot.numDolphinPieces++;
point_string = "Research Centre found\na Maui's Dolphin bone\nfrom the strange rock";
boneFound = true;
}
else if (fossilType >= 24)
{
HydroBot.numSeaCowPieces++;
boneFound = true;
point_string = "Research Centre found\na Stellar's SeaCow bone\nfrom the strange rock";
}
}
if (boneFound)
{
boneFound = false;
Point point = new Point();
point.LoadContent(PoseidonGame.contentManager, point_string, botPosition, Color.LawnGreen);
points.Add(point);
}
}
}
示例3: attack
public override void attack()
{
float damage = HydroBot.turtlePower * turtleDamage;
if (PoseidonGame.playTime.TotalSeconds - lastAttack.TotalSeconds > timeBetweenAttack.TotalSeconds)
{
currentTarget.health -= damage;
lastAttack = PoseidonGame.playTime;
Vector3 facingDirection = currentTarget.Position - Position;
ForwardDirection = (float)Math.Atan2(facingDirection.X, facingDirection.Z);
Point point = new Point();
String point_string = "-" + (int)damage + "HP";
point.LoadContent(PoseidonGame.contentManager, point_string, currentTarget.Position, Color.Red);
if (HydroBot.gameMode == GameMode.ShipWreck)
ShipWreckScene.points.Add(point);
else if (HydroBot.gameMode == GameMode.MainGame)
PlayGameScene.points.Add(point);
else if (HydroBot.gameMode == GameMode.SurvivalMode)
SurvivalGameScene.points.Add(point);
//if (this.BoundingSphere.Intersects(cameraFrustum))
PoseidonGame.audio.slashSound.Play();
}
base.attack();
}
示例4: addNewBuilding
// Add new factory in the game arena if conditions for adding them satisty
// Research Facility: Only one
// Uses class variables factories, researchFacility, HydroBot
private bool addNewBuilding(BuildingType buildingType, Vector3 position)
{
bool status = false;
float orientation; // 0, PI/2, PI, 3*PI/2
Factory oneFactory;
bool notEnoughResource = false;
switch (buildingType)
{
case BuildingType.researchlab:
if (HydroBot.numResources < GameConstants.numResourcesForResearchCenter)
notEnoughResource = true;
break;
case BuildingType.biodegradable:
if (HydroBot.numResources < GameConstants.numResourcesForBioFactory)
notEnoughResource = true;
break;
case BuildingType.plastic:
if (HydroBot.numResources < GameConstants.numResourcesForPlasticFactory)
notEnoughResource = true;
break;
case BuildingType.radioactive:
if (HydroBot.numResources < GameConstants.numResourcesForRadioFactory)
notEnoughResource = true;
break;
}
// Check if hydrobot has sufficient resources for building a factory
if (notEnoughResource)
{
// Play some sound hinting no sufficient resource
audio.MenuScroll.Play();
Point point = new Point();
String point_string = "Not enough\nresources";
point.LoadContent(PoseidonGame.contentManager, point_string, position, Color.Red);
PlayGameScene.points.Add(point);
return false;
}
if (HydroBot.currentEnergy < GameConstants.EnergyLostPerBuild)
{
audio.MenuScroll.Play();
Point point = new Point();
String point_string = "Not enough\nenergy";
point.LoadContent(PoseidonGame.contentManager, point_string, position, Color.Red);
PlayGameScene.points.Add(point);
return false;
}
int radius = 60; // need to revise this based on the model for each building
BoundingSphere buildingBoundingSphere;
if (factoryAnchor != null)
{
buildingBoundingSphere = factoryAnchor.BoundingSphere;
radius = (int)buildingBoundingSphere.Radius;
}
else if (researchAnchor != null)
{
buildingBoundingSphere = researchAnchor.BoundingSphere;
radius = (int)buildingBoundingSphere.Radius;
}
// Check if position selected for building is within game arena.. The game area is within -MaxRange to +MaxRange for both X and Z axis
// Give a lax of 40 units so that if a click happened at the edge of the arena, building is not allowed. This is to prevent the case
// that power packs might appear above the end of the factory whose edge is just beyond the game arena.
if (Math.Abs(position.X) > (float)(GameConstants.MainGameMaxRangeX - 40) || Math.Abs(position.Z) > (float)(GameConstants.MainGameMaxRangeZ - 40))
{
// Play some sound hinting position selected is outside game arena
audio.MenuScroll.Play();
Point point = new Point();
String point_string = "Can not\nbuild here";
point.LoadContent(PoseidonGame.contentManager, point_string, position, Color.Red);
points.Add(point);
return false;
}
//Verify that current location is available for adding the building
int heightValue = GameConstants.MainGameFloatHeight;//(int)terrain.heightMapInfo.GetHeight(new Vector3(position.X, 0, position.Z));
if (AddingObjects.IsSeaBedPlaceOccupied((int)position.X, heightValue, (int)position.Z, radius, null, null, trashes, factories, researchFacility))
{
// Play some sound hinting seabed place is occupied
audio.MenuScroll.Play();
Point point = new Point();
String point_string = "Can not\nbuild here";
point.LoadContent(PoseidonGame.contentManager, point_string, position, Color.Red);
points.Add(point);
return false;
}
switch (buildingType)
{
case BuildingType.researchlab:
if (researchFacility != null)
{
// do not allow addition of more than one research facility
Point point = new Point();
String point_string = "Can only build\n1 research center";
point.LoadContent(PoseidonGame.contentManager, point_string, position, Color.Red);
points.Add(point);
//.........这里部分代码省略.........
示例5: Update
public override void Update(GameTime gameTime)
{
if (MediaPlayer.State.Equals(MediaState.Stopped))
{
MediaPlayer.Play(audio.backgroundMusics[random.Next(GameConstants.NumNormalBackgroundMusics)]);
}
//skill combo unlock
if (score >= 500 && !HydroBot.skillComboActivated)
{
HydroBot.skillComboActivated = true;
Point point = new Point();
point.LoadContent(PoseidonGame.contentManager, "CONGRATULATIONS\nSKILL COMBO UNLOCKED", hydroBot.Position, Color.Gold);
points.Add(point);
PoseidonGame.audio.levelUpSound.Play();
}
if (score > highestScore) highestScore = score;
if (!paused)
{
//timming = gameTime;
float aspectRatio = graphics.GraphicsDevice.Viewport.AspectRatio;
lastKeyboardState = currentKeyboardState;
currentKeyboardState = Keyboard.GetState();
//currentMouseState = Mouse.GetState();
// Allows the game to exit
//if ((currentKeyboardState.IsKeyDown(Keys.Escape)) ||
// (currentGamePadState.Buttons.Back == ButtonState.Pressed))
// //this.Exit();
if ((currentGameState == GameState.Running))
{
MouseState currentMouseState = new MouseState();
currentMouseState = Mouse.GetState();
// Update Factory Button Panel
factoryButtonPanel.Update(gameTime, currentMouseState);
UpdateAnchor();
// if mouse click happened, check for the click position and add new factory
if (factoryButtonPanel.hasAnyAnchor() && factoryButtonPanel.cursorOutsidePanelArea && factoryButtonPanel.clickToBuildDetected)
{
// adjust the position to build factory depending on current camera position
Vector3 newBuildingPosition = CursorManager.IntersectPointWithPlane(cursor, gameCamera, GameConstants.MainGameFloatHeight);
// identify which factory depending on anchor index
BuildingType newBuildingType = factoryButtonPanel.anchorIndexToBuildingType();
// if addition is successful, play successful sound, otherwise play unsuccessful sound
if (addNewBuilding(newBuildingType, newBuildingPosition))
{
factoryButtonPanel.removeAnchor();
}
}
if ((lastKeyboardState.IsKeyDown(Keys.LeftShift) || lastKeyboardState.IsKeyDown(Keys.RightShift)) && (lastMouseState.LeftButton == ButtonState.Pressed && currentMouseState.LeftButton == ButtonState.Released)
&& !openResearchFacilityConfigScene && !openFactoryConfigurationScene)
{
foreach (Factory factory in factories)
{
if (!factory.UnderConstruction && CursorManager.MouseOnObject(cursor, factory.BoundingSphere, factory.Position, gameCamera))
{
openFactoryConfigurationScene = true;
factoryToConfigure = factory;
break;
}
}
if (researchFacility != null && !researchFacility.UnderConstruction && CursorManager.MouseOnObject(cursor, researchFacility.BoundingSphere, researchFacility.Position, gameCamera))
{
openResearchFacilityConfigScene = true;
ResearchFacility.dolphinLost = ResearchFacility.seaCowLost = ResearchFacility.turtleLost = false;
ResearchFacility.dolphinWon = ResearchFacility.seaCowWon = ResearchFacility.turtleWon = false;
}
}
if (openFactoryConfigurationScene || openResearchFacilityConfigScene)
{
Factory.buildingSoundInstance.Pause();
ResearchFacility.buildingSoundInstance.Pause();
bool exitFactConfPressed;
exitFactConfPressed = (lastKeyboardState.IsKeyDown(Keys.Enter) && (currentKeyboardState.IsKeyUp(Keys.Enter)));
if (exitFactConfPressed)
{
openFactoryConfigurationScene = false;
openResearchFacilityConfigScene = false;
PoseidonGame.justCloseControlPanel = true;
}
else
{
//cursor update
cursor.Update(GraphicDevice, gameCamera, gameTime, frustum);
CursorManager.MouseInteractWithControlPanel(ref clicked, ref doubleClicked, ref notYetReleased, ref this.lastMouseState, ref this.currentMouseState, gameTime,
ref clickTimer, openFactoryConfigurationScene, factoryToConfigure, researchFacility, factories);
return;
}
}
IngamePresentation.levelObjHover = IngamePresentation.mouseOnLevelObjectiveIcon(currentMouseState);
bool mouseOnInteractiveIcons = IngamePresentation.levelObjHover || (!factoryButtonPanel.cursorOutsidePanelArea) || factoryButtonPanel.hasAnyAnchor()
|| factoryButtonPanel.clickToBuildDetected || factoryButtonPanel.clickToRemoveAnchorActive || factoryButtonPanel.rightClickToRemoveAnchor;
//hydrobot update
hydroBot.UpdateAction(gameTime, cursor, gameCamera, enemies, enemiesAmount, fish, fishAmount, Content, spriteBatch, myBullet,
this, terrain.heightMapInfo, healthBullet, powerpacks, resources, trashes, null,null, mouseOnInteractiveIcons);
//add 1 bubble over bot and each enemy
//.........这里部分代码省略.........
示例6: dumpTrashInFactory
public void dumpTrashInFactory(Factory factory, Vector3 position)
{
string point_string = "";
switch (factory.factoryType)
{
case FactoryType.biodegradable:
point_string = HydroBot.bioTrash + " biodegradable\ntrash dumped";
factory.numTrashWaiting += HydroBot.bioTrash;
break;
case FactoryType.plastic:
point_string = HydroBot.plasticTrash + " plastic\ntrash dumped";
factory.numTrashWaiting += HydroBot.plasticTrash;
break;
case FactoryType.radioactive:
point_string = HydroBot.nuclearTrash + " radioactive\ntrash dumped";
factory.numTrashWaiting += HydroBot.nuclearTrash;
break;
}
Point point = new Point();
point.LoadContent(PoseidonGame.contentManager, point_string, position, Color.LawnGreen);
points.Add(point);
}
示例7: updateProjectileHitBot
public static void updateProjectileHitBot(HydroBot hydroBot, List<DamageBullet> enemyBullets, GameMode gameMode, BaseEnemy[] enemies, int enemiesAmount, ParticleSystem explosionParticles, Camera gameCamera, Fish[] fishes, int fishAmount)
{
for (int i = 0; i < enemyBullets.Count; ) {
if (enemyBullets[i].BoundingSphere.Intersects(hydroBot.BoundingSphere)) {
if (!HydroBot.invincibleMode)
{
HydroBot.currentHitPoint -= enemyBullets[i].damage;
if (gameMode == GameMode.MainGame || gameMode == GameMode.ShipWreck)
PlayGameScene.healthLost += enemyBullets[i].damage;
PoseidonGame.audio.botYell.Play();
Point point = new Point();
String point_string = "-" + enemyBullets[i].damage.ToString() + "HP";
point.LoadContent(PoseidonGame.contentManager, point_string, hydroBot.Position, Color.Red);
if (gameMode == GameMode.ShipWreck)
ShipWreckScene.points.Add(point);
else if (gameMode == GameMode.MainGame)
PlayGameScene.points.Add(point);
else if (gameMode == GameMode.SurvivalMode)
SurvivalGameScene.points.Add(point);
}
//when auto hipnotize mode is on
//whoever hits the bot will be hipnotized
if (HydroBot.autoHipnotizeMode)
{
if (enemyBullets[i].shooter != null && !enemyBullets[i].shooter.isHypnotise)
CastSkill.useHypnotise(enemyBullets[i].shooter);
}
if (HydroBot.autoExplodeMode)
{
PoseidonGame.audio.Explo1.Play();
gameCamera.Shake(12.5f, .2f);
CastSkill.UseThorHammer(hydroBot.Position, hydroBot.MaxRangeX, hydroBot.MaxRangeZ, enemies, ref enemiesAmount, fishes, fishAmount, HydroBot.gameMode, true);
}
// add particle effect when certain kind of bullet hits
if (enemyBullets[i] is Torpedo || enemyBullets[i] is ChasingBullet)
{
if (explosionParticles != null)
{
for (int k = 0; k < GameConstants.numExplosionParticles; k++)
explosionParticles.AddParticle(enemyBullets[i].Position, Vector3.Zero);
}
PoseidonGame.audio.explosionSmall.Play();
}
enemyBullets.RemoveAt(i);
}
else { i++; }
}
}
示例8: updateHealingBulletVsBarrierCollision
public static void updateHealingBulletVsBarrierCollision(List<HealthBullet> bullets, SwimmingObject[] barriers, int size, BoundingFrustum cameraFrustum, GameMode gameMode)
{
BoundingSphere sphere;
for (int i = 0; i < bullets.Count; i++) {
for (int j = 0; j < size; j++) {
sphere = barriers[j].BoundingSphere;
sphere.Radius *= GameConstants.EasyHitScale;
if (bullets[i].BoundingSphere.Intersects(sphere))
{
//fulfill the task of healing fish
if (PlayGameScene.currentLevel == 0 && PlayGameScene.levelObjectiveState == 7)
{
PlayGameScene.levelObjectiveState = 8;
PlayGameScene.newLevelObjAvailable = true;
}
if (barriers[j].BoundingSphere.Intersects(cameraFrustum))
PoseidonGame.audio.animalHappy.Play();
if (barriers[j].health < barriers[j].maxHealth ) {
float amountHealed = Math.Min(bullets[i].healthAmount, barriers[j].maxHealth - barriers[j].health);
barriers[j].health += amountHealed;
if (barriers[j].health > barriers[j].maxHealth) barriers[j].health = barriers[j].maxHealth;
int expReward = (int)(((double)amountHealed / (double)GameConstants.HealingAmount) * barriers[j].basicExperienceReward);
if (PoseidonGame.gamePlus)
{
expReward += (int)(((double)amountHealed / (double)GameConstants.HealingAmount) * HydroBot.gamePlusLevel * 5);
}
//int envReward = (int) (((double)bullets[i].healthAmount / (double)GameConstants.HealingAmount) * GameConstants.BasicEnvGainForHealingFish);
int goodWillReward = (int)(((double)amountHealed / (double)GameConstants.HealingAmount) * GameConstants.GoodWillPointGainForHealing);
HydroBot.currentExperiencePts += expReward;
//HydroBot.currentEnvPoint += envReward;
//update good will point
HydroBot.IncreaseGoodWillPoint(goodWillReward);
if (HydroBot.gameMode == GameMode.SurvivalMode)
SurvivalGameScene.score += expReward / 2;
Point point = new Point();
//String point_string = "+" + envReward.ToString() + "ENV\n+"+expReward.ToString()+"EXP";
String point_string = "+" + expReward.ToString() + "EXP";
point.LoadContent(PoseidonGame.contentManager, point_string, barriers[j].Position, Color.LawnGreen);
if (gameMode == GameMode.ShipWreck)
ShipWreckScene.points.Add(point);
else if (gameMode == GameMode.MainGame)
PlayGameScene.points.Add(point);
else if (gameMode == GameMode.SurvivalMode)
SurvivalGameScene.points.Add(point);
}
bullets.RemoveAt(i--);
break;
}
}
}
}
示例9: updateDamageBulletVsBarriersCollision
//.........这里部分代码省略.........
}
else {
if (bullets[i].shooter == null && !((BaseEnemy)barriers[j]).isHypnotise)
{
((BaseEnemy)barriers[j]).justBeingShot = true;
((BaseEnemy)barriers[j]).startChasingTime = PoseidonGame.playTime;
}
}
//special handling for the skill combo FlyingHammer
if (bullets[i] is FlyingHammer)
{
PoseidonGame.audio.bodyHit.Play();
Vector3 oldPosition = barriers[j].Position;
Vector3 pushVector = barriers[j].Position - bullets[i].Position;
pushVector.Normalize();
((BaseEnemy)barriers[j]).stunned = true;
((BaseEnemy)barriers[j]).stunnedStartTime = PoseidonGame.playTime.TotalSeconds;
((BaseEnemy)barriers[j]).Position += (pushVector * GameConstants.ThorPushFactor);
barriers[j].Position.X = MathHelper.Clamp(barriers[j].Position.X, -hydroBot.MaxRangeX, hydroBot.MaxRangeX);
barriers[j].Position.Z = MathHelper.Clamp(barriers[j].Position.Z, -hydroBot.MaxRangeZ, hydroBot.MaxRangeZ);
barriers[j].BoundingSphere.Center = barriers[j].Position;
if (Collision.isBarrierVsBarrierCollision(barriers[j], barriers[j].BoundingSphere, fishes, fishAmount)
|| Collision.isBarrierVsBarrierCollision(barriers[j], barriers[j].BoundingSphere, enemies, enemiesAmount))
{
barriers[j].Position = oldPosition;
barriers[j].BoundingSphere.Center = oldPosition;
}
}
}
// add particle effect when certain kind of bullet hits
if (bullets[i] is Torpedo || bullets[i] is ChasingBullet)
{
if (explosionParticles != null)
{
for (int k = 0; k < GameConstants.numExplosionParticles; k++)
explosionParticles.AddParticle(bullets[i].Position, Vector3.Zero);
}
PoseidonGame.audio.explosionSmall.Play();
}
//whether or not to reduce health of the hit object
bool reduceHealth = true;
if (bullets[i] is HerculesBullet)
{
if (!((HerculesBullet)bullets[i]).piercingArrow)
reduceHealth = true;
else
{
bool enemyHitBefore = false;
foreach (BaseEnemy hitEnemy in ((HerculesBullet)bullets[i]).hitEnemies)
{
if (hitEnemy == (BaseEnemy)barriers[j])
enemyHitBefore = true;
}
if (!enemyHitBefore)
{
reduceHealth = true;
((HerculesBullet)bullets[i]).hitEnemies.Add((BaseEnemy)barriers[j]);
}
else reduceHealth = false;
}
}
else reduceHealth = true;
if (reduceHealth)
{
barriers[j].health -= bullets[i].damage;
if (barriers[j].BoundingSphere.Intersects(cameraFrustum))
{
Point point = new Point();
String point_string = "-" + bullets[i].damage.ToString() + "HP";
point.LoadContent(PoseidonGame.contentManager, point_string, barriers[j].Position, Color.DarkRed);
if (gameMode == GameMode.ShipWreck)
ShipWreckScene.points.Add(point);
else if (gameMode == GameMode.MainGame)
PlayGameScene.points.Add(point);
else if (gameMode == GameMode.SurvivalMode)
SurvivalGameScene.points.Add(point);
}
}
//remove the bullet that hits something
if (bullets[i] is FlyingHammer)
{
//if (((FlyingHammer)bullets[i]).explodeNow) bullets.RemoveAt(i--);
}
//special handling for the skill combo Piercing arrow
//pierce through enemies
else if (bullets[i] is HerculesBullet)
{
if (!((HerculesBullet)bullets[i]).piercingArrow)
bullets.RemoveAt(i--);
}
else bullets.RemoveAt(i--);
break;
}
}
}
}
示例10: deleteSmallerThanZero
public static void deleteSmallerThanZero(SwimmingObject[] objs, ref int size, BoundingFrustum cameraFrustum, GameMode gameMode, Cursor cursor, ParticleSystem explosionParticles)
{
for (int i = 0; i < size; i++) {
if (objs[i].health <= 0 && objs[i].gaveExp == false) {
// Delete code is below this
// This snippet does not include deleting
if (objs[i] is SeaCow) {
HydroBot.hasSeaCow = false;
HydroBot.seaCowPower = 0;
HydroBot.iconActivated[IngamePresentation.seaCowIcon] = false;
}
if (objs[i] is SeaTurtle)
{
HydroBot.hasTurtle = false;
HydroBot.turtlePower = 0;
HydroBot.iconActivated[IngamePresentation.turtleIcon] = false;
}
if (objs[i] is SeaDolphin)
{
HydroBot.hasDolphin = false;
HydroBot.dolphinPower = 0;
HydroBot.iconActivated[IngamePresentation.dolphinIcon] = false;
}
if (objs[i].isBigBoss == true)
{
if (gameMode == GameMode.MainGame || gameMode == GameMode.ShipWreck)
{
PlayGameScene.isBossKilled = true;
PlayGameScene.numBossKills += 1;
}
else if (gameMode == GameMode.SurvivalMode && objs[i] is Fish)
SurvivalGameScene.isAncientKilled = true;
}
else
{
if (gameMode == GameMode.MainGame || gameMode == GameMode.ShipWreck)
{
PlayGameScene.numNormalKills += 1;
}
}
if (objs[i] is BaseEnemy) {
HydroBot.currentExperiencePts += objs[i].basicExperienceReward;
objs[i].gaveExp = true;
if (gameMode == GameMode.SurvivalMode)
SurvivalGameScene.score += objs[i].basicExperienceReward / 2;
if (objs[i].BoundingSphere.Intersects(cameraFrustum))
{
Point point = new Point();
String point_string = "+" + objs[i].basicExperienceReward.ToString() + "EXP";
point.LoadContent(PoseidonGame.contentManager, point_string, objs[i].Position, Color.LawnGreen);
if (gameMode == GameMode.ShipWreck)
ShipWreckScene.points.Add(point);
else if (gameMode == GameMode.MainGame)
PlayGameScene.points.Add(point);
else if (gameMode == GameMode.SurvivalMode)
SurvivalGameScene.points.Add(point);
}
if (!objs[i].isBigBoss)
{
if (objs[i].BoundingSphere.Intersects(cameraFrustum))
{
if (objs[i] is GhostPirate)
PoseidonGame.audio.skeletonDie.Play();
else PoseidonGame.audio.hunterYell.Play();
}
}
else
{
if (objs[i] is MutantShark)
PoseidonGame.audio.mutantSharkYell.Play();
else if (objs[i] is Terminator)
PoseidonGame.audio.terminatorYell.Play();
else if (objs[i] is Submarine)
{
PoseidonGame.audio.Explosion.Play();
if (explosionParticles != null)
{
for (int k = 0; k < GameConstants.numExplosionParticles; k++)
explosionParticles.AddParticle(objs[i].Position, Vector3.Zero);
}
}
}
}
if (objs[i] is Fish)
{
int envLoss;
envLoss = GameConstants.envLossForFishDeath;
HydroBot.currentEnvPoint -= envLoss;
if (objs[i].BoundingSphere.Intersects(cameraFrustum))
{
Point point = new Point();
String point_string = "-" + envLoss.ToString() + "ENV";
point.LoadContent(PoseidonGame.contentManager, point_string, objs[i].Position, Color.Red);
if (gameMode == GameMode.ShipWreck)
ShipWreckScene.points.Add(point);
else if (gameMode == GameMode.MainGame)
PlayGameScene.points.Add(point);
//.........这里部分代码省略.........
示例11: UseThorHammer
public static void UseThorHammer(Vector3 Position, int MaxRangeX, int MaxRangeZ, BaseEnemy[] enemies, ref int enemiesAmount, SwimmingObject[] fishes, int fishAmount, GameMode gameMode, bool halfStrength)
{
HydroBot.distortingScreen = true;
HydroBot.distortionStart = PoseidonGame.playTime.TotalSeconds;
for (int i = 0; i < enemiesAmount; i++)
{
if (InThorRange(Position, enemies[i].Position)){
float healthiness = HydroBot.currentEnergy / GameConstants.PlayerStartingEnergy;
if (healthiness > 1) healthiness = 1.0f;
//you can't stun a submarine
if (!(enemies[i] is Submarine))
{
enemies[i].stunned = true;
enemies[i].stunnedStartTime = PoseidonGame.playTime.TotalSeconds;
}
float healthloss = (GameConstants.ThorDamage * healthiness * HydroBot.strength * HydroBot.strengthUp * HydroBot.hammerPower);
if (halfStrength) healthloss /= 2;
enemies[i].health -= healthloss;
PushEnemy(Position, MaxRangeX, MaxRangeZ, enemies[i], enemies, enemiesAmount, fishes, fishAmount);
//if (enemies[i].health <= 0)
//{
// if (enemies[i].isBigBoss == true) PlayGameScene.isBossKilled = true;
// for (int k = i + 1; k < enemiesAmount; k++) {
// enemies[k - 1] = enemies[k];
// }
// enemies[--enemiesAmount] = null;
// i--;
//}
Point point = new Point();
String point_string = "-" + ((int)healthloss).ToString() + "HP";
point.LoadContent(PoseidonGame.contentManager, point_string, enemies[i].Position, Color.DarkRed);
if (gameMode == GameMode.ShipWreck)
ShipWreckScene.points.Add(point);
else if (gameMode == GameMode.MainGame)
PlayGameScene.points.Add(point);
else if (gameMode == GameMode.SurvivalMode)
SurvivalGameScene.points.Add(point);
}
}
}
示例12: UseSkill
//.........这里部分代码省略.........
}
if (castSonicHipno)
{
HydroBot.sonicHipnotiseMode = true;
HydroBot.supersonicMode = true;
HydroBot.skillPrevUsed[4] = PoseidonGame.playTime.TotalSeconds;
HydroBot.skillPrevUsed[3] = PoseidonGame.playTime.TotalSeconds;
HydroBot.firstUse[4] = false;
HydroBot.firstUse[3] = false;
castSonicHipno = false;
PoseidonGame.audio.hermesSound.Play();
}
if (castHipno)
{
HydroBot.firstUse[4] = false;
PoseidonGame.audio.hipnotizeSound.Play();
useHypnotise(enemyToHipNo);
HydroBot.skillPrevUsed[4] = PoseidonGame.playTime.TotalSeconds;
castHipno = false;
enemyToHipNo = null;
}
//lose health after using skill
if (HydroBot.skillComboActivated && HydroBot.secondSkillID != -1 && HydroBot.secondSkillID != HydroBot.activeSkillID)
healthToLose = (int)(2 * GameConstants.EnergyLostPerSkill);//GameConstants.skillHealthLoss;
else healthToLose = (int)(GameConstants.EnergyLostPerSkill);
//display HP loss
//HydroBot.currentHitPoint -= healthToLose;
//we now lose energy instead of health
int energyLost = healthToLose;
HydroBot.currentEnergy -= energyLost;
Point point = new Point();
String point_string = "-" + energyLost.ToString() + "Energy";
point.LoadContent(PoseidonGame.contentManager, point_string, hydroBot.Position, Color.Red);
if (gameMode == GameMode.ShipWreck)
ShipWreckScene.points.Add(point);
else if (gameMode == GameMode.MainGame)
PlayGameScene.points.Add(point);
else if (gameMode == GameMode.SurvivalMode)
SurvivalGameScene.points.Add(point);
if (!hydroBot.clipPlayer.inRange(50, 74))
hydroBot.clipPlayer.switchRange(50, 74);
}
return;
}
else //skill casting may have been aborted
{
shootHammer = shootPiercingArrow = shootHerculesArrow = useThorHammer = castInvincible = castAutoExplode = castAutoHipno = castSonic = castSonicHipno = castHipno = false;
}
bool skillUsed = false;
int floatHeight;
if (gameMode == GameMode.ShipWreck) floatHeight = GameConstants.ShipWreckFloatHeight;
else floatHeight = GameConstants.MainGameFloatHeight;
pointIntersect = CursorManager.IntersectPointWithPlane(cursor, gameCamera, floatHeight);
hydroBot.ForwardDirection = CursorManager.CalculateAngle(pointIntersect, hydroBot.Position);
// Hercules' Bow!!!
if (HydroBot.activeSkillID == 0)// && mouseOnLivingObject)
{
//use skill combo if activated
//cooldowns for both skills must be cleared
if ((HydroBot.skillComboActivated && HydroBot.secondSkillID == 1) &&
//cooldowns check
((HydroBot.firstUse[0] == true && HydroBot.firstUse[1] == true)||
(PoseidonGame.playTime.TotalSeconds - HydroBot.skillPrevUsed[0] > GameConstants.coolDownForHerculesBow &&
PoseidonGame.playTime.TotalSeconds - HydroBot.skillPrevUsed[1] > GameConstants.coolDownForThorHammer)))
示例13: makeAction
// Execute the actions .. scene -> 1=playgamescene, 2=shipwreckscene
protected virtual void makeAction(int changeDirection, SwimmingObject[] enemies, int enemiesAmount, SwimmingObject[] fishes, int fishAmount, List<DamageBullet> bullets, HydroBot hydroBot, BoundingFrustum cameraFrustum, GameTime gameTime, GameMode gameMode)
{
if (configBits[0] == true)
{
// swimming w/o attacking
if (!clipPlayer.inRange(1, 30) && !configBits[3])
clipPlayer.switchRange(1, 30);
randomWalk(changeDirection, enemies, enemiesAmount, fishes, fishAmount, hydroBot, speedFactor);
return;
}
if (currentHuntingTarget != null)
{
calculateHeadingDirection();
calculateFutureBoundingSphere();
}
if (configBits[2] == true)
{
// swimming w/o attacking
if (!clipPlayer.inRange(1, 30) && !configBits[3])
clipPlayer.switchRange(1, 30);
goStraight(enemies, enemiesAmount, fishes, fishAmount, hydroBot);
}
if (configBits[3] == true)
{
startChasingTime = PoseidonGame.playTime;
if (currentHuntingTarget is Fish)
{
Fish tmp = (Fish)currentHuntingTarget;
if (tmp.health <= 0)
{
currentHuntingTarget = null;
justBeingShot = false;
return;
}
}
if (currentHuntingTarget is BaseEnemy)
{
BaseEnemy tmp = (BaseEnemy)currentHuntingTarget;
if (tmp.health <= 0)
{
currentHuntingTarget = null;
justBeingShot = false;
return;
}
}
if (PoseidonGame.playTime.TotalSeconds - prevFire.TotalSeconds > timeBetweenFire / speedFactor)
{
if (!clipPlayer.inRange(31, 60))
clipPlayer.switchRange(31, 60);
if (currentHuntingTarget.GetType().Name.Equals("HydroBot"))
{
if (!(HydroBot.invincibleMode || HydroBot.supersonicMode))
{
HydroBot.currentHitPoint -= damage;
Point point = new Point();
String point_string = "-" + damage.ToString() + "HP";
point.LoadContent(PoseidonGame.contentManager, point_string, hydroBot.Position, Color.Red);
if (gameMode == GameMode.ShipWreck)
ShipWreckScene.points.Add(point);
else if (gameMode == GameMode.MainGame)
PlayGameScene.points.Add(point);
else if (gameMode == GameMode.SurvivalMode)
SurvivalGameScene.points.Add(point);
PoseidonGame.audio.botYell.Play();
PlayGameScene.healthLost += damage;
}
if (HydroBot.autoHipnotizeMode)
{
setHypnotise();
}
if (HydroBot.autoExplodeMode)
{
PoseidonGame.audio.Explo1.Play();
if (gameMode == GameMode.MainGame)
PlayGameScene.gameCamera.Shake(12.5f, .2f);
else if (gameMode == GameMode.ShipWreck)
ShipWreckScene.gameCamera.Shake(12.5f, .2f);
else if (gameMode == GameMode.SurvivalMode)
SurvivalGameScene.gameCamera.Shake(12.5f, .2f);
CastSkill.UseThorHammer(hydroBot.Position, hydroBot.MaxRangeX, hydroBot.MaxRangeZ, (BaseEnemy[])enemies, ref enemiesAmount, fishes, fishAmount, HydroBot.gameMode, true);
}
}
if (currentHuntingTarget is SwimmingObject)
{
((SwimmingObject)currentHuntingTarget).health -= damage;
if (currentHuntingTarget.BoundingSphere.Intersects(cameraFrustum))
{
if (currentHuntingTarget is Fish)
PoseidonGame.audio.animalYell.Play();
Point point = new Point();
String point_string = "-" + damage.ToString() + "HP";
point.LoadContent(PoseidonGame.contentManager, point_string, currentHuntingTarget.Position, Color.Red);
if (gameMode == GameMode.ShipWreck)
//.........这里部分代码省略.........