Update() public method

public Update ( ) : void
return void
Beispiel #1
0
        /// <summary>
        /// Update the world
        /// </summary>
        /// <param name="frameStepTime">Provides a snapshot of timing values.</param>
        public override ScreenElement Update(TimeSpan frameStepTime)
        {
            // All chunks and skydome are updated
            chunkManager.CheckForChunkUpdates(frameStepTime, player.playerData.position);
            skydome.UpdateTimeOfDay(frameStepTime.TotalSeconds, skydomeEffect);

            // Camera collision check
            Vector2 playerMoveVector = new Vector2(
                playerCamera.worldMatrix.Forward.X,
                playerCamera.worldMatrix.Forward.Z
                );

            // First move the player
            player.Update(frameStepTime, playerMoveVector, chunkManager);

            // Keep the sky camera position at the origin
            playerCamera.SetChaseTarget(player.playerData.position + new Vector3(0, 1.5f, 0));
            skydomeCamera.SetChaseTarget(Vector3.Zero);

            // Update camera movement
            playerCamera.Update(frameStepTime);
            skydomeCamera.Update(frameStepTime);

            // Update debug info
            debugStats.vertexCount  = vertexCount;
            debugStats.chunksAdded  = chunkManager.ChunksAdded;
            debugStats.chunksLoaded = chunkManager.voxelCache.voxels.Count;// ChunksLoaded;
            debugStats.cameraPos    = playerCamera.position;
            debugStats.playerPos    = player.playerData.position;
            debugStats.timeOfDay    = skydome.RelativeTimeOfDay;

            return(base.Update(frameStepTime));
        }
Beispiel #2
0
 private void UpdateDetails(GameTime gameTime)
 {
     _info.Update(gameTime);
     _playerCharacter.Update(gameTime);
     _playerCamera.Update(gameTime);
     _currentMap.Update(gameTime);
     _ui.Update(gameTime);
 }
Beispiel #3
0
        public void Update(GameTime gameTime)
        {
            var timer = (float)gameTime.ElapsedGameTime.TotalSeconds;

            Box = new Rectangle((int)Position.X - (int)Size.X / 2, (int)Position.Y - (int)Size.X / 2,
                                texture.Width, texture.Height);
            spriteOrigin = Size / 2;
            shotTimer   -= timer;
            PlayerCamera.Update(gameTime, (int)Position.X, (int)Position.Y);
        }
        /// <summary>
        /// Update the voxel editor
        /// </summary>
        public override ScreenElement Update(TimeSpan frameStepTime)
        {
            if (NewKeyPressed(Keys.Escape))
            {
                this.Exit();
            }

            editorCamera.Update(frameStepTime);

            return(base.Update(frameStepTime));
        }
Beispiel #5
0
        public override void Update(float dt)
        {
            PlayerController.Update(dt);

            if (PlayerController.Changed())
            {
                var rotation = PlayerCamera.GetRotation();
                rotation += new Float3(PlayerController.RotationDelta) * dt;
                float rotationY = RyneMath.Clamp(rotation.Y, -89.0f, 89.0f);
                PlayerCamera.SetRotation(new Float3(rotation.X, rotationY, 0));

                // We only want the player entity to rotate horizontally
                Transform.Rotation = new Rotator(new Float3(rotation.X, 0, 0)).ToQuaternion();
            }

            PlayerCamera.SetPosition(Transform.GetLocation());
            PlayerCamera.Update(dt);
        }
Beispiel #6
0
 void Update()
 {
     m_PlayerControl.Update(transform);
     m_PlayerCamera.Update();
 }