public SingleArrayLandscapeCursor(IChunkEntityImpactManager landscapeManager, Vector3I blockPosition, WorldConfiguration config)
 {
     if (landscapeManager == null)
     {
         throw new ArgumentNullException("landscapeManager");
     }
     _landscapeManager = landscapeManager;
     GlobalPosition    = blockPosition;
     _config           = config;
     landscapeManager.CubesHolder.Index(blockPosition.X, blockPosition.Y, blockPosition.Z, true, out _bigArrayIndex);
 }
Exemplo n.º 2
0
 public RealmGameSoundManager(ISoundEngine soundEngine,
                              CameraManager <ICameraFocused> cameraManager,
                              SingleArrayChunkContainer singleArray,
                              IVisualDynamicEntityManager dynamicEntityManager,
                              IChunkEntityImpactManager chunkEntityImpactManager,
                              IWorldChunks worldChunk,
                              IClock gameClockTime,
                              PlayerEntityManager playerEntityManager,
                              VisualWorldParameters visualWorldParameters,
                              IClock worlClock)
     : base(soundEngine, cameraManager, singleArray, dynamicEntityManager, chunkEntityImpactManager, worldChunk, gameClockTime, playerEntityManager, visualWorldParameters, worlClock)
 {
     PreLoadSound("Hurt", @"Sounds\Events\hurt.adpcm.wav", 0.3f, 16.0f, 100);
     PreLoadSound("Dying", @"Sounds\Events\dying.adpcm.wav", 0.5f, 16.0f, 1000);
 }
        /// <summary>
        /// Creates new instance of EntityMessageTranslator
        /// </summary>
        public EntityMessageTranslator(
            ServerComponent server,
            PlayerEntityManager playerEntityManager,
            IVisualDynamicEntityManager dynamicEntityManager,
            IChunkEntityImpactManager landscapeManager,
            SyncManager syncManager)
        {
            _server = server;

            //Handle Entity received Message from Server
            _server.MessageEntityIn              += ServerMessageEntityIn;
            _server.MessageEntityOut             += ServerMessageEntityOut;
            _server.MessagePosition              += ServerMessagePosition;
            _server.MessageDirection             += ServerMessageDirection;
            _server.MessageEntityLock            += ServerMessageEntityLock;
            _server.MessageEntityUse             += _server_MessageEntityUse;
            _server.MessageEntityEquipment       += _server_MessageEntityEquipment;
            _server.MessageUseFeedback           += _server_MessageUseFeedback;
            _server.MessageItemTransfer          += _server_MessageItemTransfer;
            _server.MessageEntityVoxelModel      += ServerOnMessageEntityVoxelModel;
            _server.MessageEntityHealth          += _server_MessageEntityHealth;
            _server.MessageEntityHealthState     += _server_MessageEntityHealthState;
            _server.MessageEntityAfflictionState += _server_MessageEntityAfflictionState;

            if (dynamicEntityManager == null)
            {
                throw new ArgumentNullException("dynamicEntityManager");
            }
            if (landscapeManager == null)
            {
                throw new ArgumentNullException("landscapeManager");
            }
            if (syncManager == null)
            {
                throw new ArgumentNullException("syncManager");
            }
            if (playerEntityManager == null)
            {
                throw new ArgumentNullException("playerEntityManager");
            }

            _dynamicEntityManager = dynamicEntityManager;
            _landscapeManager     = landscapeManager;
            _syncManager          = syncManager;
            PlayerEntity          = playerEntityManager.PlayerCharacter;
            playerEntityManager.PlayerEntityChanged += (sender, args) => { PlayerEntity = args.PlayerCharacter; };
        }
Exemplo n.º 4
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
        }
