Example #1
0
        public void UpdateLogic(LandWorld world, Time deltaTime)
        {
            foreach (PlayerEntity playerEntity in this.playerEntitiesUpdated)
            {
                world.OnFocusAreaChanged(playerEntity.TruePosition, this.worldResolution);
            }

            foreach (KeyValuePair <PlayerEntity, bool> playerEntityEntry in this.playerEntityToAdded)
            {
                if (playerEntityEntry.Value == false)
                {
                    ILandChunk landChunk = world.GetLandChunkAt(playerEntityEntry.Key.Position.X, playerEntityEntry.Key.Position.Y);

                    if (landChunk != null)
                    {
                        // Update player altitude
                        int altitude = world.GetAltitudeAt(playerEntityEntry.Key.Position.X, playerEntityEntry.Key.Position.Y);
                        playerEntityEntry.Key.SetPosition(playerEntityEntry.Key.Position.X, playerEntityEntry.Key.Position.Y, altitude);

                        world.EntityManager.AddEntity(playerEntityEntry.Key, landChunk);
                    }
                }
            }

            this.playerEntitiesUpdated.Clear();
        }
Example #2
0
        public void UpdateLogic(LandWorld world, Time deltaTime)
        {
            // World update
            this.WorldUpdater.UpdateLogic(this, deltaTime);

            // Chunks adding.
            this.UpdateLandChunks();

            // Entities update.
            this.EntityManager.UpdateLogic(this, deltaTime);
        }