コード例 #1
0
        public void Update(GameTime gameTime, Terrain terrain)
        {
            if (IsAlive)
                UpdatePosition(terrain);

            base.Update(gameTime);
        }
コード例 #2
0
 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;
 }
コード例 #3
0
 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();
 }
コード例 #4
0
        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;
            }
        }
コード例 #5
0
 public void Update(Camera camera, Terrain terrain)
 {
     UpdateRollAngle();
     UpdateYawAngle();
     UpdatePosition(camera, terrain);
 }
コード例 #6
0
        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;
        }
コード例 #7
0
 private void UpdatePosition(Terrain terrain)
 {
     Position += Direction * movementSpeed;
     CheckDistanceTraveled();
     CheckTerrainCollision(terrain);
 }
コード例 #8
0
 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;
     }
 }
コード例 #9
0
 public PlanetCamera(Game game, Vector3 direction, Vector3 up, Vector3 position, Terrain terrain)
     : base(game, direction, up, position)
 {
     this.terrain = terrain;
 }
コード例 #10
0
 private Terrain InitializeTerrain()
 {
     terrain = new Terrain(Game, 1.0f, 100.0f);
     terrain.DrawOrder = 1;
     Game.Components.Add(terrain);
     playerHealth.setMaxHealth();
     return terrain;
 }