Exemplo n.º 5
0
        public VisualChunkBase(
            D3DEngine d3DEngine,
            WorldFocusManager worldFocusManager,
            VisualWorldParameters visualWorldParameter,
            Range3I cubeRange,
            CameraManager <ICameraFocused> cameraManager,
            WorldChunks worldChunkManager,
            VoxelModelManager voxelModelManager,
            IChunkEntityImpactManager chunkEntityImpactManager,
            ChunkDataProvider provider = null)
            : base(provider)
        {
            _cachedTrees = new Dictionary <TreeBpSeed, VisualVoxelModel>();

            Graphics = new ChunkGraphics(this, d3DEngine);

            _d3DEngine                = d3DEngine;
            _worldFocusManager        = worldFocusManager;
            _worldChunkManager        = worldChunkManager;
            _chunkEntityImpactManager = chunkEntityImpactManager;
#if DEBUG
            _blockpickedUPEffect = new HLSLVertexPositionColor(_d3DEngine.Device);
#endif

            _visualWorldParameters = visualWorldParameter;

            _cameraManager        = cameraManager;
            _voxelModelManager    = voxelModelManager;
            _visualVoxelEntities  = new Dictionary <string, List <VisualVoxelEntity> >();
            EmitterStaticEntities = new List <EntityMetaData>();
            OutOfChunkLightSourceStaticEntities = new List <ILightEmitterEntity>();
            SoundStaticEntities = new List <IItem>();
            CubeRange           = cubeRange;
            State = ChunkState.Empty;
            Entities.EntityAdded       += EntitiesEntityAdded;
            Entities.EntityRemoved     += EntitiesEntityRemoved;
            Entities.CollectionCleared += EntitiesCollectionCleared;
        }
Exemplo n.º 6
0
 public VisualChunk(D3DEngine d3DEngine,
                    WorldFocusManager worldFocusManager,
                    VisualWorldParameters visualWorldParameter,
                    ref Range3I cubeRange,
                    SingleArrayChunkContainer singleArrayContainer,
                    CameraManager <ICameraFocused> cameraManager,
                    WorldChunks worldChunkManager,
                    VoxelModelManager voxelModelManager,
                    IChunkEntityImpactManager chunkEntityImpactManager,
                    ChunkDataProvider provider = null)  :
     base(d3DEngine,
          worldFocusManager,
          visualWorldParameter,
          cubeRange,
          cameraManager,
          worldChunkManager,
          voxelModelManager,
          chunkEntityImpactManager,
          new SingleArrayDataProvider(singleArrayContainer))
 {
     ((SingleArrayDataProvider)base.BlockData).DataProviderUser = this; //Didn't find a way to pass it inside the constructor
     _singleArrayContainer = singleArrayContainer;
 }
Exemplo n.º 7
0
 public VisualChunk3D(
     D3DEngine d3DEngine,
     WorldFocusManager worldFocusManager,
     VisualWorldParameters visualWorldParameter,
     Range3I cubeRange,
     CameraManager <ICameraFocused> cameraManager,
     WorldChunks worldChunkManager,
     VoxelModelManager voxelModelManager,
     IChunkEntityImpactManager chunkEntityImpactManager,
     ChunkDataProvider provider = null) :
     base(
         d3DEngine,
         worldFocusManager,
         visualWorldParameter,
         cubeRange,
         cameraManager,
         worldChunkManager,
         voxelModelManager,
         chunkEntityImpactManager,
         provider)
 {
     _lights = new ByteColor[BlockData.ChunkSize.Volume];
 }
Exemplo n.º 8
0
        public UtopiaParticuleEngine(D3DEngine d3dEngine,
                                     SharedFrameCB sharedFrameCB,
                                     CameraManager <ICameraFocused> cameraManager,
                                     InputsManager inputsManager,
                                     VisualWorldParameters worldParameters,
                                     IChunkEntityImpactManager chunkEntityImpactManager,
                                     IWorldChunks worldChunks,
                                     ILandscapeManager landscapeManager,
                                     IWeather weather)
            : base(d3dEngine, sharedFrameCB.CBPerFrame)
        {
            _sharedFrameCB            = sharedFrameCB;
            _cameraManager            = cameraManager;
            _inputsManager            = inputsManager;
            _worldParameters          = worldParameters;
            _chunkEntityImpactManager = chunkEntityImpactManager;
            _worldChunks      = worldChunks;
            _landscapeManager = landscapeManager;
            _weather          = weather;

            _chunkEntityImpactManager.BlockReplaced += _chunkEntityImpactManager_BlockReplaced;

            this.IsDefferedLoadContent = true;
        }
Exemplo n.º 9
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;
        }