Ejemplo n.º 1
0
        public GameSoundManager(ISoundEngine soundEngine,
                                CameraManager <ICameraFocused> cameraManager,
                                SingleArrayChunkContainer singleArray,
                                IVisualDynamicEntityManager dynamicEntityManager,
                                IChunkEntityImpactManager chunkEntityImpactManager,
                                IWorldChunks worldChunk,
                                IClock gameClockTime,
                                PlayerEntityManager playerEntityManager,
                                VisualWorldParameters visualWorldParameters,
                                IClock worlClock)
        {
            _cameraManager            = cameraManager;
            _soundEngine              = soundEngine;
            _singleArray              = singleArray;
            _worldChunk               = worldChunk;
            _chunkEntityImpactManager = chunkEntityImpactManager;
            _gameClockTime            = gameClockTime;
            _playerEntityManager      = playerEntityManager;
            _visualWorldParameters    = visualWorldParameters;
            _worlClock = worlClock;
            if (visualWorldParameters.WorldParameters.Configuration is UtopiaWorldConfiguration)
            {
                _biomesParams = ((UtopiaWorldConfiguration)visualWorldParameters.WorldParameters.Configuration).ProcessorParam;
            }

            _dynamicEntityManager = dynamicEntityManager;
            _stepsTracker.Add(new DynamicEntitySoundTrack {
                Entity = _playerEntityManager.Player, Position = _playerEntityManager.Player.Position, isLocalSound = true
            });
            _playerEntityManager.PlayerEntityChanged += _playerEntityManager_PlayerEntityChanged;

            //Register to Events

            _dynamicEntityManager.EntityAdded             += DynamicEntityManagerEntityAdded;
            _dynamicEntityManager.EntityRemoved           += DynamicEntityManagerEntityRemoved;
            _chunkEntityImpactManager.BlockReplaced       += _chunkEntityImpactManager_BlockReplaced;
            _chunkEntityImpactManager.StaticEntityAdd     += StaticEntityAdd;
            _chunkEntityImpactManager.StaticEntityRemoved += StaticEntityRemoved;

            _rnd        = new FastRandom();
            MoodsSounds = new Dictionary <MoodSoundKey, List <IUtopiaSoundSource> >();

            IsDefferedLoadContent = true; //Make LoadContent executed in thread
        }
Ejemplo n.º 2
0
        public WorldChunks(D3DEngine d3dEngine,
                           CameraManager <ICameraFocused> camManager,
                           VisualWorldParameters visualWorldParameters,
                           WorldFocusManager worldFocusManager,
                           GameStatesManager gameStates,
                           IClock gameClock,
                           SingleArrayChunkContainer cubesHolder,
                           ILandscapeManager2D landscapeManager,
                           IChunkMeshManager chunkMeshManager,
                           IChunksWrapper chunkWrapper,
                           ILightingManager lightingManager,
                           IChunkStorageManager chunkstorage,
                           ServerComponent server,
                           IWeather weather,
                           [Named("SkyBuffer")] StaggingBackBuffer skyBackBuffer,
                           VoxelModelManager voxelModelManager,
                           IChunkEntityImpactManager chunkEntityImpactManager,
                           InputsManager inputsManager
                           )
        {
            _server                   = server;
            _chunkstorage             = chunkstorage;
            _d3dEngine                = d3dEngine;
            _worldFocusManager        = worldFocusManager;
            _gameStates               = gameStates;
            _camManager               = camManager;
            _gameClock                = gameClock;
            VisualWorldParameters     = visualWorldParameters;
            _cubesHolder              = cubesHolder;
            _chunkWrapper             = chunkWrapper;
            _landscapeManager         = landscapeManager;
            _chunkMeshManager         = chunkMeshManager;
            _lightingManager          = lightingManager;
            _weather                  = weather;
            _skyBackBuffer            = skyBackBuffer;
            _voxelModelManager        = voxelModelManager;
            _chunkEntityImpactManager = chunkEntityImpactManager;
            _inputsManager            = inputsManager;

            _skyBackBuffer.OnStaggingBackBufferChanged += _skyBackBuffer_OnStaggingBackBufferChanged;

            SliceViewChunks = 25;

            DrawStaticInstanced = true;

            if (visualWorldParameters.WorldParameters.Configuration is UtopiaWorldConfiguration)
            {
                _utopiaProcessorParam = ((UtopiaWorldConfiguration)visualWorldParameters.WorldParameters.Configuration).ProcessorParam;
            }

            //Self injecting inside components, to avoid circular dependency
            _chunkWrapper.WorldChunks     = this;
            lightingManager.WorldChunk    = this;
            _chunkMeshManager.WorldChunks = this;
            landscapeManager.WorldChunks  = this;

            DrawOrders.UpdateIndex(SOLID_DRAW, 100, "SOLID_DRAW");
            TRANSPARENT_DRAW = DrawOrders.AddIndex(1050, "TRANSPARENT_DRAW");
            ENTITIES_DRAW    = DrawOrders.AddIndex(101, "ENTITIES_DRAW");

            this.IsDefferedLoadContent = true;
        }