public void Update(GameTime gameTime, Terrain terrain) { if (IsAlive) UpdatePosition(terrain); base.Update(gameTime); }
public Bombardment(Model model, float speed, Vector3 location, Terrain terrain, float milliseconds,Effect effect) : base(model) { this.location = location; this.speed = speed; this.terrain = terrain; this.milliseconds = milliseconds; this.rand = RandomPosition(); this.effect = effect; this.model = model; }
public Bombard(Model model, Terrain terrain, Texture2D tex, Camera camera, HUD hud, float milliseconds, Effect effect, Texture2D smokeTexture, Audio audio) { this.texture = tex; this.model = model; this.camera = camera; this.hud = hud; this.terrain = terrain; this.milliseconds = milliseconds; this.effect = effect; this.smokeTexture = smokeTexture; this.audio = audio; Vector3 rand = RandomPosition(); }
private void RestrictPositionToTerrainBoundaries(Terrain terrain) { float maxX = terrain.MaxX - MODEL_OFFSET; float minX = terrain.MinX + MODEL_OFFSET; float maxZ = terrain.MaxZ - MODEL_OFFSET; float minZ = terrain.MinZ + MODEL_OFFSET; // Change direction once we hit the edge of the map if (Position.X < minX || Position.X > maxX) { direction.X *= -1; isTurning = true; } if (Position.Z < minZ || Position.Z > maxZ) { direction.Z *= -1; isTurning = true; } }
public void Update(Camera camera, Terrain terrain) { UpdateRollAngle(); UpdateYawAngle(); UpdatePosition(camera, terrain); }
private void UpdatePosition(Camera camera, Terrain terrain) { // Move in a straight line along the direction the alien is facing Position += Direction * movementSpeed; // Keep the alien moving on the terrain RestrictPositionToTerrainBoundaries(terrain); // Ensure the alien still appears on the terrain Position.Y = terrain.GetHeight(Position.X, Position.Z) + POSITION_ABOVE_GROUND; }
private void UpdatePosition(Terrain terrain) { Position += Direction * movementSpeed; CheckDistanceTraveled(); CheckTerrainCollision(terrain); }
private void CheckTerrainCollision(Terrain terrain) { float minHeightAllowed = terrain.GetHeight(Position.X, Position.Z); if (Position.Y < minHeightAllowed) { Console.WriteLine("Collided with the ground..."); IsAlive = false; } }
public PlanetCamera(Game game, Vector3 direction, Vector3 up, Vector3 position, Terrain terrain) : base(game, direction, up, position) { this.terrain = terrain; }
private Terrain InitializeTerrain() { terrain = new Terrain(Game, 1.0f, 100.0f); terrain.DrawOrder = 1; Game.Components.Add(terrain); playerHealth.setMaxHealth(); return terrain; }